summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-31 21:21:05 +0200
committerwm4 <wm4@nowhere>2013-09-01 20:17:51 +0200
commit0c7978cf9caa81d1e6ef7e32458a5ff1834fa004 (patch)
tree3378c6b2eea9c11485b18ac4593eec46eeccf7e7 /video/out/x11_common.c
parent11d2f723d50307d88f7f828d8c6ff389ef76bf33 (diff)
downloadmpv-0c7978cf9caa81d1e6ef7e32458a5ff1834fa004.tar.bz2
mpv-0c7978cf9caa81d1e6ef7e32458a5ff1834fa004.tar.xz
input: deal with spurious X11 LeaveNotify events
If the mpv window is unfocus, clicking on the OSC should focus the window (done by the window manager) and allow interaction with the OSC. But somehow X sends a spurious LeaveNotify event, immediately followed by an EnterNotify event. This happens at least with IceWM. The result is that the OSC will disappear (due to receiving MOUSE_LEAVE). The OSC will stay invisible, because EnterNotify isn't handled, and there's nothing that could make the OSC appear again. Solve this by handling EnterNotify. We cause a redundant MOUSE_MOVE event to be sent, which triggers the code to make the OSC visible. We have to remove the code from input.c, which ignores redundant mouse move events. Since the code ignoring redundant mouse move events is still needed on Windows, move that code to w32_common.c. The need for this is documented in the code, also see commit 03fd2fe. (The original idea was to save some code by having this code in the core, but now it turns out that this didn't quite work out.)
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 83bfe3946d..00c0f7625d 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -769,6 +769,9 @@ int vo_x11_check_events(struct vo *vo)
case MotionNotify:
vo_mouse_movement(vo, Event.xmotion.x, Event.xmotion.y);
break;
+ case EnterNotify:
+ vo_mouse_movement(vo, Event.xcrossing.x, Event.xcrossing.y);
+ break;
case LeaveNotify:
mp_input_put_key(vo->input_ctx, MP_KEY_MOUSE_LEAVE);
break;
@@ -1007,7 +1010,8 @@ static void vo_x11_map_window(struct vo *vo, int x, int y, int w, int h)
StructureNotifyMask | ExposureMask |
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask | LeaveWindowMask);
+ PointerMotionMask | EnterWindowMask |
+ LeaveWindowMask);
XMapWindow(x11->display, x11->window);
vo_x11_clearwindow(vo, x11->window);
}