[mutter] wayland: Start drags from the press position



commit 3b023ea994b2d3f7c632a529c36da12596c0e9a0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 9 16:46:39 2016 +0100

    wayland: Start drags from the press position
    
    Using the current position to set the origin x/y of the DnD icon
    is wrong, it should still be used in order to move the icon besides
    the current pointer position though.
    
    Fixes possible drag-start-x/y property constraint warnings when
    starting a drag too close to the window edge, and towards outside
    of it.

 src/wayland/meta-wayland-data-device.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 8e9ae94..da545fe 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -979,7 +979,7 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice                 *data
 {
   MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);
   MetaWaylandDragGrab *drag_grab;
-  ClutterPoint pos, stage_pos;
+  ClutterPoint pos, surface_pos;
   ClutterModifierType modifiers;
 
   data_device->current_grab = drag_grab = g_slice_new0 (MetaWaylandDragGrab);
@@ -998,11 +998,12 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice                 *data
   wl_resource_add_destroy_listener (surface->resource,
                                     &drag_grab->drag_origin_listener);
 
-  clutter_input_device_get_coords (seat->pointer.device, NULL, &pos);
   clutter_actor_transform_stage_point (CLUTTER_ACTOR (meta_surface_actor_get_texture 
(surface->surface_actor)),
-                                       pos.x, pos.y, &stage_pos.x, &stage_pos.y);
-  drag_grab->drag_start_x = stage_pos.x;
-  drag_grab->drag_start_y = stage_pos.y;
+                                       seat->pointer.grab_x,
+                                       seat->pointer.grab_y,
+                                       &surface_pos.x, &surface_pos.y);
+  drag_grab->drag_start_x = surface_pos.x;
+  drag_grab->drag_start_y = surface_pos.y;
 
   modifiers = clutter_input_device_get_modifier_state (seat->pointer.device);
   drag_grab->buttons = modifiers &
@@ -1030,6 +1031,7 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice                 *data
       clutter_actor_add_child (drag_grab->feedback_actor,
                                CLUTTER_ACTOR (drag_grab->drag_surface->surface_actor));
 
+      clutter_input_device_get_coords (seat->pointer.device, NULL, &pos);
       meta_feedback_actor_set_position (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
                                         pos.x, pos.y);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]