diff options
author | Richard Hult <richard@imendio.com> | 2006-07-19 07:28:42 +0000 |
---|---|---|
committer | Richard Hult <rhult@src.gnome.org> | 2006-07-19 07:28:42 +0000 |
commit | 53b035482321d06f9bed5cc094a254ce9e2b27b8 (patch) | |
tree | 3c16f35fd8d3d913ae48681fd57bae7a590900e9 | |
parent | 4eb40b4278e56666a1f794ee75ac2428e5da2229 (diff) | |
download | gtk+-53b035482321d06f9bed5cc094a254ce9e2b27b8.tar.gz |
Get the position correctly for the root window. Fixes bug #347976, patch
2006-07-19 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c:
(_gdk_windowing_window_get_pointer): Get the position correctly
for the root window. Fixes bug #347976, patch by Dave Vasilevsky.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 6 | ||||
-rw-r--r-- | gdk/quartz/gdkwindow-quartz.c | 39 |
3 files changed, 36 insertions, 15 deletions
@@ -1,3 +1,9 @@ +2006-07-19 Richard Hult <richard@imendio.com> + + * gdk/quartz/gdkwindow-quartz.c: + (_gdk_windowing_window_get_pointer): Get the position correctly + for the root window. Fixes bug #347976, patch by Dave Vasilevsky. + 2006-07-18 Matthias Clasen <mclasen@redhat.com> * NEWS: Updates diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e04082051a..7b832ebfda 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2006-07-19 Richard Hult <richard@imendio.com> + + * gdk/quartz/gdkwindow-quartz.c: + (_gdk_windowing_window_get_pointer): Get the position correctly + for the root window. Fixes bug #347976, patch by Dave Vasilevsky. + 2006-07-18 Matthias Clasen <mclasen@redhat.com> * NEWS: Updates diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 948d84af1a..2114f3987b 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -974,27 +974,36 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display, GdkWindow *toplevel = gdk_window_get_toplevel (window); GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl); GdkWindowObject *private = GDK_WINDOW_OBJECT (window); - NSWindow *nswindow = impl->toplevel; - NSPoint point = [nswindow mouseLocationOutsideOfEventStream]; + NSPoint point; int x_tmp, y_tmp; - /* FIXME: Might need to special-case window being the root window. */ - - /* First flip the y coordinate */ + /* Must flip the y coordinate. */ + if (window == _gdk_root) + { + point = [NSEvent mouseLocation]; + y_tmp = _gdk_quartz_get_inverted_screen_y (point.y); + } + else + { + NSWindow *nswindow = impl->toplevel; + point = [nswindow mouseLocationOutsideOfEventStream]; + y_tmp = impl->height - point.y; + } x_tmp = point.x; - y_tmp = impl->height - point.y; - while (private != GDK_WINDOW_OBJECT (toplevel)) { - x_tmp -= private->x; - y_tmp -= private->y; + while (private != GDK_WINDOW_OBJECT (toplevel)) + { + x_tmp -= private->x; + y_tmp -= private->y; - private = private->parent; - } + private = private->parent; + } - if (x) - *x = x_tmp; - if (y) - *y = y_tmp; + *x = x_tmp; + *y = y_tmp; + + /* FIXME: Implement mask. */ + *mask = 0; /* FIXME: Implement return value */ return NULL; |