[Mplayer-cvslog] CVS: main/libvo vo_gl.c,1.27,1.28 vo_gl2.c,1.20,1.21 vo_x11.c,1.114,1.115 vo_xmga.c,1.74,1.75 vo_xv.c,1.111,1.112 vo_xvidix.c,1.49,1.50 x11_common.c,1.93,1.94 x11_common.h,1.25,1.26
Arpi of Ize
arpi at mplayerhq.hu
Fri Aug 9 19:43:52 CEST 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv15478
Modified Files:
vo_gl.c vo_gl2.c vo_x11.c vo_xmga.c vo_xv.c vo_xvidix.c
x11_common.c x11_common.h
Log Message:
ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
patch Kazunori Ueno <jagarl at creator.club.ne.jp>
Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- vo_gl.c 27 May 2002 17:47:10 -0000 1.27
+++ vo_gl.c 9 Aug 2002 17:43:49 -0000 1.28
@@ -204,7 +204,7 @@
// bpp = myximage->bits_per_pixel;
//XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
- XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
+ vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
#ifdef HAVE_NEW_INPUT
| ButtonPressMask | ButtonReleaseMask
#endif
Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- vo_gl2.c 27 May 2002 17:48:54 -0000 1.20
+++ vo_gl2.c 9 Aug 2002 17:43:49 -0000 1.21
@@ -708,7 +708,7 @@
XSync(mDisplay, False);
//XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
- XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
+ vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
#ifdef HAVE_NEW_INPUT
| ButtonPressMask | ButtonReleaseMask
#endif
Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- vo_x11.c 31 Jul 2002 19:40:33 -0000 1.114
+++ vo_x11.c 9 Aug 2002 17:43:49 -0000 1.115
@@ -332,7 +332,7 @@
{
XUnmapWindow( mDisplay,vo_window );
XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
- XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+ vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
XMapWindow( mDisplay,vo_window );
} else XSelectInput( mDisplay,vo_window,ExposureMask );
}
@@ -362,7 +362,7 @@
XSync( mDisplay,False );
// we cannot grab mouse events on root window :(
- XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | ExposureMask |
+ vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | ExposureMask |
((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)) );
#ifdef HAVE_XF86VM
Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- vo_xmga.c 19 Jul 2002 20:51:47 -0000 1.74
+++ vo_xmga.c 9 Aug 2002 17:43:49 -0000 1.75
@@ -293,7 +293,7 @@
{
XUnmapWindow( mDisplay,vo_window );
XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
- XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+ vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
} else XSelectInput( mDisplay,vo_window,ExposureMask );
} else
Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- vo_xv.c 25 Jul 2002 20:23:18 -0000 1.111
+++ vo_xv.c 9 Aug 2002 17:43:49 -0000 1.112
@@ -383,7 +383,7 @@
{
XUnmapWindow( mDisplay,vo_window );
XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
- XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+ vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
XMapWindow( mDisplay,vo_window );
} else { drwX=vo_dx; drwY=vo_dy; }
} else
@@ -395,7 +395,7 @@
vo_x11_classhint( mDisplay,vo_window,"xv" );
vo_hidecursor(mDisplay,vo_window);
- XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask |
+ vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask |
((WinID==0) ? 0 : (PointerMotionMask
#ifdef HAVE_NEW_INPUT
| ButtonPressMask | ButtonReleaseMask
Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- vo_xvidix.c 30 Jul 2002 16:40:42 -0000 1.49
+++ vo_xvidix.c 9 Aug 2002 17:43:49 -0000 1.50
@@ -292,7 +292,7 @@
{
XUnmapWindow(mDisplay, vo_window);
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
- XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
+ vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
} else XSelectInput( mDisplay,vo_window,ExposureMask );
}
else
Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- x11_common.c 12 Jun 2002 22:57:58 -0000 1.93
+++ x11_common.c 9 Aug 2002 17:43:49 -0000 1.94
@@ -840,7 +840,35 @@
// turning off screensaver
}
+static XErrorHandler old_handler = NULL;
+static int selectinput_err = 0;
+static int x11_selectinput_errorhandler(Display *display, XErrorEvent *event)
+{
+ if (event->error_code == BadAccess) {
+ selectinput_err = 1;
+ mp_msg(MSGT_VO, MSGL_ERR, "X11 error : BadAccess during XSelectInput Call\n");
+ mp_msg(MSGT_VO, MSGL_ERR, "X11 error : The 'ButtonPressMask' mask of specified window has probably already used by another appication(see man XSelectInput) \n");
+ /* If you think mplayer should shutdown with this error, comments out following line */
+ return 0;
+ }
+ if (old_handler != NULL) old_handler(display, event);
+ else x11_errorhandler(display, event);
+ return 0;
+}
+void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask)
+{
+ XSync(display, False);
+ old_handler = XSetErrorHandler(x11_selectinput_errorhandler);
+ selectinput_err = 0;
+ XSelectInput(display, w, event_mask);
+ XSync(display, False);
+ XSetErrorHandler(old_handler);
+ if (selectinput_err) {
+ mp_msg(MSGT_VO, MSGL_ERR, "X11 error : Mplayer discards mouse control and retry XSelectInput...\n");
+ XSelectInput(display, w, event_mask & (~(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)) );
+ }
+}
#ifdef HAVE_XINERAMA
void vo_x11_xinerama_move(Display *dsp, Window w)
Index: x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- x11_common.h 13 Jun 2002 00:26:17 -0000 1.25
+++ x11_common.h 9 Aug 2002 17:43:49 -0000 1.26
@@ -33,6 +33,7 @@
extern void vo_x11_classhint( Display * display,Window window,char *name );
extern void vo_x11_sizehint( int x, int y, int width, int height, int max );
extern int vo_x11_check_events(Display *mydisplay);
+extern void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask);
extern void vo_x11_fullscreen( void );
extern void vo_x11_uninit();
More information about the MPlayer-cvslog
mailing list