[vlc-commits] vout:win32: don't handle the keyboard messages in the display modules

Steve Lhomme git at videolan.org
Thu Apr 4 12:30:52 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Apr  4 09:48:59 2019 +0200| [10505a81cd6f40feb8864684dddc6f3ad62f3ccd] | committer: Steve Lhomme

vout:win32: don't handle the keyboard messages in the display modules

It's handled properly in the vout_window_t (embedded and non-embedded).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10505a81cd6f40feb8864684dddc6f3ad62f3ccd
---

 modules/video_output/win32/events.c | 116 +-----------------------------------
 1 file changed, 1 insertion(+), 115 deletions(-)

diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 7664e4ebe1..1360cc41cb 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -90,7 +90,6 @@ struct event_thread_t
 static int  Win32VoutCreateWindow( event_thread_t * );
 static void Win32VoutCloseWindow ( event_thread_t * );
 static long FAR PASCAL WinVoutEventProc( HWND, UINT, WPARAM, LPARAM );
-static int  Win32VoutConvertKey( int i_key );
 
 /* Display/Hide Cursor */
 static void UpdateCursor( event_thread_t *p_event, bool b_show );
@@ -125,11 +124,6 @@ static inline bool isMouseEvent( WPARAM type )
            type <= WM_MOUSELAST;
 }
 
-static inline bool isKeyEvent( WPARAM type )
-{
-    return type >= WM_KEYFIRST &&
-           type <= WM_KEYLAST;
-}
 /*****************************************************************************
  * EventThread: Create video window & handle its messages
  *****************************************************************************
@@ -146,7 +140,6 @@ static void *EventThread( void *p_this )
     int canc = vlc_savecancel ();
 
     bool b_mouse_support = var_InheritBool( p_event->obj, "mouse-events" );
-    bool b_key_support = var_InheritBool( p_event->obj, "keyboard-events" );
 
     vlc_mutex_lock( &p_event->lock );
     /* Create a window for the video */
@@ -179,9 +172,6 @@ static void *EventThread( void *p_this )
         if( !b_mouse_support && isMouseEvent( msg.message ) )
             continue;
 
