summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-07
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--ChangeLog.pre-2-27
-rw-r--r--ChangeLog.pre-2-47
-rw-r--r--ChangeLog.pre-2-67
-rw-r--r--ChangeLog.pre-2-87
-rw-r--r--gdk/win32/gdkevents-win32.c73
8 files changed, 117 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b7ae50ec8..65bcafe4d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-01-09 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c: Implement better mouse
+ capturing. Do use SetCapture(). Thanks to jpe@archaeopteryx.com.
+ (find_window_for_pointer_event): New function.
+ (gdk_event_translate): Use it when handling mouse events.
+
2001-01-09 Alexander Larsson <alla@lysator.liu.se>
* configure.in:
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 4b7ae50ec8..65bcafe4d4 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,10 @@
+2001-01-09 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c: Implement better mouse
+ capturing. Do use SetCapture(). Thanks to jpe@archaeopteryx.com.
+ (find_window_for_pointer_event): New function.
+ (gdk_event_translate): Use it when handling mouse events.
+
2001-01-09 Alexander Larsson <alla@lysator.liu.se>
* configure.in:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 4b7ae50ec8..65bcafe4d4 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,10 @@
+2001-01-09 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c: Implement better mouse
+ capturing. Do use SetCapture(). Thanks to jpe@archaeopteryx.com.
+ (find_window_for_pointer_event): New function.
+ (gdk_event_translate): Use it when handling mouse events.
+
2001-01-09 Alexander Larsson <alla@lysator.liu.se>
* configure.in:
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 4b7ae50ec8..65bcafe4d4 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,10 @@
+2001-01-09 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c: Implement better mouse
+ capturing. Do use SetCapture(). Thanks to jpe@archaeopteryx.com.
+ (find_window_for_pointer_event): New function.
+ (gdk_event_translate): Use it when handling mouse events.
+
2001-01-09 Alexander Larsson <alla@lysator.liu.se>
* configure.in:
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 4b7ae50ec8..65bcafe4d4 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,10 @@
+2001-01-09 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c: Implement better mouse
+ capturing. Do use SetCapture(). Thanks to jpe@archaeopteryx.com.
+ (find_window_for_pointer_event): New function.
+ (gdk_event_translate): Use it when handling mouse events.
+
2001-01-09 Alexander Larsson <alla@lysator.liu.se>
* configure.in:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 4b7ae50ec8..65bcafe4d4 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,10 @@
+2001-01-09 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c: Implement better mouse
+ capturing. Do use SetCapture(). Thanks to jpe@archaeopteryx.com.
+ (find_window_for_pointer_event): New function.
+ (gdk_event_translate): Use it when handling mouse events.
+
2001-01-09 Alexander Larsson <alla@lysator.liu.se>
* configure.in:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 4b7ae50ec8..65bcafe4d4 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,10 @@
+2001-01-09 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c: Implement better mouse
+ capturing. Do use SetCapture(). Thanks to jpe@archaeopteryx.com.
+ (find_window_for_pointer_event): New function.
+ (gdk_event_translate): Use it when handling mouse events.
+
2001-01-09 Alexander Larsson <alla@lysator.liu.se>
* configure.in:
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index a5f48ad536..51bed8a097 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -36,6 +36,9 @@
*/
/* define USE_TRACKMOUSEEVENT */
+/* Do use SetCapture, it works now. Thanks to jpe@archaeopteryx.com */
+#define USE_SETCAPTURE 1
+
#include <stdio.h>
#include "gdkprivate-win32.h"
@@ -531,11 +534,8 @@ gdk_pointer_grab (GdkWindow *window,
p_grab_owner_events = (owner_events != 0);
p_grab_automatic = FALSE;
-#if 0 /* Menus don't work if we use mouse capture. Pity, because many other
- * things work better with mouse capture.
- */
+#if USE_SETCAPTURE
SetCapture (GDK_WINDOW_HWND (window));
-# pragma message("Warning: SetCapture call, menus won't work!")
#endif
return_val = GDK_GRAB_SUCCESS;
}
@@ -574,7 +574,7 @@ gdk_pointer_ungrab (guint32 time)
_gdk_input_ungrab_pointer (time);
-#if 1
+#if USE_SETCAPTURE
if (GetCapture () != NULL)
ReleaseCapture ();
#endif
@@ -584,6 +584,63 @@ gdk_pointer_ungrab (guint32 time)
/*
*--------------------------------------------------------------
+ * find_window_for_pointer_event
+ *
+ * Find the window a pointer event (mouse up, down, move) should
+ * be reported to. If the return value != reported_window then
+ * the ref count of reported_window will be decremented and the
+ * ref count of the return value will be incremented.
+ *
+ * Arguments:
+ *
+ * "reported_window" is the gdk window the xevent was reported relative to
+ * "xevent" is the win32 message
+ *
+ * Results:
+ *
+ * Side effects:
+ *
+ *--------------------------------------------------------------
+ */
+
+static GdkWindow*
+find_window_for_pointer_event (GdkWindow* reported_window,
+ MSG* xevent)
+{
+ HWND hwnd;
+ POINTS points;
+ POINT pt;
+ GdkWindow* other_window;
+
+ if (p_grab_window == NULL || !p_grab_owner_events)
+ return reported_window;
+
+ points = MAKEPOINTS(xevent->lParam);
+ pt.x = points.x;
+ pt.y = points.y;
+ ClientToScreen (xevent->hwnd, &pt);
+
+ GDK_NOTE (EVENTS, g_print ("Finding window for grabbed pointer event at (%ld, %ld)\n",
+ pt.x, pt.y));
+
+ hwnd = WindowFromPoint(pt);
+ if (hwnd == NULL)
+ return reported_window;
+ other_window = gdk_window_lookup(hwnd);
+ if (other_window == NULL)
+ return reported_window;
+
+ GDK_NOTE (EVENTS, g_print ("Found window %#x for point (%ld, %ld)\n",
+ (guint) hwnd, pt.x, pt.y));
+
+ gdk_window_unref(reported_window);
+ gdk_window_ref(other_window);
+
+ return other_window;
+}
+
+/*
+ *--------------------------------------------------------------
* gdk_pointer_is_grabbed
*
* Tell wether there is an active x pointer grab in effect
@@ -2017,6 +2074,8 @@ gdk_event_translate (GdkEvent *event,
break;
}
+ ASSIGN_WINDOW (find_window_for_pointer_event (window, msg));
+
if (window != current_window)
synthesize_crossing_events (window, msg);
@@ -2077,6 +2136,8 @@ gdk_event_translate (GdkEvent *event,
(gulong) msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
+ ASSIGN_WINDOW (find_window_for_pointer_event (window, msg));
+
if (GDK_WINDOW_OBJECT (window)->extension_events != 0
&& gdk_input_ignore_core)
{
@@ -2122,6 +2183,8 @@ gdk_event_translate (GdkEvent *event,
(gulong) msg->hwnd, msg->wParam,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
+ ASSIGN_WINDOW (find_window_for_pointer_event (window, msg));
+
/* If we haven't moved, don't create any event.
* Windows sends WM_MOUSEMOVE messages after button presses
* even if the mouse doesn't move. This disturbs gtk.