[gtk+] win32: Handle implicit grabs
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] win32: Handle implicit grabs
- Date: Thu, 10 Nov 2011 16:47:22 +0000 (UTC)
commit f0f7c07f4d5e47a7f63e51ce0d7539321a253ec7
Author: Alexander Larsson <alexl redhat com>
Date: Tue Oct 18 16:52:41 2011 +0200
win32: Handle implicit grabs
gdk/win32/gdkevents-win32.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index cc19f96..b33b176 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]