GNOME Bugzilla – Bug 671585
Add support for smooth scrolling devices
Last modified: 2015-06-10 13:48:30 UTC
I can't scroll with the mouse wheel any of the calendar views (day, week, month, ... ). I searched a bit and found bug 671305 (scrolling broken in gnome-terminal) - maybe the same issue? gtk3-3.3.18-1.fc17.x86_64 evolution-3.3.90-1.fc17.x86_64
Created attachment 209199 [details] [review] proposed evo patch for evolution; Seems to be a similar one-liner like for the gnome-terminal. Could you test it, please?
ping Frank
Scrolling currently works again with evolution-3.3.92-1.fc17.x86_64 gtk3-3.3.20-1.fc17.x86_64 Closing for now.
In fact it's still happening with: evolution-3.4.0.1-1.fc17.x86_64 gtk3-3.4.0-1.fc17.x86_64 $ xinput --list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech USB-PS/2 Optical Mouse id=9 [slave pointer (2)] ⎜ ↳ HID 046a:0023 id=11 [slave pointer (2)] ⎜ ↳ DualPoint Stick id=13 [slave pointer (2)] ⎜ ↳ AlpsPS/2 ALPS DualPoint TouchPad id=14 [slave pointer (2)] The only device I can scroll the calendar with is the DualPoint Stick $ cat /etc/X11/xorg.conf.d/20-trackpoint-preparation.conf Section "InputClass" Identifier "Trackpoint Wheel Emulation Setup" MatchIsPointer "true" MatchProduct "TrackPoint|DualPoint Stick" MatchDevicePath "/dev/input/event*" Option "EmulateWheel" "true" Option "EmulateWheelButton" "2" Option "XAxisMapping" "6 7" Option "YAxisMapping" "4 5" EndSection
Review of attachment 209199 [details] [review]: Does not fix the bug for me. Same result as in my last comment.
It's basically the same patch as in gnome-terminal. Does it scroll for you or that is broken as well?
(In reply to comment #6) > It's basically the same patch as in gnome-terminal. Does it scroll for you or > that is broken as well? Scrolling in gnome-terminal works for me since vte was patched. To be sure I just applied your patch again on top of commit 56592175f6898a48eb840ddcfb0dcc9ad4c98038 but scrolling still doesn't work.
Downstream bug report about the same from 3.4.1: https://bugzilla.redhat.com/show_bug.cgi?id=814981
Just for a record, downstream bug reporter claims that the issue got fixed for him after update of xorg-x11-drv-synaptics package. Is it similar for you?
Not fixed for me. I threw together a little test program to find out the difference between the device that works and the devices that don't: #include <gtk/gtk.h> gchar * gdk_scroll_direction_to_str (GdkScrollDirection direction) { switch (direction) { case GDK_SCROLL_UP: return "GDK_SCROLL_UP"; case GDK_SCROLL_DOWN: return "GDK_SCROLL_DOWN"; case GDK_SCROLL_LEFT: return "GDK_SCROLL_LEFT"; case GDK_SCROLL_RIGHT: return "GDK_SCROLL_RIGHT"; case GDK_SCROLL_SMOOTH: return "GDK_SCROLL_SMOOTH"; default: return "not a valid scroll direction"; } } gboolean enter_notify_event_cb () { printf ("enter-notify-event\n"); return FALSE; } gboolean button_press_event_cb () { printf ("button_press_event_cb\n"); return FALSE; } gboolean event_cb (GtkWidget *widget, GdkEvent *event) { GdkDevice *source_device; gint event_type; GdkEventScroll *scroll_event; /* we are only interested in scrolling events */ event_type = event->type; if (event_type != GDK_SCROLL) return FALSE; source_device = gdk_event_get_source_device (event); printf ("Source Device: %s\n", gdk_device_get_name (source_device)); /***********************************/ /* struct GdkEventScroll { */ /* GdkEventType type; */ /* GdkWindow *window; */ /* gint8 send_event; */ /* guint32 time; */ /* gdouble x; */ /* gdouble y; */ /* guint state; */ /* GdkScrollDirection direction; */ /* GdkDevice *device; */ /* gdouble x_root, y_root; */ /* gdouble delta_x; */ /* gdouble delta_y; */ /* }; */ /***********************************/ scroll_event = (GdkEventScroll*) event; printf ("GdkEventScroll members:\n"); printf ("\tsend_event: %i\n", scroll_event->send_event); printf ("\tx: %f, y: %f\n", scroll_event->x, scroll_event->y); printf ("\tstate: %u\n", scroll_event->state); printf ("\tGdkScrollDirection: %i (%s)\n", scroll_event->direction, gdk_scroll_direction_to_str (scroll_event->direction)); printf ("\tdelta_x: %f, delta_y: %f\n\n", scroll_event->delta_x, scroll_event->delta_y); return FALSE; } int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *label; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_add_events (window, gtk_widget_get_events (window) | GDK_ALL_EVENTS_MASK); /* | GDK_SCROLL_MASK); */ gtk_window_set_default_size (GTK_WINDOW (window), 400, 400); label = gtk_label_new ("Test Area"); gtk_container_add (GTK_CONTAINER (window), label); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (window, "enter-notify-event", G_CALLBACK (enter_notify_event_cb), NULL); g_signal_connect (window, "button-press-event", G_CALLBACK (button_press_event_cb), NULL); g_signal_connect (window, "event", G_CALLBACK (event_cb), NULL); gtk_widget_show_all (GTK_WIDGET (window)); gtk_main (); return 0; } Output for the devices I tested: ==== Scrolling one step with the trackpoint (WORKS in evo calendar): enter-notify-event Source Device: DualPoint Stick GdkEventScroll members: send_event: 0 x: 302,294739, y: 231,568695 state: 0 GdkScrollDirection: 1 (GDK_SCROLL_DOWN) delta_x: 0,000000, delta_y: 0,000000 ==== Scrolling one step with the mouse wheel triggers two events (does NOT work in evo calendar): Source Device: Logitech USB-PS/2 Optical Mouse GdkEventScroll members: send_event: 0 x: 201,129959, y: 107,658188 state: 0 GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH) delta_x: 0,000000, delta_y: 0,000000 Source Device: Logitech USB-PS/2 Optical Mouse GdkEventScroll members: send_event: 0 x: 201,129959, y: 107,658188 state: 0 GdkScrollDirection: 1 (GDK_SCROLL_DOWN) delta_x: 0,000000, delta_y: 0,000000 ==== Scrolling with the touchpad (does NOT work in evo calendar): Source Device: AlpsPS/2 ALPS DualPoint TouchPad GdkEventScroll members: send_event: 0 x: 206,728149, y: 202,233490 state: 0 GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH) delta_x: 0,000000, delta_y: 0,040000 <- this varies, of course
I forgot to mention that when I keep scrolling with the mouse wheel, the delta_y changes to 1, only the first time after switching from tackpoint or touchpad scrolling to mouse wheel scrolling delta_y is 0. So continuous mouse wheel scrolling produces this output for each step: Source Device: Logitech USB-PS/2 Optical Mouse GdkEventScroll members: send_event: 0 x: 278,809937, y: 263,445404 state: 0 GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH) delta_x: 0,000000, delta_y: 1,000000 <-----------HERE Source Device: Logitech USB-PS/2 Optical Mouse GdkEventScroll members: send_event: 0 x: 278,809937, y: 263,445404 state: 0 GdkScrollDirection: 1 (GDK_SCROLL_DOWN) delta_x: 0,000000, delta_y: 0,000000
Created attachment 213801 [details] [review] proposed evo patch ][ for evolution; Thanks for the data. It gives some insight. One thing I do not understand, it also notifies with scroll_down, but it doesn't scroll for you. It's strange. I do not compile against latest GTK, thus this is rather blind change. Could you give it a try, please? I'm also not sure with the translation, whether it'll scroll down when you scrolls down. If not, then some places will need to negate their conditions. The part in e-week-view will probably need a closer test too, as the delta_y may be incorrect for a scroll step. This is used in the full week and month view.
Review of attachment 213801 [details] [review]: Scrolling in the 'Week' and 'Month' views: Appears to be working correctly with this patch for all devices now. Scrolling in 'Day' and 'Work View' views: 1) Trackpoint (triggers only a scroll event): everything appears to be working correctly, as without this patch 2) Touchpad (triggers only a smooth scroll event): scrolling working now but it is inverted and appears to be too fast (but I can scroll to positions between top/bottom) 3) Mouse wheel (sending both events): scrolling working now but is inverted and too fast; it either scrolls to the top or button in one step, nothing in between
(In reply to comment #13) > Scrolling in 'Day' and 'Work View' views: Must be: Scrolling in 'Day' and 'Work Week' views:
Review of attachment 213801 [details] [review]: I overlooked the changes you made in e-web-view-gtkhtml.c and e-web-view.c for adding zooming with Ctrl + smooth scrolling. These changes correctly enable zooming for Ctrl + smooth scrolling for me, which didn't work before.
(In reply to comment #15) > Review of attachment 213801 [details] [review]: > > I overlooked the changes you made in e-web-view-gtkhtml.c and e-web-view.c for > adding zooming with Ctrl + smooth scrolling. These changes correctly enable > zooming for Ctrl + smooth scrolling for me, which didn't work before. Actually that is already working in master for some reason.
(In reply to comment #16) > (In reply to comment #15) > > Review of attachment 213801 [details] [review] [details]: > > > > I overlooked the changes you made in e-web-view-gtkhtml.c and e-web-view.c for > > adding zooming with Ctrl + smooth scrolling. These changes correctly enable > > zooming for Ctrl + smooth scrolling for me, which didn't work before. > > Actually that is already working in master for some reason. Sorry for the fuss, it's not working correctly with master. Comment 15 stays valid.
Thanks for testing it. I tried your test application too (it's a very nice one, thanks for it), and I realized that none of my devices use smooth scrolling. I tried it also to find out proper threshold for changing SMOOTH scroll into UP/DOWN scroll. What are the usual delta values for the smooth scroll for you, please? Say if I'll pick >= 1.0/<= -1.0, then it'll not be that fast with scrolling? Alternatively, if you could give me a log from your test app with one of your smooth-scrolling capable devices when you'll scroll up for some space and then down, with a description of expected result.
I just got some help on #gtk+, cosimoc pointed out that nautilus does the translation SMOOTH -> UP/DOWN by accumulating the deltas until the sum is < -1 or > 1. See http://git.gnome.org/browse/nautilus/tree/src/nautilus-view.c#n9494
Created attachment 214072 [details] [review] proposed evo patch ]I[ for evolution; Thanks for all the work around this. I do not like to code blindly, but as I do not have similar device like you, then there is nothing else to be done. I appreciate your patience. This patch reverses Up/Down translations from Smooth event (also in zooming views) and uses similar Smooth accumulator in the event handlers as Nautilus. I also discovered a bug in a callback prototype and fixed it as well. Please test it, I believe (and hope) it's the final version of the patch. Thanks in advance.
For the e-day-view.c the following changes (on top of your patch) are needed to make scrolling conform with _UP _DOWN scrolling behavior (with your patch it's still reversed and too fast, as it doesn't take E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE into account): diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 467f2ba..be096b5 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -3279,7 +3279,7 @@ e_day_view_on_main_canvas_scroll (GtkWidget *widget, #if GTK_CHECK_VERSION(3,3,18) case GDK_SCROLL_SMOOTH: if (scroll->delta_y < -0.001 || scroll->delta_y > 0.001) { - e_day_view_scroll (day_view, scroll->delta_y); + e_day_view_scroll (day_view, -E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE * scroll->delta_y); return TRUE; } break; @@ -3306,7 +3306,7 @@ e_day_view_on_top_canvas_scroll (GtkWidget *widget, #if GTK_CHECK_VERSION(3,3,18) case GDK_SCROLL_SMOOTH: if (scroll->delta_y < -0.001 || scroll->delta_y > 0.001) { - e_day_view_top_scroll (day_view, scroll->delta_y); + e_day_view_top_scroll (day_view, -E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE * scroll->delta_y); return TRUE; } break; @@ -3340,7 +3340,7 @@ e_day_view_on_time_canvas_scroll (GtkWidget *widget, #if GTK_CHECK_VERSION(3,3,18) case GDK_SCROLL_SMOOTH: if (scroll->delta_y < -0.001 || scroll->delta_y > 0.001) { - e_day_view_scroll (day_view, scroll->delta_y); + e_day_view_scroll (day_view, -E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE * scroll->delta_y); return TRUE; } break; All other changes seem to be working correctly now.
Created attachment 214094 [details] [review] Additional changes to the previous patch pasting didn't work out well ;)
Created attachment 214097 [details] [review] evo patch IV for evolution; Thanks for all the testing. This is the final patch, with your changes incorporated, which I'm going to commit.
Created commit 5e37937 in evo master (3.5.2+) Created commit 9cc5188 in evo gnome-3-4 (3.4.3+)
Created attachment 214149 [details] [review] e-week-view.c: Use page_increment for smooth scrolling A remaining issue I stumbled upon.
I see. Thanks for the patch. Created commit f28b9df in evo master (3.5.2+) Created commit 89a6e22 in evo gnome-3-4 (3.4.3+)
*** Bug 677020 has been marked as a duplicate of this bug. ***