From d05297593fbbe13bcf08807cb22b260f7954110f Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 27 Jul 2011 00:26:18 +0200 Subject: [PATCH] frames: Get coordinates from event Don't spare a synchronous X call, instead translate properly the XEvent coordinates in ui.c and use the event coordinates in MetaFrames --- src/ui/frames.c | 11 +++++------ src/ui/ui.c | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ui/frames.c b/src/ui/frames.c index 079fbda5f..f3d637359 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -2121,9 +2121,9 @@ meta_frames_motion_notify_event (GtkWidget *widget, case META_GRAB_OP_CLICKING_UNSTICK: { MetaFrameControl control; - int x, y; - - gdk_window_get_pointer (frame->window, &x, &y, NULL); + gdouble x, y; + + gdk_event_get_coords ((GdkEvent *) event, &x, &y); /* Control is set to none unless it matches * the current grab @@ -2162,10 +2162,9 @@ meta_frames_motion_notify_event (GtkWidget *widget, case META_GRAB_OP_NONE: { MetaFrameControl control; - int x, y; - - gdk_window_get_pointer (frame->window, &x, &y, NULL); + gdouble x, y; + gdk_event_get_coords ((GdkEvent *) event, &x, &y); control = get_control (frames, frame, x, y); /* Update prelit control and cursor */ diff --git a/src/ui/ui.c b/src/ui/ui.c index 64a39b25b..335617736 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -204,6 +204,10 @@ maybe_redirect_mouse_event (XEvent *xevent) gevent = gdk_event_new (GDK_MOTION_NOTIFY); gevent->motion.type = GDK_MOTION_NOTIFY; gevent->motion.window = g_object_ref (gdk_window); + gevent->motion.x = x; + gevent->motion.y = y; + gevent->motion.x_root = x_root; + gevent->motion.y_root = y_root; break; case EnterNotify: case LeaveNotify: