[mutter/wip/multitouch: 54/73] frames: Get coordinates from event
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/multitouch: 54/73] frames: Get coordinates from event
- Date: Mon, 31 Oct 2011 00:21:15 +0000 (UTC)
commit f46ef5f6e0e10943c397952ef62f0b223ce04494
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jul 27 00:26:18 2011 +0200
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 | 13 +++++--------
src/ui/ui.c | 4 ++++
2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 66bd38e..e7247bf 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -1998,10 +1998,9 @@ meta_frames_motion_notify_event (GtkWidget *widget,
case META_GRAB_OP_CLICKING_UNSTICK:
{
MetaFrameControl control;
- int x, y;
-
- gdk_window_get_device_position (frame->window, event->device,
- &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
@@ -2040,11 +2039,9 @@ meta_frames_motion_notify_event (GtkWidget *widget,
case META_GRAB_OP_NONE:
{
MetaFrameControl control;
- int x, y;
-
- gdk_window_get_device_position (frame->window, event->device,
- &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 be053ab..eb6e318 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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]