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 753202 - change cursor for click scrolling
change cursor for click scrolling
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkScrolledWindow
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on: 767093
Blocks:
 
 
Reported: 2015-08-03 22:25 UTC by Matthias Clasen
Modified: 2016-06-02 03:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Show a scroll cursor when appropriate (3.67 KB, patch)
2016-06-01 03:35 UTC, Matthias Clasen
none Details | Review
Show a scroll cursor when appropriate (4.49 KB, patch)
2016-06-01 19:11 UTC, Matthias Clasen
committed Details | Review

Description Matthias Clasen 2015-08-03 22:25:01 UTC
it might be a nice touch to change to a suitable cursor if you are using middle-click + stick to scroll. This patch almost gets it right. It doesn't work for textviews, unfortunately, because those set a cursor on their own window.

Also missing: some certain way to remove the cursor, either install a short timeout for that, or listen for grab_notify.


diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index a56844f..6215958 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1249,9 +1249,28 @@ captured_event_cb (GtkWidget *widget,
       scroll_history_push (sw, &event->scroll);
 
       if (event->scroll.direction == GDK_SCROLL_SMOOTH &&
+          (strstr (gdk_device_get_name (source_device), "TrackPoint") ||
+           strstr (gdk_device_get_name (source_device), "DualPoint Stick")))
+        {
+          GdkDisplay *display;
+          GdkWindow *window;
+          GdkCursor *cursor;
+
+          display = gtk_widget_get_display (widget);
+          window = gtk_widget_get_window (widget);
+          cursor = gdk_cursor_new_from_name (display, "all-scroll");
+          gdk_window_set_cursor (window, cursor);
+          g_object_unref (cursor);
+        }
+
+      if (event->scroll.direction == GDK_SCROLL_SMOOTH &&
           dx == 0 && dy == 0 &&
           scroll_history_finish (sw, &vel_x, &vel_y))
-        gtk_scrolled_window_decelerate (sw, vel_x, vel_y);
+        {
+          gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
+
+          gtk_scrolled_window_decelerate (sw, vel_x, vel_y);
+        }
 
       return GDK_EVENT_PROPAGATE;
     }
Comment 1 Matthias Clasen 2016-06-01 03:35:17 UTC
Created attachment 328855 [details] [review]
Show a scroll cursor when appropriate

When doing two finger scrolling or click scrolling using a
trackpoint, show the all-scroll cursor to indicate what is
going on.
Comment 2 Matthias Clasen 2016-06-01 11:54:43 UTC
The patch here needs to be rebased on top of bug 767100
Comment 3 Matthias Clasen 2016-06-01 19:11:21 UTC
Created attachment 328910 [details] [review]
Show a scroll cursor when appropriate

When doing two-finger scrolling or click scrolling using a
trackpoint, show the all-scroll cursor to indicate what is
going on.
Comment 4 Matthias Clasen 2016-06-02 03:07:30 UTC
Attachment 328910 [details] pushed as de8af76 - Show a scroll cursor when appropriate