GNOME Bugzilla – Bug 753202
change cursor for click scrolling
Last modified: 2016-06-02 03:07:34 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; }
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.
The patch here needs to be rebased on top of bug 767100
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.
Attachment 328910 [details] pushed as de8af76 - Show a scroll cursor when appropriate