f09b1f0f10483f8b1615b641f6be580fda01b973
[mono.git] / bockbuild / mac-sdk / patches / gtk / 0022-Use-start-end-phase-in-event-handling.patch
1 From a4e5fe549e5497a7e5ae7eecae4fc654330500f2 Mon Sep 17 00:00:00 2001
2 From: Kristian Rietveld <kris@lanedo.com>
3 Date: Fri, 28 Sep 2012 06:18:49 +0200
4 Subject: [PATCH 22/68] Use start/end phase in event handling
5
6 Should make things work better on Mountain Lion.
7 ---
8  gtk/gtkscrolledwindow.c |   13 +++++--------
9  1 file changed, 5 insertions(+), 8 deletions(-)
10
11 diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
12 index 5341b50..92e75a0 100644
13 --- a/gtk/gtkscrolledwindow.c
14 +++ b/gtk/gtkscrolledwindow.c
15 @@ -2010,12 +2010,10 @@ gtk_scrolled_window_scroll_event (GtkWidget      *widget,
16        if (old_overshoot_x != 0 || old_overshoot_y != 0)
17          is_overshot = TRUE;
18
19 -      /* In case the view is not overshot, no snap back is active
20 -       * and this event is not a momentum event, then a new scrolling
21 -       * gesture has started. In case we are still in snapping back
22 -       * state we can reset this (because the snapback has ended).
23 +      /* If a new gesture has started, reset snap back state.
24 +       * FIXME: check if overshoot has really ended.
25         */
26 -      if (!is_overshot && priv->deceleration_id == 0 && !is_momentum_event)
27 +      if (event->phase == GDK_EVENT_SCROLL_PHASE_START)
28          priv->is_snapping_back = FALSE;
29
30        /* Scroll events are handled in two cases:
31 @@ -2109,13 +2107,12 @@ gtk_scrolled_window_scroll_event (GtkWidget      *widget,
32          _gtk_scrolled_window_allocate_overshoot_window (scrolled_window);
33
34        /* In two cases we want to start snapping back:
35 -       *  1) The view is overshot and the gesture has ended (signalled
36 -       *  by an event with both deltas set to zero.
37 +       *  1) The view is overshot and the gesture has ended.
38         *  2) The view is overshot and we receive a momentum event, which
39         *  also signals that the user's gesture has ended.
40         */
41        if (is_overshot &&
42 -          ((delta_x == 0.0 && delta_y == 0.0) || is_momentum_event))
43 +          (event->phase == GDK_EVENT_SCROLL_PHASE_END || is_momentum_event))
44          start_snap_back = TRUE;
45
46        /* If we should start a snap back and no current deceleration
47 --
48 1.7.10.2 (Apple Git-33)