Commit 25cd5920 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

KEY_SPACE = 32, simplify several outputs and interfaces

parent fdd95314
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#define KEY_RIGHT 0x00220000 #define KEY_RIGHT 0x00220000
#define KEY_UP 0x00230000 #define KEY_UP 0x00230000
#define KEY_DOWN 0x00240000 #define KEY_DOWN 0x00240000
#define KEY_SPACE 0x00250000
#define KEY_ENTER 0x00260000 #define KEY_ENTER 0x00260000
#define KEY_F1 0x00270000 #define KEY_F1 0x00270000
#define KEY_F2 0x00280000 #define KEY_F2 0x00280000
...@@ -114,6 +113,7 @@ enum { vlc_num_modifiers=sizeof(vlc_modifiers) ...@@ -114,6 +113,7 @@ enum { vlc_num_modifiers=sizeof(vlc_modifiers)
static const struct key_descriptor_s vlc_keys[] = static const struct key_descriptor_s vlc_keys[] =
{ {
{ "Unset", KEY_UNSET }, { "Unset", KEY_UNSET },
{ "Space", ' ' },
{ "!", '!' }, { "!", '!' },
{ "\"", '\"' }, { "\"", '\"' },
{ "#", '#' }, { "#", '#' },
...@@ -182,7 +182,6 @@ static const struct key_descriptor_s vlc_keys[] = ...@@ -182,7 +182,6 @@ static const struct key_descriptor_s vlc_keys[] =
{ "Right", KEY_RIGHT }, { "Right", KEY_RIGHT },
{ "Up", KEY_UP }, { "Up", KEY_UP },
{ "Down", KEY_DOWN }, { "Down", KEY_DOWN },
{ "Space", KEY_SPACE },
{ "Enter", KEY_ENTER }, { "Enter", KEY_ENTER },
{ "F1", KEY_F1 }, { "F1", KEY_F1 },
{ "F2", KEY_F2 }, { "F2", KEY_F2 },
......
...@@ -230,7 +230,6 @@ static const struct ...@@ -230,7 +230,6 @@ static const struct
{ XK_Return, KEY_ENTER }, { XK_Return, KEY_ENTER },
{ XK_KP_Enter, KEY_ENTER }, { XK_KP_Enter, KEY_ENTER },
{ XK_space, KEY_SPACE },
{ XK_Escape, KEY_ESC }, { XK_Escape, KEY_ESC },
{ XK_Menu, KEY_MENU }, { XK_Menu, KEY_MENU },
...@@ -258,16 +257,16 @@ static const struct ...@@ -258,16 +257,16 @@ static const struct
}; };
static xcb_keysym_t GetX11Key( unsigned i_vlc ) 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++ ) for( int i = 0; x11keys_to_vlckeys[i].i_vlc != 0; i++ )
{ {
if( x11keys_to_vlckeys[i].i_vlc == i_vlc ) if( x11keys_to_vlckeys[i].i_vlc == i_vlc )
return x11keys_to_vlckeys[i].i_x11; 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; return XK_VoidSymbol;
} }
......
...@@ -112,7 +112,7 @@ static const int beos_keys[][2] = ...@@ -112,7 +112,7 @@ static const int beos_keys[][2] =
{ B_RIGHT_ARROW, KEY_RIGHT }, { B_RIGHT_ARROW, KEY_RIGHT },
{ B_UP_ARROW, KEY_UP }, { B_UP_ARROW, KEY_UP },
{ B_DOWN_ARROW, KEY_DOWN }, { B_DOWN_ARROW, KEY_DOWN },
{ B_SPACE, KEY_SPACE }, { B_SPACE, ' ' },
{ B_ENTER, KEY_ENTER }, { B_ENTER, KEY_ENTER },
{ B_F1_KEY, KEY_F1 }, { B_F1_KEY, KEY_F1 },
{ B_F2_KEY, KEY_F2 }, { B_F2_KEY, KEY_F2 },
......
...@@ -1279,7 +1279,6 @@ static struct ...@@ -1279,7 +1279,6 @@ static struct
{ NSCarriageReturnCharacter, KEY_ENTER }, { NSCarriageReturnCharacter, KEY_ENTER },
{ NSEnterCharacter, KEY_ENTER }, { NSEnterCharacter, KEY_ENTER },
{ NSBackspaceCharacter, KEY_BACKSPACE }, { NSBackspaceCharacter, KEY_BACKSPACE },
{ (unichar) ' ', KEY_SPACE },
{ (unichar) 0x1b, KEY_ESC }, { (unichar) 0x1b, KEY_ESC },
{0,0} {0,0}
}; };
......
...@@ -174,7 +174,7 @@ int qtEventToVLCKey( QKeyEvent *e ) ...@@ -174,7 +174,7 @@ int qtEventToVLCKey( QKeyEvent *e )
HANDLE( Key_Right, KEY_RIGHT ); HANDLE( Key_Right, KEY_RIGHT );
HANDLE( Key_Up, KEY_UP ); HANDLE( Key_Up, KEY_UP );
HANDLE( Key_Down, KEY_DOWN ); HANDLE( Key_Down, KEY_DOWN );
HANDLE( Key_Space, KEY_SPACE ); HANDLE( Key_Space, ' ' );
HANDLE( Key_Escape, KEY_ESC ); HANDLE( Key_Escape, KEY_ESC );
HANDLE( Key_Return, KEY_ENTER ); HANDLE( Key_Return, KEY_ENTER );
HANDLE( Key_Enter, KEY_ENTER ); HANDLE( Key_Enter, KEY_ENTER );
......
...@@ -430,7 +430,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -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) // Go up one level (and close node)
if( &*it == m_pLastSelected ) if( &*it == m_pLastSelected )
......
...@@ -60,7 +60,7 @@ Win32Loop::Win32Loop( intf_thread_t *pIntf ): OSLoop( pIntf ) ...@@ -60,7 +60,7 @@ Win32Loop::Win32Loop( intf_thread_t *pIntf ): OSLoop( pIntf )
virtKeyToVlcKey[VK_F11] = KEY_F11; virtKeyToVlcKey[VK_F11] = KEY_F11;
virtKeyToVlcKey[VK_F12] = KEY_F12; virtKeyToVlcKey[VK_F12] = KEY_F12;
virtKeyToVlcKey[VK_RETURN] = KEY_ENTER; virtKeyToVlcKey[VK_RETURN] = KEY_ENTER;
virtKeyToVlcKey[VK_SPACE] = KEY_SPACE; virtKeyToVlcKey[VK_SPACE] = ' ';
virtKeyToVlcKey[VK_ESCAPE] = KEY_ESC; virtKeyToVlcKey[VK_ESCAPE] = KEY_ESC;
virtKeyToVlcKey[VK_LEFT] = KEY_LEFT; virtKeyToVlcKey[VK_LEFT] = KEY_LEFT;
virtKeyToVlcKey[VK_RIGHT] = KEY_RIGHT; virtKeyToVlcKey[VK_RIGHT] = KEY_RIGHT;
......
...@@ -67,7 +67,6 @@ X11Loop::X11Loop( intf_thread_t *pIntf, X11Display &rDisplay ): ...@@ -67,7 +67,6 @@ X11Loop::X11Loop( intf_thread_t *pIntf, X11Display &rDisplay ):
keysymToVlcKey[XK_F11] = KEY_F11; keysymToVlcKey[XK_F11] = KEY_F11;
keysymToVlcKey[XK_F12] = KEY_F12; keysymToVlcKey[XK_F12] = KEY_F12;
keysymToVlcKey[XK_Return] = KEY_ENTER; keysymToVlcKey[XK_Return] = KEY_ENTER;
keysymToVlcKey[XK_space] = KEY_SPACE;
keysymToVlcKey[XK_Escape] = KEY_ESC; keysymToVlcKey[XK_Escape] = KEY_ESC;
keysymToVlcKey[XK_Left] = KEY_LEFT; keysymToVlcKey[XK_Left] = KEY_LEFT;
keysymToVlcKey[XK_Right] = KEY_RIGHT; keysymToVlcKey[XK_Right] = KEY_RIGHT;
......
...@@ -306,9 +306,6 @@ static void Manage(vout_display_t *vd) ...@@ -306,9 +306,6 @@ static void Manage(vout_display_t *vd)
case AA_ESC: case AA_ESC:
vout_display_SendEventKey(vd, KEY_ESC); vout_display_SendEventKey(vd, KEY_ESC);
break; break;
case 0x20:
vout_display_SendEventKey(vd, KEY_SPACE);
break;
default: default:
if (event >= 0x20 && event <= 0x7f) if (event >= 0x20 && event <= 0x7f)
vout_display_SendEventKey(vd, event); vout_display_SendEventKey(vd, event);
......
...@@ -436,8 +436,6 @@ static const struct { ...@@ -436,8 +436,6 @@ static const struct {
{ CACA_KEY_PAGEUP, KEY_PAGEUP }, { CACA_KEY_PAGEUP, KEY_PAGEUP },
{ CACA_KEY_PAGEDOWN,KEY_PAGEDOWN }, { CACA_KEY_PAGEDOWN,KEY_PAGEDOWN },
{ ' ', KEY_SPACE },
/* */ /* */
{ -1, -1 } { -1, -1 }
}; };
......
...@@ -861,7 +861,7 @@ static struct ...@@ -861,7 +861,7 @@ static struct
{ VK_F12, KEY_F12 }, { VK_F12, KEY_F12 },
{ VK_RETURN, KEY_ENTER }, { VK_RETURN, KEY_ENTER },
{ VK_SPACE, KEY_SPACE }, { VK_SPACE, ' ' },
{ VK_ESCAPE, KEY_ESC }, { VK_ESCAPE, KEY_ESC },
{ VK_LEFT, KEY_LEFT }, { VK_LEFT, KEY_LEFT },
......
...@@ -684,7 +684,7 @@ static const struct { ...@@ -684,7 +684,7 @@ static const struct {
{ SDLK_RETURN, KEY_ENTER }, { SDLK_RETURN, KEY_ENTER },
{ SDLK_KP_ENTER, KEY_ENTER }, { SDLK_KP_ENTER, KEY_ENTER },
{ SDLK_SPACE, KEY_SPACE }, { SDLK_SPACE, ' ' },
{ SDLK_ESCAPE, KEY_ESC }, { SDLK_ESCAPE, KEY_ESC },
{ SDLK_MENU, KEY_MENU }, { SDLK_MENU, KEY_MENU },
......
...@@ -105,7 +105,7 @@ static int ConvertKeySym (xcb_keysym_t sym) ...@@ -105,7 +105,7 @@ static int ConvertKeySym (xcb_keysym_t sym)
{ XK_Begin, KEY_HOME, }, { XK_Begin, KEY_HOME, },
{ XK_Insert, KEY_INSERT, }, { XK_Insert, KEY_INSERT, },
{ XK_Menu, KEY_MENU }, { XK_Menu, KEY_MENU },
{ XK_KP_Space, KEY_SPACE, }, { XK_KP_Space, ' ', },
{ XK_KP_Tab, KEY_TAB, }, { XK_KP_Tab, KEY_TAB, },
{ XK_KP_Enter, KEY_ENTER, }, { XK_KP_Enter, KEY_ENTER, },
{ XK_KP_F1, KEY_F1, }, { XK_KP_F1, KEY_F1, },
...@@ -156,10 +156,7 @@ static int ConvertKeySym (xcb_keysym_t sym) ...@@ -156,10 +156,7 @@ static int ConvertKeySym (xcb_keysym_t sym)
{ XF86XK_Reload, KEY_BROWSER_REFRESH, }, { XF86XK_Reload, KEY_BROWSER_REFRESH, },
}; };
/* X11 and VLC both use the ASCII code for printable ASCII characters, /* X11 and VLC both use the ASCII code for printable ASCII characters. */
* except for space (only X11). */
if (sym == XK_space)
return KEY_SPACE;
if (isascii(sym)) if (isascii(sym))
return sym; return sym;
......
...@@ -2298,7 +2298,7 @@ vlc_module_begin () ...@@ -2298,7 +2298,7 @@ vlc_module_begin ()
*/ */
# define KEY_TOGGLE_FULLSCREEN 'f' # define KEY_TOGGLE_FULLSCREEN 'f'
# define KEY_LEAVE_FULLSCREEN KEY_ESC # define KEY_LEAVE_FULLSCREEN KEY_ESC
# define KEY_PLAY_PAUSE KEY_SPACE # define KEY_PLAY_PAUSE ' '
# define KEY_PAUSE KEY_UNSET # define KEY_PAUSE KEY_UNSET
# define KEY_PLAY KEY_UNSET # define KEY_PLAY KEY_UNSET
# define KEY_FASTER '+' # define KEY_FASTER '+'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment