* modules/video_output/x11/xcommon.c: Select events in the video subwindow
authorSam Hocevar <sam@videolan.org>
Wed, 16 Jul 2003 15:25:32 +0000 (15:25 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 16 Jul 2003 15:25:32 +0000 (15:25 +0000)
    instead of the base window, because newer versions of Mozilla select
    ButtonPress for the window it gives us, and XSelectInput only allows
    one client to select this event.

modules/video_output/x11/xcommon.c

index 5e6a66b..5bd6f1e 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.21 2003/06/24 22:26:01 asmax Exp $
+ * $Id: xcommon.c,v 1.22 2003/07/16 15:25:32 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -492,10 +492,12 @@ static int ManageVideo( vout_thread_t *p_vout )
 
     while( XCheckWindowEvent( p_vout->p_sys->p_display,
                               p_vout->p_sys->p_win->base_window,
-                              StructureNotifyMask | KeyPressMask |
+                              StructureNotifyMask, &xevent ) == True
+        || XCheckWindowEvent( p_vout->p_sys->p_display,
+                              p_vout->p_sys->p_win->video_window,
+                              KeyPressMask | PointerMotionMask |
                               ButtonPressMask | ButtonReleaseMask |
-                              PointerMotionMask | Button1MotionMask , &xevent )
-           == True )
+                              Button1MotionMask, &xevent ) == True )
     {
         /* ConfigureNotify event: prepare  */
         if( xevent.type == ConfigureNotify )
@@ -1033,10 +1035,12 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
                       &dummy2, &dummy3 );
     }
 
+    /* We cannot put ButtonPressMask in the list, because according to
+     * the XSelectInput manpage, only one client at a time can select a
+     * ButtonPress event. Programs such as Mozilla may be already selecting
+     * this event. */
     XSelectInput( p_vout->p_sys->p_display, p_win->base_window,
-                  StructureNotifyMask | KeyPressMask |
-                  ButtonPressMask | ButtonReleaseMask |
-                  PointerMotionMask );
+                  StructureNotifyMask );
 
 #ifdef MODULE_NAME_IS_x11
     if( p_win->b_owned &&
@@ -1073,7 +1077,8 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
 
     XMapWindow( p_vout->p_sys->p_display, p_win->video_window );
     XSelectInput( p_vout->p_sys->p_display, p_win->video_window,
-                  ExposureMask );
+                  ExposureMask | KeyPressMask | ButtonPressMask |
+                  ButtonReleaseMask | PointerMotionMask );
 
     /* make sure the video window will be centered in the next ManageVideo() */
     p_vout->i_changes |= VOUT_SIZE_CHANGE;