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
This commit is contained in:
Carlos Garnacho 2011-07-27 00:26:18 +02:00 committed by Jasper St. Pierre
parent ae1290e3b4
commit b742d1bc64
2 changed files with 9 additions and 8 deletions

View File

@ -1736,10 +1736,9 @@ meta_frames_motion_notify_event (GtkWidget *widget,
case META_GRAB_OP_CLICKING_UNSTICK: case META_GRAB_OP_CLICKING_UNSTICK:
{ {
MetaFrameControl control; MetaFrameControl control;
int x, y; gdouble x, y;
gdk_window_get_device_position (frame->window, event->device, gdk_event_get_coords ((GdkEvent *) event, &x, &y);
&x, &y, NULL);
/* Control is set to none unless it matches /* Control is set to none unless it matches
* the current grab * the current grab
@ -1776,11 +1775,9 @@ meta_frames_motion_notify_event (GtkWidget *widget,
case META_GRAB_OP_NONE: case META_GRAB_OP_NONE:
{ {
MetaFrameControl control; MetaFrameControl control;
int x, y; gdouble x, y;
gdk_window_get_device_position (frame->window, event->device,
&x, &y, NULL);
gdk_event_get_coords ((GdkEvent *) event, &x, &y);
control = get_control (frames, frame, x, y); control = get_control (frames, frame, x, y);
/* Update prelit control and cursor */ /* Update prelit control and cursor */

View File

@ -210,6 +210,10 @@ maybe_redirect_mouse_event (XEvent *xevent)
gevent = gdk_event_new (GDK_MOTION_NOTIFY); gevent = gdk_event_new (GDK_MOTION_NOTIFY);
gevent->motion.type = GDK_MOTION_NOTIFY; gevent->motion.type = GDK_MOTION_NOTIFY;
gevent->motion.window = g_object_ref (gdk_window); 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; break;
case EnterNotify: case EnterNotify:
case LeaveNotify: case LeaveNotify: