wayland: add gdk_event_is_scroll_stop_event()

And use it to handle kinetic scrolling in the GtkScrolledWindow.

However, dropping the delta check causes the X11-based kinetic
scroll to break since we don't have the stop event here. Correct handling of
xf86-input-libinput-based scroll events is still being discussed.

https://bugzilla.gnome.org/show_bug.cgi?id=756729
This commit is contained in:
Peter Hutterer
2015-10-21 10:14:40 +10:00
committed by Carlos Garnacho
parent 3fca36169a
commit 48aa1bb08f
6 changed files with 49 additions and 3 deletions

View File

@ -562,6 +562,7 @@ gdk_event_new (GdkEventType type)
new_event->scroll.y_root = 0.;
new_event->scroll.delta_x = 0.;
new_event->scroll.delta_y = 0.;
new_event->scroll.is_stop = FALSE;
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
@ -1418,6 +1419,28 @@ gdk_event_get_scroll_deltas (const GdkEvent *event,
return fetched;
}
/**
* gdk_event_is_scroll_stop_event
* @event: a #GdkEvent
*
* Check whether a scroll event is a stop scroll event. Scroll sequences
* with smooth scroll information may provide a stop scroll event once the
* interaction with the device finishes, e.g. by lifting a finger. This
* stop scroll event is the signal that a widget may trigger kinetic
* scrolling based on the current velocity.
*
* Stop scroll events always have a a delta of 0/0.
*
* Returns: %TRUE if the event is a scroll stop event
*
* Since: 3.20
*/
gboolean
gdk_event_is_scroll_stop_event (const GdkEvent *event)
{
return event->scroll.is_stop;
}
/**
* gdk_event_get_axis:
* @event: a #GdkEvent