From 25cd5920e5fdab49f3d3d095a628e392ba1de1a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Wed, 7 Oct 2009 19:48:07 +0300 Subject: [PATCH] KEY_SPACE = 32, simplify several outputs and interfaces --- include/vlc_keys.h | 3 +-- modules/control/globalhotkeys/xcb.c | 9 ++++----- modules/gui/beos/VideoOutput.cpp | 2 +- modules/gui/macosx/intf.m | 1 - modules/gui/qt4/util/customwidgets.cpp | 2 +- modules/gui/skins2/controls/ctrl_tree.cpp | 2 +- modules/gui/skins2/win32/win32_loop.cpp | 2 +- modules/gui/skins2/x11/x11_loop.cpp | 1 - modules/video_output/aa.c | 3 --- modules/video_output/caca.c | 2 -- modules/video_output/msw/events.c | 2 +- modules/video_output/sdl.c | 2 +- modules/video_output/xcb/keys.c | 7 ++----- src/libvlc-module.c | 2 +- 14 files changed, 14 insertions(+), 26 deletions(-) diff --git a/include/vlc_keys.h b/include/vlc_keys.h index 4f7fe397a0..cc2cca5380 100644 --- a/include/vlc_keys.h +++ b/include/vlc_keys.h @@ -47,7 +47,6 @@ #define KEY_RIGHT 0x00220000 #define KEY_UP 0x00230000 #define KEY_DOWN 0x00240000 -#define KEY_SPACE 0x00250000 #define KEY_ENTER 0x00260000 #define KEY_F1 0x00270000 #define KEY_F2 0x00280000 @@ -114,6 +113,7 @@ enum { vlc_num_modifiers=sizeof(vlc_modifiers) static const struct key_descriptor_s vlc_keys[] = { { "Unset", KEY_UNSET }, + { "Space", ' ' }, { "!", '!' }, { "\"", '\"' }, { "#", '#' }, @@ -182,7 +182,6 @@ static const struct key_descriptor_s vlc_keys[] = { "Right", KEY_RIGHT }, { "Up", KEY_UP }, { "Down", KEY_DOWN }, - { "Space", KEY_SPACE }, { "Enter", KEY_ENTER }, { "F1", KEY_F1 }, { "F2", KEY_F2 }, diff --git a/modules/control/globalhotkeys/xcb.c b/modules/control/globalhotkeys/xcb.c index 348205f427..ca8296f3cc 100644 --- a/modules/control/globalhotkeys/xcb.c +++ b/modules/control/globalhotkeys/xcb.c @@ -230,7 +230,6 @@ static const struct { XK_Return, KEY_ENTER }, { XK_KP_Enter, KEY_ENTER }, - { XK_space, KEY_SPACE }, { XK_Escape, KEY_ESC }, { XK_Menu, KEY_MENU }, @@ -258,16 +257,16 @@ static const struct }; static xcb_keysym_t GetX11Key( unsigned i_vlc ) { + /* X11 and VLC use ASCII for printable ASCII characters */ + if( i_vlc >= 32 && i_vlc <= 127 ) + return i_vlc; + for( int i = 0; x11keys_to_vlckeys[i].i_vlc != 0; i++ ) { if( x11keys_to_vlckeys[i].i_vlc == i_vlc ) return x11keys_to_vlckeys[i].i_x11; } - /* Copied from xcb, it seems that xcb use ascii code for ascii characters */ - if( isascii( i_vlc ) ) - return i_vlc; - return XK_VoidSymbol; } diff --git a/modules/gui/beos/VideoOutput.cpp b/modules/gui/beos/VideoOutput.cpp index cb1805bebc..e6538bd854 100644 --- a/modules/gui/beos/VideoOutput.cpp +++ b/modules/gui/beos/VideoOutput.cpp @@ -112,7 +112,7 @@ static const int beos_keys[][2] = { B_RIGHT_ARROW, KEY_RIGHT }, { B_UP_ARROW, KEY_UP }, { B_DOWN_ARROW, KEY_DOWN }, - { B_SPACE, KEY_SPACE }, + { B_SPACE, ' ' }, { B_ENTER, KEY_ENTER }, { B_F1_KEY, KEY_F1 }, { B_F2_KEY, KEY_F2 }, diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 1d49df70ef..d099e761cf 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -1279,7 +1279,6 @@ static struct { NSCarriageReturnCharacter, KEY_ENTER }, { NSEnterCharacter, KEY_ENTER }, { NSBackspaceCharacter, KEY_BACKSPACE }, - { (unichar) ' ', KEY_SPACE }, { (unichar) 0x1b, KEY_ESC }, {0,0} }; diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp index 9004517d89..c02945cbd8 100644 --- a/modules/gui/qt4/util/customwidgets.cpp +++ b/modules/gui/qt4/util/customwidgets.cpp @@ -174,7 +174,7 @@ int qtEventToVLCKey( QKeyEvent *e ) HANDLE( Key_Right, KEY_RIGHT ); HANDLE( Key_Up, KEY_UP ); HANDLE( Key_Down, KEY_DOWN ); - HANDLE( Key_Space, KEY_SPACE ); + HANDLE( Key_Space, ' ' ); HANDLE( Key_Escape, KEY_ESC ); HANDLE( Key_Return, KEY_ENTER ); HANDLE( Key_Enter, KEY_ENTER ); diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp index 9879e1567c..4819646b29 100644 --- a/modules/gui/skins2/controls/ctrl_tree.cpp +++ b/modules/gui/skins2/controls/ctrl_tree.cpp @@ -430,7 +430,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) } } } - else if( key == KEY_ENTER || key == KEY_SPACE ) + else if( key == KEY_ENTER || key == ' ' ) { // Go up one level (and close node) if( &*it == m_pLastSelected ) diff --git a/modules/gui/skins2/win32/win32_loop.cpp b/modules/gui/skins2/win32/win32_loop.cpp index e349a81ecb..557565c6ef 100644 --- a/modules/gui/skins2/win32/win32_loop.cpp +++ b/modules/gui/skins2/win32/win32_loop.cpp @@ -60,7 +60,7 @@ Win32Loop::Win32Loop( intf_thread_t *pIntf ): OSLoop( pIntf ) virtKeyToVlcKey[VK_F11] = KEY_F11; virtKeyToVlcKey[VK_F12] = KEY_F12; virtKeyToVlcKey[VK_RETURN] = KEY_ENTER; - virtKeyToVlcKey[VK_SPACE] = KEY_SPACE; + virtKeyToVlcKey[VK_SPACE] = ' '; virtKeyToVlcKey[VK_ESCAPE] = KEY_ESC; virtKeyToVlcKey[VK_LEFT] = KEY_LEFT; virtKeyToVlcKey[VK_RIGHT] = KEY_RIGHT; diff --git a/modules/gui/skins2/x11/x11_loop.cpp b/modules/gui/skins2/x11/x11_loop.cpp index 269fba6986..4e11ce989d 100644 --- a/modules/gui/skins2/x11/x11_loop.cpp +++ b/modules/gui/skins2/x11/x11_loop.cpp @@ -67,7 +67,6 @@ X11Loop::X11Loop( intf_thread_t *pIntf, X11Display &rDisplay ): keysymToVlcKey[XK_F11] = KEY_F11; keysymToVlcKey[XK_F12] = KEY_F12; keysymToVlcKey[XK_Return] = KEY_ENTER; - keysymToVlcKey[XK_space] = KEY_SPACE; keysymToVlcKey[XK_Escape] = KEY_ESC; keysymToVlcKey[XK_Left] = KEY_LEFT; keysymToVlcKey[XK_Right] = KEY_RIGHT; diff --git a/modules/video_output/aa.c b/modules/video_output/aa.c index 705b3c4244..528f528d86 100644 --- a/modules/video_output/aa.c +++ b/modules/video_output/aa.c @@ -306,9 +306,6 @@ static void Manage(vout_display_t *vd) case AA_ESC: vout_display_SendEventKey(vd, KEY_ESC); break; - case 0x20: - vout_display_SendEventKey(vd, KEY_SPACE); - break; default: if (event >= 0x20 && event <= 0x7f) vout_display_SendEventKey(vd, event); diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c index 965b14ef7c..57f9b40eb7 100644 --- a/modules/video_output/caca.c +++ b/modules/video_output/caca.c @@ -436,8 +436,6 @@ static const struct { { CACA_KEY_PAGEUP, KEY_PAGEUP }, { CACA_KEY_PAGEDOWN,KEY_PAGEDOWN }, - { ' ', KEY_SPACE }, - /* */ { -1, -1 } }; diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c index 44867abbae..b34a925506 100644 --- a/modules/video_output/msw/events.c +++ b/modules/video_output/msw/events.c @@ -861,7 +861,7 @@ static struct { VK_F12, KEY_F12 }, { VK_RETURN, KEY_ENTER }, - { VK_SPACE, KEY_SPACE }, + { VK_SPACE, ' ' }, { VK_ESCAPE, KEY_ESC }, { VK_LEFT, KEY_LEFT }, diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c index d110c1b098..e769042dc6 100644 --- a/modules/video_output/sdl.c +++ b/modules/video_output/sdl.c @@ -684,7 +684,7 @@ static const struct { { SDLK_RETURN, KEY_ENTER }, { SDLK_KP_ENTER, KEY_ENTER }, - { SDLK_SPACE, KEY_SPACE }, + { SDLK_SPACE, ' ' }, { SDLK_ESCAPE, KEY_ESC }, { SDLK_MENU, KEY_MENU }, diff --git a/modules/video_output/xcb/keys.c b/modules/video_output/xcb/keys.c index e57fd244e1..1a976b6ebe 100644 --- a/modules/video_output/xcb/keys.c +++ b/modules/video_output/xcb/keys.c @@ -105,7 +105,7 @@ static int ConvertKeySym (xcb_keysym_t sym) { XK_Begin, KEY_HOME, }, { XK_Insert, KEY_INSERT, }, { XK_Menu, KEY_MENU }, - { XK_KP_Space, KEY_SPACE, }, + { XK_KP_Space, ' ', }, { XK_KP_Tab, KEY_TAB, }, { XK_KP_Enter, KEY_ENTER, }, { XK_KP_F1, KEY_F1, }, @@ -156,10 +156,7 @@ static int ConvertKeySym (xcb_keysym_t sym) { XF86XK_Reload, KEY_BROWSER_REFRESH, }, }; - /* X11 and VLC both use the ASCII code for printable ASCII characters, - * except for space (only X11). */ - if (sym == XK_space) - return KEY_SPACE; + /* X11 and VLC both use the ASCII code for printable ASCII characters. */ if (isascii(sym)) return sym; diff --git a/src/libvlc-module.c b/src/libvlc-module.c index a85b29f579..6945e00fd1 100644 --- a/src/libvlc-module.c +++ b/src/libvlc-module.c @@ -2298,7 +2298,7 @@ vlc_module_begin () */ # define KEY_TOGGLE_FULLSCREEN 'f' # define KEY_LEAVE_FULLSCREEN KEY_ESC -# define KEY_PLAY_PAUSE KEY_SPACE +# define KEY_PLAY_PAUSE ' ' # define KEY_PAUSE KEY_UNSET # define KEY_PLAY KEY_UNSET # define KEY_FASTER '+' -- 2.39.2