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 671585 - Add support for smooth scrolling devices
Add support for smooth scrolling devices
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Calendar
3.4.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-calendar-maintainers
Evolution QA team
: 677020 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-03-07 18:38 UTC by Volker Sobek (weld)
Modified: 2015-06-10 13:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed evo patch (468 bytes, patch)
2012-03-07 18:44 UTC, Milan Crha
rejected Details | Review
proposed evo patch ][ (4.93 KB, patch)
2012-05-10 12:46 UTC, Milan Crha
needs-work Details | Review
proposed evo patch ]I[ (6.22 KB, patch)
2012-05-15 09:45 UTC, Milan Crha
none Details | Review
Additional changes to the previous patch (1.55 KB, patch)
2012-05-15 13:52 UTC, Volker Sobek (weld)
reviewed Details | Review
evo patch IV (6.33 KB, patch)
2012-05-15 14:19 UTC, Milan Crha
committed Details | Review
e-week-view.c: Use page_increment for smooth scrolling (995 bytes, patch)
2012-05-15 19:51 UTC, Volker Sobek (weld)
committed Details | Review

Description Volker Sobek (weld) 2012-03-07 18:38:03 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
Comment 1 Milan Crha 2012-03-07 18:44:26 UTC
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?
Comment 2 Milan Crha 2012-03-21 14:31:21 UTC
ping Frank
Comment 3 Volker Sobek (weld) 2012-03-26 19:33:00 UTC
Scrolling currently works again with
evolution-3.3.92-1.fc17.x86_64
gtk3-3.3.20-1.fc17.x86_64

Closing for now.
Comment 4 Volker Sobek (weld) 2012-04-11 00:00:13 UTC
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
Comment 5 Volker Sobek (weld) 2012-04-11 00:03:45 UTC
Review of attachment 209199 [details] [review]:

Does not fix the bug for me. Same result as in my last comment.
Comment 6 Milan Crha 2012-04-11 09:23:12 UTC
It's basically the same patch as in gnome-terminal. Does it scroll for you or that is broken as well?
Comment 7 Volker Sobek (weld) 2012-04-11 14:48:03 UTC
(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.
Comment 8 Milan Crha 2012-04-23 07:02:32 UTC
Downstream bug report about the same from 3.4.1:
https://bugzilla.redhat.com/show_bug.cgi?id=814981
Comment 9 Milan Crha 2012-05-09 07:38:38 UTC
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?
Comment 10 Volker Sobek (weld) 2012-05-09 17:14:28 UTC
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
Comment 11 Volker Sobek (weld) 2012-05-09 17:53:51 UTC
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
Comment 12 Milan Crha 2012-05-10 12:46:40 UTC
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.
Comment 13 Volker Sobek (weld) 2012-05-12 19:44:45 UTC
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
Comment 14 Volker Sobek (weld) 2012-05-12 19:47:52 UTC
(In reply to comment #13)

> Scrolling in 'Day' and 'Work View' views:
Must be:
Scrolling in 'Day' and 'Work Week' views:
Comment 15 Volker Sobek (weld) 2012-05-12 21:42:19 UTC
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.
Comment 16 Volker Sobek (weld) 2012-05-12 22:34:29 UTC
(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.
Comment 17 Volker Sobek (weld) 2012-05-12 22:42:29 UTC
(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.
Comment 18 Milan Crha 2012-05-14 12:06:28 UTC
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.
Comment 19 Volker Sobek (weld) 2012-05-14 22:58:34 UTC
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
Comment 20 Milan Crha 2012-05-15 09:45:03 UTC
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.
Comment 21 Volker Sobek (weld) 2012-05-15 13:47:34 UTC
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.
Comment 22 Volker Sobek (weld) 2012-05-15 13:52:30 UTC
Created attachment 214094 [details] [review]
Additional changes to the previous patch

pasting didn't work out well ;)
Comment 23 Milan Crha 2012-05-15 14:19:22 UTC
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.
Comment 24 Milan Crha 2012-05-15 14:25:57 UTC
Created commit 5e37937 in evo master (3.5.2+)
Created commit 9cc5188 in evo gnome-3-4 (3.4.3+)
Comment 25 Volker Sobek (weld) 2012-05-15 19:51:56 UTC
Created attachment 214149 [details] [review]
 e-week-view.c: Use page_increment for smooth scrolling

A remaining issue I stumbled upon.
Comment 26 Milan Crha 2012-05-16 13:32:43 UTC
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+)
Comment 27 Milan Crha 2015-06-10 13:48:30 UTC
*** Bug 677020 has been marked as a duplicate of this bug. ***