After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 783797 - Nautilus file selection (rubberband) has one corner stuck at 0,0 when using Wacom pen under Wayland
Nautilus file selection (rubberband) has one corner stuck at 0,0 when using W...
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-06-14 20:38 UTC by Jason Gerecke
Modified: 2017-06-15 16:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix issue by storing the triggering GdkDevice (2.53 KB, patch)
2017-06-14 20:57 UTC, Jason Gerecke
none Details | Review
Fix graphical glitch caused by simultaneous rubberband actions (3.19 KB, patch)
2017-06-14 20:58 UTC, Jason Gerecke
none Details | Review
Fix issue by storing the triggering GdkDevice (v2) (2.84 KB, patch)
2017-06-15 16:08 UTC, Jason Gerecke
committed Details | Review
Fix graphical glitch caused by simultaneous rubberband actions (v2) (3.21 KB, patch)
2017-06-15 16:12 UTC, Jason Gerecke
committed Details | Review

Description Jason Gerecke 2017-06-14 20:38:09 UTC
The rubberband selection effect in Nautilus does not work properly when used with a Wacom tool (pen, puck, etc.) under Wayland. Instead of drawing a selection rectangle from the point the pen went down to the current pen position, the rectangle is drawn from the top-left corner of the window to the original click position. The shape of the rectangle does not change in response to pen movement.
Comment 1 Jason Gerecke 2017-06-14 20:57:32 UTC
Created attachment 353768 [details] [review]
Fix issue by storing the triggering GdkDevice
Comment 2 Jason Gerecke 2017-06-14 20:58:28 UTC
Created attachment 353769 [details] [review]
Fix graphical glitch caused by simultaneous rubberband actions
Comment 3 Carlos Soriano 2017-06-15 08:15:08 UTC
Review of attachment 353768 [details] [review]:

::: src/nautilus-canvas-container.c
@@ +2758,3 @@
                    signals[BAND_SELECT_STARTED], 0);
 
+    band_info->device = event->device;

Couldn't this device go away on the timeout?
Probably not gonna happen in practicity...

Still, would be good to "clean it up" when the rubberbanding is done, instead of having a pointer to device that could have gone away later on.
Comment 4 Carlos Soriano 2017-06-15 08:18:01 UTC
Review of attachment 353769 [details] [review]:

::: src/nautilus-canvas-container.c
@@ +2759,3 @@
     band_info = &details->rubberband_info;
 
+    if (band_info->active) {

brackets go on new line

@@ +2760,3 @@
 
+    if (band_info->active) {
+        g_warning ("Canceling active rubberband by device %s", gdk_device_get_name (band_info->device));

you mean g_debug? Or do you really want to give a warning because this should never happen?

@@ +2831,3 @@
 
+    if (event != NULL && event->device != band_info->device)
+        return;

missing brackets
Comment 5 Jason Gerecke 2017-06-15 16:08:52 UTC
Created attachment 353845 [details] [review]
Fix issue by storing the triggering GdkDevice (v2)

(In reply to Carlos Soriano from comment #3)
> Review of attachment 353768 [details] [review] [review]:
> 
> ::: src/nautilus-canvas-container.c
> @@ +2758,3 @@
>                     signals[BAND_SELECT_STARTED], 0);
>  
> +    band_info->device = event->device;
> 
> Couldn't this device go away on the timeout?
> Probably not gonna happen in practicity...
> 

For the Wayland case that motivated this bug report, libinput is supposed to send button-release events prior to removing devices. I think X input drivers are expected to act similarly. If those events aren't sent (i.e., due to a bug) then you could potentially have a disconnected device disappear in the middle of rubberbanding.

We could potentially listen for a device-removed signal and cancel the rubberband if its a big enough concern.

> Still, would be good to "clean it up" when the rubberbanding is done,
> instead of having a pointer to device that could have gone away later on.

Patch amended.
Comment 6 Jason Gerecke 2017-06-15 16:12:32 UTC
Created attachment 353846 [details] [review]
Fix graphical glitch caused by simultaneous rubberband actions (v2)

(In reply to Carlos Soriano from comment #4)
> Review of attachment 353769 [details] [review] [review]:
> 
> ::: src/nautilus-canvas-container.c
> @@ +2759,3 @@
>      band_info = &details->rubberband_info;
>  
> +    if (band_info->active) {
> 
> brackets go on new line
> 

Patch amended.

> @@ +2760,3 @@
>  
> +    if (band_info->active) {
> +        g_warning ("Canceling active rubberband by device %s",
> gdk_device_get_name (band_info->device));
> 
> you mean g_debug? Or do you really want to give a warning because this
> should never happen?
> 

Replacing an active rubberband be a very rare / exceptional event, but I suppose there's no particular reason to print a warning since it "should" be expected to work. Patch amended.

> @@ +2831,3 @@
>  
> +    if (event != NULL && event->device != band_info->device)
> +        return;
> 
> missing brackets

Patch amended.
Comment 7 Carlos Soriano 2017-06-15 16:30:28 UTC
(In reply to Jason Gerecke from comment #5)
> Created attachment 353845 [details] [review] [review]
> Fix issue by storing the triggering GdkDevice (v2)
> 
> (In reply to Carlos Soriano from comment #3)
> > Review of attachment 353768 [details] [review] [review] [review]:
> > 
> > ::: src/nautilus-canvas-container.c
> > @@ +2758,3 @@
> >                     signals[BAND_SELECT_STARTED], 0);
> >  
> > +    band_info->device = event->device;
> > 
> > Couldn't this device go away on the timeout?
> > Probably not gonna happen in practicity...
> > 
> 
> For the Wayland case that motivated this bug report, libinput is supposed to
> send button-release events prior to removing devices. I think X input
> drivers are expected to act similarly. If those events aren't sent (i.e.,
> due to a bug) then you could potentially have a disconnected device
> disappear in the middle of rubberbanding.
> 
> We could potentially listen for a device-removed signal and cancel the
> rubberband if its a big enough concern.

Yeah I was thinking about that, but no worries, it's not a concern big enough (and even more for this code which eventually will go away with the new views)

> 
> > Still, would be good to "clean it up" when the rubberbanding is done,
> > instead of having a pointer to device that could have gone away later on.
> 
> Patch amended.
Comment 8 Carlos Soriano 2017-06-15 16:30:55 UTC
Review of attachment 353845 [details] [review]:

Excellent, thanks!
Comment 9 Carlos Soriano 2017-06-15 16:31:21 UTC
Review of attachment 353846 [details] [review]:

LGTM, thanks for this work!
Comment 10 Carlos Soriano 2017-06-15 16:31:21 UTC
Review of attachment 353846 [details] [review]:

LGTM, thanks for this work!
Comment 11 Carlos Soriano 2017-06-15 16:37:04 UTC
Pushed to master and 3.24