Commit ee67066c authored by Jason Gerecke's avatar Jason Gerecke Committed by Carlos Soriano Sánchez

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
parent 18f0f93d
......@@ -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. */
......
......@@ -75,6 +75,7 @@ typedef struct {
double start_x, start_y;
EelCanvasItem *selection_rectangle;
GdkDevice *device;
guint timer_id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment