win32: Handle implicit grabs

This commit is contained in:
Alexander Larsson 2011-10-18 16:52:41 +02:00
parent 6668ba6914
commit f0f7c07f4d

View File

@ -1689,6 +1689,12 @@ ensure_stacking_on_activate_app (MSG *msg,
}
}
#define GDK_ANY_BUTTON_MASK (GDK_BUTTON1_MASK | \
GDK_BUTTON2_MASK | \
GDK_BUTTON3_MASK | \
GDK_BUTTON4_MASK | \
GDK_BUTTON5_MASK)
static gboolean
gdk_event_translate (MSG *msg,
gint *ret_valp)
@ -2101,7 +2107,11 @@ gdk_event_translate (MSG *msg,
if (GDK_WINDOW_DESTROYED (window))
break;
/* TODO_CSW? Emulate X11's automatic active grab */
if (pointer_grab == NULL)
{
SetCapture (GDK_WINDOW_HWND (window));
}
generate_button_event (GDK_BUTTON_PRESS, button,
window, msg);
@ -2141,6 +2151,15 @@ gdk_event_translate (MSG *msg,
}
#endif
if (pointer_grab != NULL && pointer_grab->implicit)
{
gint state = build_pointer_event_state (msg);
/* We keep the implicit grab until no buttons at all are held down */
if ((state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (button - 1))) == 0)
ReleaseCapture ();
}
generate_button_event (GDK_BUTTON_RELEASE, button,
window, msg);