Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
bfa9e5bb
Commit
bfa9e5bb
authored
Sep 13, 2007
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ncurses: Use ncursesw to correctly display wide characters on
UTF-8
locale
parent
55f476f5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
31 deletions
+46
-31
NEWS
NEWS
+2
-0
configure.ac
configure.ac
+1
-1
modules/gui/ncurses.c
modules/gui/ncurses.c
+43
-30
No files found.
NEWS
View file @
bfa9e5bb
...
@@ -111,6 +111,8 @@ Interfaces:
...
@@ -111,6 +111,8 @@ Interfaces:
interface for media players that intends to become an xdg standard when
interface for media players that intends to become an xdg standard when
finished: http://wiki.xmms2.xmms.se/index.php/Media_Player_Interfaces .
finished: http://wiki.xmms2.xmms.se/index.php/Media_Player_Interfaces .
* Motion module use disk accelerometers to keep video horizontal
* Motion module use disk accelerometers to keep video horizontal
* Ncurses interface now uses ncursesw to correctly display wide characters
when using an UTF-8 locale.
Linux Port:
Linux Port:
* VLC now complies with the XDG Base Directory Specification version 0.6
* VLC now complies with the XDG Base Directory Specification version 0.6
...
...
configure.ac
View file @
bfa9e5bb
...
@@ -5313,7 +5313,7 @@ AC_ARG_ENABLE(ncurses,
...
@@ -5313,7 +5313,7 @@ AC_ARG_ENABLE(ncurses,
[ --enable-ncurses ncurses interface support (default disabled)],
[ --enable-ncurses ncurses interface support (default disabled)],
[if test "${enable_ncurses}" = "yes"; then
[if test "${enable_ncurses}" = "yes"; then
VLC_ADD_PLUGINS([ncurses])
VLC_ADD_PLUGINS([ncurses])
VLC_ADD_LDFLAGS([ncurses],[-lncurses])
VLC_ADD_LDFLAGS([ncurses],[-lncurses
w
])
fi])
fi])
dnl
dnl
...
...
modules/gui/ncurses.c
View file @
bfa9e5bb
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include <errno.h>
/* ENOMEM */
#include <errno.h>
/* ENOMEM */
#include <time.h>
#include <time.h>
#include <curses.h>
#include <
ncursesw/
curses.h>
#include <vlc_interface.h>
#include <vlc_interface.h>
#include <vlc_vout.h>
#include <vlc_vout.h>
...
@@ -1125,19 +1125,33 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
...
@@ -1125,19 +1125,33 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
va_list
vl_args
;
va_list
vl_args
;
char
*
p_buf
=
NULL
;
char
*
p_buf
=
NULL
;
int
i_len
;
int
i_len
;
size_t
i_char_len
;
/* UCS character length */
size_t
i_width
;
/* Display width */
wchar_t
*
psz_wide
;
/* wchar_t representation of p_buf */
va_start
(
vl_args
,
p_fmt
);
va_start
(
vl_args
,
p_fmt
);
vasprintf
(
&
p_buf
,
p_fmt
,
vl_args
);
vasprintf
(
&
p_buf
,
p_fmt
,
vl_args
);
va_end
(
vl_args
);
va_end
(
vl_args
);
if
(
p_buf
==
NULL
)
if
(
(
p_buf
==
NULL
)
||
(
w
<=
0
)
)
{
return
;
return
;
}
if
(
w
>
0
)
i_len
=
strlen
(
p_buf
);
{
psz_wide
=
(
wchar_t
*
)
malloc
(
sizeof
(
wchar_t
)
*
(
i_len
+
1
)
);
if
(
(
i_len
=
strlen
(
p_buf
)
)
>
w
)
i_char_len
=
mbstowcs
(
psz_wide
,
p_buf
,
i_len
);
if
(
i_char_len
==
-
1
)
/* an invalid character was encountered */
i_width
=
i_len
;
else
{
{
i_width
=
wcswidth
(
psz_wide
,
i_char_len
);
if
(
i_width
==
-
1
)
/* a non printable character was encountered */
i_width
=
i_len
;
}
if
(
i_width
>
w
)
{
/* FIXME: ellipsize psz_wide while keeping the width in mind */
char
*
psz_local
;
char
*
psz_local
;
int
i_cut
=
i_len
-
w
;
int
i_cut
=
i_len
-
w
;
int
x1
=
i_len
/
2
-
i_cut
/
2
;
int
x1
=
i_len
/
2
-
i_cut
/
2
;
...
@@ -1163,8 +1177,7 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
...
@@ -1163,8 +1177,7 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
char
*
psz_local
=
ToLocale
(
p_buf
);
char
*
psz_local
=
ToLocale
(
p_buf
);
mvprintw
(
y
,
x
,
"%s"
,
psz_local
);
mvprintw
(
y
,
x
,
"%s"
,
psz_local
);
LocaleFree
(
p_buf
);
LocaleFree
(
p_buf
);
mvhline
(
y
,
x
+
i_len
,
' '
,
w
-
i_len
);
mvhline
(
y
,
x
+
i_width
,
' '
,
w
-
i_width
);
}
}
}
}
}
static
void
MainBoxWrite
(
intf_thread_t
*
p_intf
,
int
l
,
int
x
,
const
char
*
p_fmt
,
...
)
static
void
MainBoxWrite
(
intf_thread_t
*
p_intf
,
int
l
,
int
x
,
const
char
*
p_fmt
,
...
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment