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 675959 - GdkEventScroll.delta_x always 0 for first GdkEventScroll after switching device or re-entering window
GdkEventScroll.delta_x always 0 for first GdkEventScroll after switching devi...
Status: RESOLVED NOTGNOME
Product: gtk+
Classification: Platform
Component: Class: GdkDevice
3.5.x
Other Linux
: High critical
: ---
Assigned To: gtk-bugs
Carlos Garnacho
: 704546 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-05-13 00:42 UTC by Volker Sobek (weld)
Modified: 2013-07-19 13:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Volker Sobek (weld) 2012-05-13 00:42:53 UTC
Most noticeably the first mouse wheel scroll after [re-]entering a window or after using the touchpad does have no effect. (In my case the mouse produces both smooth and non-smooth scrolling events, with the latter being ignored, I don't know if all mice are handled like that).

Ways to reproduce:

- Open nautilus and notice that the first scroll with the mouse wheel will be ignored. Move the pointer out of the nautilus window and back, scroll again and notice that the first scroll will be ignored again.

- Also changing between touchpad and mouse scrolling makes this obvious, as the first mouse wheel scroll after touchpad scrolling will be ignored noticeably.


Program I used for testing:
#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
scroll_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
{
  GdkDevice *source_device;
  GdkEventScroll *scroll_event;
  
  source_device = gdk_event_get_source_device (event);
  scroll_event = (GdkEventScroll *) event;

  printf ("Source Device: %s\n", gdk_device_get_name (source_device));
  printf ("GdkEventScroll:\n");
  printf ("   time: %i\n", scroll_event->time);
  printf ("   GdkScrollDirection: %i (%s)\n", scroll_event->direction,
	  gdk_scroll_direction_to_str (scroll_event->direction));
  printf ("   delta_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;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_events (window, GDK_SCROLL_MASK);
  gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);

  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
  g_signal_connect (window, "scroll-event", G_CALLBACK (scroll_event_cb), NULL);
  
  gtk_widget_show_all (GTK_WIDGET (window));
  gtk_main ();
  return 0;
}


And some output:

/* Entering the window with the mouse and starting to scroll */

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70400731
   GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH)
   delta_x: 0,000000, delta_y: 0,000000 <---------NO EFFECT

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70400731
   GdkScrollDirection: 1 (GDK_SCROLL_DOWN)
   delta_x: 0,000000, delta_y: 0,000000

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70405179
   GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH)
   delta_x: 0,000000, delta_y: 1,000000

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70405179
   GdkScrollDirection: 1 (GDK_SCROLL_DOWN)
   delta_x: 0,000000, delta_y: 0,000000

/* Using the touchpad now */

Source Device: AlpsPS/2 ALPS DualPoint TouchPad
GdkEventScroll:
   time: 70409713
   GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH)
   delta_x: 0,000000, delta_y: 0,000000 <---------NO EFFECT

Source Device: AlpsPS/2 ALPS DualPoint TouchPad
GdkEventScroll:
   time: 70409836
   GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH)
   delta_x: 0,000000, delta_y: 0,040000

Source Device: AlpsPS/2 ALPS DualPoint TouchPad
GdkEventScroll:
   time: 70409919
   GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH)
   delta_x: 0,000000, delta_y: 0,040000

/* Using the mouse again */

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70412059
   GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH)
   delta_x: 0,000000, delta_y: 0,000000 <---------NO EFFECT

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70412059
   GdkScrollDirection: 1 (GDK_SCROLL_DOWN)
   delta_x: 0,000000, delta_y: 0,000000

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70412411
   GdkScrollDirection: 4 (GDK_SCROLL_SMOOTH)
   delta_x: 0,000000, delta_y: 1,000000

Source Device: Logitech USB-PS/2 Optical Mouse
GdkEventScroll:
   time: 70412411
   GdkScrollDirection: 1 (GDK_SCROLL_DOWN)
   delta_x: 0,000000, delta_y: 0,000000
Comment 1 Volker Sobek (weld) 2012-05-13 00:56:42 UTC
I think this might be no (noticeably) issue for touch devices, but for mice that cause smooth scroll events with a delta of 1 only it's surly wrong.
Comment 2 Ijon Tichy 2012-05-25 15:16:30 UTC
Yes, I can confirm this bug on version 3.4.1.
Comment 3 Matthias Clasen 2012-06-21 11:16:59 UTC
This is an inherent limitation of the XI2 protocol that has been acknowledged by its designers. Not much we can do about it.
Comment 4 Emmanuele Bassi (:ebassi) 2013-07-19 13:13:54 UTC
*** Bug 704546 has been marked as a duplicate of this bug. ***