From 1e159f4eccc9e8bbdbd5c01043cbd5c5d48485b3 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 1 Jul 2010 19:48:00 +0000 Subject: [PATCH] x11_common: Do not try to grab input from -wid windows It will most likely break their input processing. If someone needs the previous behaviour, an option could be added (and also used in the w32_common.c code). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31601 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix resizing with -wid after previous commit. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31604 b3059339-0415-0410-9bf9-f77b7e298cf2 Always request expose events, we have to handle them, the application that created the -wid window can't. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31605 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/x11_common.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 9c15c922d7..c6e8c9dbf0 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -763,6 +763,15 @@ void vo_x11_uninit(struct vo *vo) } } +static int check_resize(struct vo *vo) +{ + int old_w = vo->dwidth, old_h = vo->dheight; + vo_x11_update_geometry(vo); + if (vo->dwidth != old_w || vo->dheight != old_h) + return VO_EVENT_RESIZE; + return 0; +} + int vo_x11_check_events(struct vo *vo) { struct vo_x11_state *x11 = vo->x11; @@ -780,6 +789,8 @@ int vo_x11_check_events(struct vo *vo) x11->mouse_waiting_hide = 0; } + if (WinID > 0) + ret |= check_resize(vo); while (XPending(display)) { XNextEvent(display, &Event); @@ -792,12 +803,7 @@ int vo_x11_check_events(struct vo *vo) case ConfigureNotify: if (x11->window == None) break; - { - int old_w = vo->dwidth, old_h = vo->dheight; - vo_x11_update_geometry(vo); - if (vo->dwidth != old_w || vo->dheight != old_h) - ret |= VO_EVENT_RESIZE; - } + ret |= check_resize(vo); break; case KeyPress: { @@ -1044,8 +1050,15 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, XChangeWindowAttributes(mDisplay, x11->window, xswamask, &xswa); XInstallColormap(mDisplay, col_map); } - if (WinID) vo_x11_update_geometry(vo); - vo_x11_selectinput_witherr(mDisplay, x11->window, + if (WinID) { + vo_x11_update_geometry(vo); + // Expose events can only really be handled by us, so request them. + vo_x11_selectinput_witherr(mDisplay, x11->window, ExposureMask); + } else + // Do not capture events since it might break the parent application + // if it relies on events being forwarded to the parent of WinID. + // It also is consistent with the w32_common.c code. + vo_x11_selectinput_witherr(mDisplay, x11->window, StructureNotifyMask | KeyPressMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask); goto final;