summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorRichard Hult <richard@imendio.com>2007-06-06 16:23:50 +0000
committerRichard Hult <rhult@src.gnome.org>2007-06-06 16:23:50 +0000
commited8d0fc69161066c0266b5bc8a5d58ae99a14745 (patch)
treee2081a8cfe33d60dc4911d526bb31459cd8070b0 /gdk
parentf74c473299b360cfa181ee57fca733679787974a (diff)
downloadgtk+-ed8d0fc69161066c0266b5bc8a5d58ae99a14745.tar.gz
Don't do anything if the two windows are the same.
2007-06-06 Richard Hult <richard@imendio.com> * gdk/quartz/gdkevents-quartz.c (get_converted_window_coordinates): Don't do anything if the two windows are the same. (find_window_for_ns_event): Translate coordinates to be relative the grab window when appropriate. svn path=/trunk/; revision=18064
Diffstat (limited to 'gdk')
-rw-r--r--gdk/quartz/gdkevents-quartz.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index ae58307b79..8d0e9439ee 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -905,6 +905,13 @@ get_converted_window_coordinates (GdkWindow *in_window,
int in_origin_x, in_origin_y;
int out_origin_x, out_origin_y;
+ if (in_window == out_window)
+ {
+ *out_x = in_x;
+ *out_y = in_y;
+ return;
+ }
+
/* First translate to "in" toplevel coordinates, then on to "out"
* toplevel coordinates, and finally to "out" child (the passed in
* window) coordinates.
@@ -1077,26 +1084,29 @@ find_window_for_ns_event (NSEvent *nsevent,
return real_window;
}
- /* FIXME: This part needs some fixing, it doesn't return
- * the right coordinates if the nsevent happens for a
- * different window than the grab window.
- */
+ /* Finally check the grab window. */
if (pointer_grab_event_mask & get_event_mask_from_ns_event (nsevent))
{
+ GdkWindow *event_toplevel;
GdkWindow *grab_toplevel;
NSPoint point;
int x_tmp, y_tmp;
+ event_toplevel = [(GdkQuartzView *)[[nsevent window] contentView] gdkWindow];
grab_toplevel = gdk_window_get_toplevel (_gdk_quartz_pointer_grab_window);
point = [nsevent locationInWindow];
x_tmp = point.x;
y_tmp = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (grab_toplevel)->impl)->height - point.y;
- get_child_coordinates_from_ancestor (grab_toplevel,
- x_tmp, y_tmp,
- _gdk_quartz_pointer_grab_window,
- x, y);
+ /* Translate the coordinates so they are relative to
+ * the grab window instead of the event toplevel for
+ * the cases where they are not the same.
+ */
+ get_converted_window_coordinates (event_toplevel,
+ x_tmp, y_tmp,
+ _gdk_quartz_pointer_grab_window,
+ x, y);
return _gdk_quartz_pointer_grab_window;
}