[gtk+/gtk-2-24] quartz: Factor out toplevel from NSEvent code into function
- From: Kristian Rietveld <kristian src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] quartz: Factor out toplevel from NSEvent code into function
- Date: Sun, 6 Nov 2011 08:38:41 +0000 (UTC)
commit d0e5025694697c5f3394c2e94a58b343a13dc8c6
Author: Kristian Rietveld <kris lanedo com>
Date: Sat Nov 5 22:53:22 2011 +0100
quartz: Factor out toplevel from NSEvent code into function
gdk/quartz/gdkevents-quartz.c | 37 ++++++++++++++++++++++++++-----------
1 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 1d58d0e..75ad808 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -373,6 +373,31 @@ get_window_point_from_screen_point (GdkWindow *window,
*y = private->height - point.y;
}
+static GdkWindow *
+get_toplevel_from_ns_event (NSEvent *nsevent,
+ NSPoint *screen_point,
+ gint *x,
+ gint *y)
+{
+ GdkQuartzView *view;
+ GdkWindow *toplevel;
+ GdkWindowObject *private;
+ NSPoint point;
+
+ view = (GdkQuartzView *)[[nsevent window] contentView];
+
+ toplevel = [view gdkWindow];
+ private = GDK_WINDOW_OBJECT (toplevel);
+
+ point = [nsevent locationInWindow];
+ *screen_point = [[nsevent window] convertBaseToScreen:point];
+
+ *x = point.x;
+ *y = private->height - point.y;
+
+ return toplevel;
+}
+
static GdkEvent *
create_focus_event (GdkWindow *window,
gboolean in)
@@ -540,22 +565,12 @@ find_window_for_ns_event (NSEvent *nsevent,
{
GdkQuartzView *view;
GdkWindow *toplevel;
- GdkWindowObject *private;
- NSPoint point;
NSPoint screen_point;
NSEventType event_type;
view = (GdkQuartzView *)[[nsevent window] contentView];
- toplevel = [view gdkWindow];
- private = GDK_WINDOW_OBJECT (toplevel);
-
- point = [nsevent locationInWindow];
- screen_point = [[nsevent window] convertBaseToScreen:point];
-
- *x = point.x;
- *y = private->height - point.y;
-
+ toplevel = get_toplevel_from_ns_event (nsevent, &screen_point, x, y);
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, x_root, y_root);
event_type = [nsevent type];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]