x11: ignore mouse enter/leave events due to pointer grab

If you click on a window that doesn't have a focus, a LeaveNotify
followed by a EnterNotify event can be generated. The former will have
mode set to NotifyGrab, the latter to NotifyUngrab. This will make the
player think the mouse left the window, even though this is not the
case. Ignore these and only react to those with mode set to
NotifyNormal.

Probably fixes #1672, and some other strange issues on some WMs.
This commit is contained in:
wm4 2015-03-11 11:52:13 +01:00
parent ca0b33e9b1
commit 30860f7b10
1 changed files with 4 additions and 0 deletions

View File

@ -931,10 +931,14 @@ int vo_x11_check_events(struct vo *vo)
x11->win_drag_button1_down = false; x11->win_drag_button1_down = false;
break; break;
case LeaveNotify: case LeaveNotify:
if (Event.xcrossing.mode != NotifyNormal)
break;
x11->win_drag_button1_down = false; x11->win_drag_button1_down = false;
mp_input_put_key(vo->input_ctx, MP_KEY_MOUSE_LEAVE); mp_input_put_key(vo->input_ctx, MP_KEY_MOUSE_LEAVE);
break; break;
case EnterNotify: case EnterNotify:
if (Event.xcrossing.mode != NotifyNormal)
break;
mp_input_put_key(vo->input_ctx, MP_KEY_MOUSE_ENTER); mp_input_put_key(vo->input_ctx, MP_KEY_MOUSE_ENTER);
break; break;
case ButtonPress: case ButtonPress: