[mutter] pointer: Remove our own position tracking
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] pointer: Remove our own position tracking
- Date: Fri, 18 Apr 2014 16:27:05 +0000 (UTC)
commit 2748661f63857352fdf6b60e6105c2947dad8d68
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Apr 18 10:27:48 2014 -0400
pointer: Remove our own position tracking
Use the coords inside ClutterInputDevice instead.
src/backends/meta-cursor-tracker.c | 4 +--
src/wayland/meta-wayland-pointer.c | 60 +++++++++++++++--------------------
src/wayland/meta-wayland-pointer.h | 4 +-
3 files changed, 29 insertions(+), 39 deletions(-)
---
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index 2996921..675a976 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -148,9 +148,7 @@ make_wayland_cursor_tracker (MetaScreen *screen)
compositor = meta_wayland_compositor_get_default ();
compositor->seat->pointer.cursor_tracker = self;
- meta_cursor_tracker_update_position (self,
- wl_fixed_to_int (compositor->seat->pointer.x),
- wl_fixed_to_int (compositor->seat->pointer.y));
+ meta_cursor_tracker_update_position (self, 0, 0);
#if defined(CLUTTER_WINDOWING_EGL)
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index d8f18e4..7b4688c 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -290,8 +290,6 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
struct wl_display *display)
{
ClutterDeviceManager *manager;
- ClutterInputDevice *device;
- ClutterPoint current;
memset (pointer, 0, sizeof *pointer);
@@ -312,7 +310,7 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
pointer->grab = &pointer->default_grab;
manager = clutter_device_manager_get_default ();
- device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
+ pointer->device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
#if defined(CLUTTER_WINDOWING_EGL)
/* XXX -- the evdev backend can be used regardless of the
@@ -324,10 +322,6 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
pointer, NULL);
}
#endif
-
- clutter_input_device_get_coords (device, NULL, ¤t);
- pointer->x = wl_fixed_from_double (current.x);
- pointer->y = wl_fixed_from_double (current.y);
}
void
@@ -391,15 +385,16 @@ repick_for_event (MetaWaylandPointer *pointer,
}
else
{
- ClutterDeviceManager *device_manager = clutter_device_manager_get_default ();
- ClutterInputDevice *device = clutter_device_manager_get_device (device_manager,
META_VIRTUAL_CORE_POINTER_ID);
- ClutterStage *stage = clutter_input_device_get_pointer_stage (device);
+ ClutterStage *stage = clutter_input_device_get_pointer_stage (pointer->device);
if (stage)
- actor = clutter_stage_get_actor_at_pos (stage,
- CLUTTER_PICK_REACTIVE,
- wl_fixed_to_double (pointer->x),
- wl_fixed_to_double (pointer->y));
+ {
+ ClutterPoint pos;
+
+ clutter_input_device_get_coords (pointer->device, NULL, &pos);
+ actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_REACTIVE,
+ pos.x, pos.y);
+ }
}
if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
@@ -437,8 +432,7 @@ handle_button_event (MetaWaylandPointer *pointer,
{
pointer->grab_button = clutter_event_get_button (event);
pointer->grab_time = clutter_event_get_time (event);
- pointer->grab_x = pointer->x;
- pointer->grab_y = pointer->y;
+ clutter_event_get_coords (event, &pointer->grab_x, &pointer->grab_y);
}
pointer->grab->interface->button (pointer->grab, event);
@@ -533,19 +527,14 @@ void
meta_wayland_pointer_update (MetaWaylandPointer *pointer,
const ClutterEvent *event)
{
- float x, y;
-
- clutter_event_get_coords (event, &x, &y);
- pointer->x = wl_fixed_from_double (x);
- pointer->y = wl_fixed_from_double (y);
-
pointer->button_count = count_buttons (event);
if (pointer->cursor_tracker)
{
- meta_cursor_tracker_update_position (pointer->cursor_tracker,
- wl_fixed_to_int (pointer->x),
- wl_fixed_to_int (pointer->y));
+ ClutterPoint pos;
+
+ clutter_input_device_get_coords (pointer->device, NULL, &pos);
+ meta_cursor_tracker_update_position (pointer->cursor_tracker, pos.x, pos.y);
if (pointer->current == NULL)
meta_cursor_tracker_unset_window_cursor (pointer->cursor_tracker);
@@ -610,15 +599,17 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
{
struct wl_resource *resource;
struct wl_list *l;
+ ClutterPoint pos;
pointer->focus_surface = surface;
wl_resource_add_destroy_listener (pointer->focus_surface->resource, &pointer->focus_surface_listener);
+ clutter_input_device_get_coords (pointer->device, NULL, &pos);
+
meta_window_handle_enter (pointer->focus_surface->window,
/* XXX -- can we reliably get a timestamp for setting focus? */
clutter_get_current_event_time (),
- wl_fixed_to_int (pointer->x),
- wl_fixed_to_int (pointer->y));
+ pos.x, pos.y);
move_resources_for_client (&pointer->focus_resource_list,
&pointer->resource_list,
@@ -805,9 +796,8 @@ meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
1, /* button. XXX? */
0, /* modmask */
meta_display_get_current_time_roundtrip (window->display),
- wl_fixed_to_int (pointer->grab_x),
- wl_fixed_to_int (pointer->grab_y));
-
+ pointer->grab_x,
+ pointer->grab_y);
}
else
grab = (MetaWaylandPopupGrab*)pointer->grab;
@@ -845,10 +835,12 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
CLUTTER_ACTOR (meta_window_get_compositor_private (surface->window));
if (actor)
- clutter_actor_transform_stage_point (actor,
- wl_fixed_to_double (pointer->x),
- wl_fixed_to_double (pointer->y),
- &xf, &yf);
+ {
+ ClutterPoint pos;
+ clutter_input_device_get_coords (pointer->device, NULL, &pos);
+
+ clutter_actor_transform_stage_point (actor, pos.x, pos.y, &xf, &yf);
+ }
}
*sx = wl_fixed_from_double (xf);
diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h
index d30c6ee..4ee9990 100644
--- a/src/wayland/meta-wayland-pointer.h
+++ b/src/wayland/meta-wayland-pointer.h
@@ -63,12 +63,12 @@ struct _MetaWaylandPointer
MetaWaylandPointerGrab *grab;
MetaWaylandPointerGrab default_grab;
- wl_fixed_t grab_x, grab_y;
guint32 grab_button;
guint32 grab_serial;
guint32 grab_time;
+ float grab_x, grab_y;
- wl_fixed_t x, y; /* TODO: remove, use ClutterInputDevice instead */
+ ClutterInputDevice *device;
MetaWaylandSurface *current;
guint32 button_count;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]