]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/events.c
XCB/XVideo: add debug message in case of problem with visuals
[vlc] / modules / video_output / msw / events.c
index f93a9210ec1294c55ba50a0ac0e8f3ca497032d8..1945b129c00296b3880758a5e22d1dfa3c9612b0 100644 (file)
@@ -60,6 +60,9 @@
 UINT GetMenuState(HMENU hMenu, UINT id, UINT flags)
 {
     MENUITEMINFO info;
+    memset(&info, 0, sizeof(info));
+    info.cbSize = sizeof(info);
+    info.fMask = MIIM_STATE;
     if (!GetMenuItemInfo(hMenu, id, (flags & MF_BYPOSITION) != 0, &info))
         return -1;
     /* XXX Submenu handling is missing... */
@@ -126,6 +129,18 @@ static long FAR PASCAL DirectXEventProc( HWND, UINT, WPARAM, LPARAM );
 
 static int DirectXConvertKey( int i_key );
 
+static inline bool isMouseEvent( WPARAM type )
+{
+    return type >= WM_MOUSEFIRST &&
+           type <= WM_MOUSELAST;
+}
+
+static inline bool isKeyEvent( WPARAM type )
+{
+    return type >= WM_KEYFIRST &&
+           type <= WM_KEYLAST;
+}
+
 /*****************************************************************************
  * EventThread: Create video window & handle its messages
  *****************************************************************************
@@ -143,6 +158,9 @@ static void *EventThread( void *p_this )
     HMODULE hkernel32;
     int canc = vlc_savecancel ();
 
+    bool b_mouse_support = var_InheritBool( p_event->vd, "mouse-events" );
+    bool b_key_support = var_InheritBool( p_event->vd, "keyboard-events" );
+
     vlc_mutex_lock( &p_event->lock );
     /* Create a window for the video */
     /* Creating a window under Windows also initializes the thread's event
@@ -201,6 +219,12 @@ static void *EventThread( void *p_this )
         if( b_done )
             break;
 
+        if( !b_mouse_support && isMouseEvent( msg.message ) )
+            continue;
+
+        if( !b_key_support && isKeyEvent( msg.message ) )
+            continue;
+
         /* */
         switch( msg.message )
         {
@@ -429,7 +453,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
         /* If an external window was specified, we'll draw in it. */
         p_event->parent_window = vout_display_NewWindow(vd, &p_event->wnd_cfg );
         if( p_event->parent_window )
-            p_event->hparent = p_event->parent_window->hwnd;
+            p_event->hparent = p_event->parent_window->handle.hwnd;
         else
             p_event->hparent = NULL;
     #ifdef MODULE_NAME_IS_direct3d
@@ -504,8 +528,8 @@ static int DirectXCreateWindow( event_thread_t *p_event )
      * have. Unfortunatly these dimensions will include the borders and
      * titlebar. We use the following function to find out the size of
      * the window corresponding to the useable surface we want */
-    rect_window.top    = 10;
     rect_window.left   = 10;
+    rect_window.top    = 10;
     rect_window.right  = rect_window.left + p_event->wnd_cfg.width;
     rect_window.bottom = rect_window.top  + p_event->wnd_cfg.height;
 
@@ -539,9 +563,9 @@ static int DirectXCreateWindow( event_thread_t *p_event )
                     _T("VLC DirectX"),               /* name of window class */
                     _T(VOUT_TITLE) _T(" (DirectX Output)"),  /* window title */
                     i_style,                                 /* window style */
-                    (p_event->wnd_cfg.x < 0) ? CW_USEDEFAULT :
+                    (!p_event->wnd_cfg.x) ? CW_USEDEFAULT :
                         (UINT)p_event->wnd_cfg.x,   /* default X coordinate */
-                    (p_event->wnd_cfg.y < 0) ? CW_USEDEFAULT :
+                    (!p_event->wnd_cfg.y) ? CW_USEDEFAULT :
                         (UINT)p_event->wnd_cfg.y,   /* default Y coordinate */
                     rect_window.right - rect_window.left,    /* window width */
                     rect_window.bottom - rect_window.top,   /* window height */