diff options
author | Jason Gerecke <killertofu@gmail.com> | 2017-06-15 09:04:53 -0700 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2017-06-15 18:33:43 +0200 |
commit | ee67066c99605035eb8311e7a2ed8c2be4fcbd04 (patch) | |
tree | 6d4d2fe0b8591427cc7be188b0369219c4b17a22 | |
parent | 18f0f93d14710d059c56403a6ae1c10f1c70f7bb (diff) | |
download | nautilus-ee67066c99605035eb8311e7a2ed8c2be4fcbd04.tar.gz |
canvas-container: Use rubberband coordinates from original device
Nautilus assumes that the pointer returned by gdk_seat_get_pointer will
return the same GdkDevice which started a rubberband action. This is
not necessarily the case, however. Under Wayland, for example, tablet
tools have pointers (and GdkDevice's) which are entirely separate from
the seat's primary mouse-driven pointer. Attempting to use a pen to
perform rubberband selection will result in the rectangle being drawn
with the incorrect coordinates.
This patch has the code store the GdkDevice which generated the event
and provides it in place of the call to gdk_seat_get_pointer.
https://bugzilla.gnome.org/show_bug.cgi?id=783797
-rw-r--r-- | src/nautilus-canvas-container.c | 11 | ||||
-rw-r--r-- | src/nautilus-canvas-private.h | 1 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c index ff8d1edc3..321c2218d 100644 --- a/src/nautilus-canvas-container.c +++ b/src/nautilus-canvas-container.c @@ -2537,8 +2537,6 @@ rubberband_timeout_callback (gpointer data) double world_x, world_y; int x_scroll, y_scroll; int adj_x, adj_y; - GdkDisplay *display; - GdkSeat *seat; gboolean adj_changed; GtkAllocation allocation; @@ -2567,11 +2565,8 @@ rubberband_timeout_callback (gpointer data) adj_changed = TRUE; } - display = gtk_widget_get_display (widget); - seat = gdk_display_get_default_seat (display); - gdk_window_get_device_position (gtk_widget_get_window (widget), - gdk_seat_get_pointer (seat), + band_info->device, &x, &y, NULL); if (x < RUBBERBAND_SCROLL_THRESHOLD) @@ -2762,6 +2757,8 @@ start_rubberbanding (NautilusCanvasContainer *container, g_signal_emit (container, signals[BAND_SELECT_STARTED], 0); + band_info->device = event->device; + for (p = details->icons; p != NULL; p = p->next) { icon = p->data; @@ -2828,6 +2825,8 @@ stop_rubberbanding (NautilusCanvasContainer *container) band_info->active = FALSE; + band_info->device = NULL; + g_object_get (gtk_settings_get_default (), "gtk-enable-animations", &enable_animation, NULL); /* Destroy this canvas item; the parent will unref it. */ diff --git a/src/nautilus-canvas-private.h b/src/nautilus-canvas-private.h index 6b44952ca..0f3ad706b 100644 --- a/src/nautilus-canvas-private.h +++ b/src/nautilus-canvas-private.h @@ -75,6 +75,7 @@ typedef struct { double start_x, start_y; EelCanvasItem *selection_rectangle; + GdkDevice *device; guint timer_id; |