-        if( !b_key_support && isKeyEvent( msg.message ) )
-            continue;
-
         /* Handle mouse state */
         if( msg.message == WM_MOUSEMOVE || msg.message == WM_NCMOUSEMOVE )
         {
@@ -251,38 +241,6 @@ static void *EventThread( void *p_this )
             vout_window_ReportMouseDoubleClick(p_event->parent_window, MOUSE_BUTTON_RIGHT);
             break;
 
-        case WM_KEYDOWN:
-        case WM_SYSKEYDOWN:
-        {
-            /* The key events are first processed here and not translated
-             * into WM_CHAR events because we need to know the status of the
-             * modifier keys. */
-            int i_key = Win32VoutConvertKey( msg.wParam );
-            if( !i_key )
-            {
-                /* This appears to be a "normal" (ascii) key */
-                i_key = tolower( (unsigned char)MapVirtualKey( msg.wParam, 2 ) );
-            }
-
-            if( i_key )
-            {
-                if( GetKeyState(VK_CONTROL) & 0x8000 )
-                {
-                    i_key |= KEY_MODIFIER_CTRL;
-                }
-                if( GetKeyState(VK_SHIFT) & 0x8000 )
-                {
-                    i_key |= KEY_MODIFIER_SHIFT;
-                }
-                if( GetKeyState(VK_MENU) & 0x8000 )
-                {
-                    i_key |= KEY_MODIFIER_ALT;
-                }
-
-                vout_window_ReportKeyPress(p_event->parent_window, i_key);
-            }
-            break;
-        }
 
         case WM_MOUSEWHEEL:
         {
@@ -624,8 +582,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
 
     /* allow user to regain control over input events if requested */
     bool b_mouse_support = var_InheritBool( p_event->obj, "mouse-events" );
-    bool b_key_support = var_InheritBool( p_event->obj, "keyboard-events" );
-    if( !b_mouse_support && !b_key_support )
+    if( !b_mouse_support )
         i_style |= WS_DISABLED;
 
     /* Create the window */
@@ -744,12 +701,6 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message,
         PostQuitMessage( 0 );
         return 0;
 
-    case WM_KILLFOCUS:
-        return 0;
-
-    case WM_SETFOCUS:
-        return 0;
-
     case WM_GESTURE:
         return DecodeGesture( p_event->obj, p_event->p_gesture, hwnd, message, wParam, lParam );
 
@@ -760,68 +711,3 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message,
     /* Let windows handle the message */
     return DefWindowProc(hwnd, message, wParam, lParam);
 }
-
-static struct
-{
-    int i_dxkey;
-    int i_vlckey;
-
-} dxkeys_to_vlckeys[] =
-{
-    { VK_F1, KEY_F1 }, { VK_F2, KEY_F2 }, { VK_F3, KEY_F3 }, { VK_F4, KEY_F4 },
-    { VK_F5, KEY_F5 }, { VK_F6, KEY_F6 }, { VK_F7, KEY_F7 }, { VK_F8, KEY_F8 },
-    { VK_F9, KEY_F9 }, { VK_F10, KEY_F10 }, { VK_F11, KEY_F11 },
-    { VK_F12, KEY_F12 },
-
-    { VK_RETURN, KEY_ENTER },
-    { VK_SPACE, ' ' },
-    { VK_ESCAPE, KEY_ESC },
-
-    { VK_LEFT, KEY_LEFT },
-    { VK_RIGHT, KEY_RIGHT },
-    { VK_UP, KEY_UP },
-    { VK_DOWN, KEY_DOWN },
-
-    { VK_HOME, KEY_HOME },
-    { VK_END, KEY_END },
-    { VK_PRIOR, KEY_PAGEUP },
-    { VK_NEXT, KEY_PAGEDOWN },
-
-    { VK_INSERT, KEY_INSERT },
-    { VK_DELETE, KEY_DELETE },
-
-    { VK_CONTROL, 0 },
-    { VK_SHIFT, 0 },
-    { VK_MENU, 0 },
-
-    { VK_BROWSER_BACK, KEY_BROWSER_BACK },
-    { VK_BROWSER_FORWARD, KEY_BROWSER_FORWARD },
-    { VK_BROWSER_REFRESH, KEY_BROWSER_REFRESH },
-    { VK_BROWSER_STOP, KEY_BROWSER_STOP },
-    { VK_BROWSER_SEARCH, KEY_BROWSER_SEARCH },
-    { VK_BROWSER_FAVORITES, KEY_BROWSER_FAVORITES },
-    { VK_BROWSER_HOME, KEY_BROWSER_HOME },
-    { VK_VOLUME_MUTE, KEY_VOLUME_MUTE },
-    { VK_VOLUME_DOWN, KEY_VOLUME_DOWN },
-    { VK_VOLUME_UP, KEY_VOLUME_UP },
-    { VK_MEDIA_NEXT_TRACK, KEY_MEDIA_NEXT_TRACK },
-    { VK_MEDIA_PREV_TRACK, KEY_MEDIA_PREV_TRACK },
-    { VK_MEDIA_STOP, KEY_MEDIA_STOP },
-    { VK_MEDIA_PLAY_PAUSE, KEY_MEDIA_PLAY_PAUSE },
-
-    { 0, 0 }
-};
-
-static int Win32VoutConvertKey( int i_key )
-{
-    for( int i = 0; dxkeys_to_vlckeys[i].i_dxkey != 0; i++ )
-    {
-        if( dxkeys_to_vlckeys[i].i_dxkey == i_key )
-        {
-            return dxkeys_to_vlckeys[i].i_vlckey;
-        }
-    }
-
-    return 0;
-}
-



More information about the vlc-commits mailing list