Merge lp:~cimi/overlay-scrollbar/fix-951121 into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Charles Kerr
Approved revision: 339
Merged at revision: 339
Proposed branch: lp:~cimi/overlay-scrollbar/fix-951121
Merge into: lp:overlay-scrollbar
Diff against target: 112 lines (+54/-6)
2 files modified
os/os-scrollbar.c (+51/-6)
os/os-thumb.c (+3/-0)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/fix-951121
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+97086@code.launchpad.net

Description of the change

Deal with XI2 new event handling

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

Looks okay.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'os/os-scrollbar.c'
--- os/os-scrollbar.c 2012-02-21 17:06:16 +0000
+++ os/os-scrollbar.c 2012-03-13 14:25:23 +0000
@@ -1794,15 +1794,11 @@
1794 return FALSE;1794 return FALSE;
1795}1795}
17961796
1797static gboolean1797static void
1798thumb_enter_notify_event_cb (GtkWidget *widget,1798enter_event (OsScrollbar *scrollbar)
1799 GdkEventCrossing *event,
1800 gpointer user_data)
1801{1799{
1802 OsScrollbar *scrollbar;
1803 OsScrollbarPrivate *priv;1800 OsScrollbarPrivate *priv;
18041801
1805 scrollbar = OS_SCROLLBAR (user_data);
1806 priv = scrollbar->priv;1802 priv = scrollbar->priv;
18071803
1808 priv->event |= OS_EVENT_ENTER_NOTIFY;1804 priv->event |= OS_EVENT_ENTER_NOTIFY;
@@ -1812,6 +1808,29 @@
18121808
1813 if (priv->state & OS_STATE_INTERNAL)1809 if (priv->state & OS_STATE_INTERNAL)
1814 priv->state |= OS_STATE_LOCKED;1810 priv->state |= OS_STATE_LOCKED;
1811}
1812
1813static gboolean
1814thumb_enter_notify_event_cb (GtkWidget *widget,
1815 GdkEventCrossing *event,
1816 gpointer user_data)
1817{
1818 OsScrollbar *scrollbar;
1819 OsScrollbarPrivate *priv;
1820
1821 scrollbar = OS_SCROLLBAR (user_data);
1822 priv = scrollbar->priv;
1823
1824#ifdef USE_GTK3
1825 /* Gtk+ 3.3.18 emits more GdkEventCrossing
1826 * with touch devices, skip few events. */
1827 if (event->mode == GDK_CROSSING_TOUCH_BEGIN ||
1828 event->mode == GDK_CROSSING_TOUCH_END ||
1829 event->mode == GDK_CROSSING_DEVICE_SWITCH)
1830 return FALSE;
1831#endif
1832
1833 enter_event (scrollbar);
18151834
1816 return FALSE;1835 return FALSE;
1817}1836}
@@ -1827,6 +1846,22 @@
1827 scrollbar = OS_SCROLLBAR (user_data);1846 scrollbar = OS_SCROLLBAR (user_data);
1828 priv = scrollbar->priv;1847 priv = scrollbar->priv;
18291848
1849#ifdef USE_GTK3
1850 /* Gtk+ 3.3.18 emits more GdkEventCrossing
1851 * with touch devices, skip few events.
1852 * Last line skips the event if the pointer is still in the window:
1853 * this happens with touch devices because Gtk+ emits
1854 * GDK_CROSSING_UNGRAB to the touch device, thus calling leave-notify,
1855 * and we want to skip those events.
1856 *
1857 * FIXME the logic of this event should be rewritten. */
1858 if (event->mode == GDK_CROSSING_TOUCH_BEGIN ||
1859 event->mode == GDK_CROSSING_TOUCH_END ||
1860 event->mode == GDK_CROSSING_DEVICE_SWITCH ||
1861 window_at_pointer (event->window, NULL, NULL) == event->window)
1862 return FALSE;
1863#endif
1864
1830 /* When exiting the thumb horizontally (or vertically),1865 /* When exiting the thumb horizontally (or vertically),
1831 * in LOCKED state, remove the lock. */1866 * in LOCKED state, remove the lock. */
1832 if ((priv->state & OS_STATE_LOCKED) &&1867 if ((priv->state & OS_STATE_LOCKED) &&
@@ -1853,6 +1888,8 @@
1853 scrollbar);1888 scrollbar);
1854 }1889 }
18551890
1891 priv->event &= ~(OS_EVENT_ENTER_NOTIFY);
1892
1856 priv->hidable_thumb = TRUE;1893 priv->hidable_thumb = TRUE;
18571894
1858 if (priv->source_hide_thumb_id != 0)1895 if (priv->source_hide_thumb_id != 0)
@@ -1982,6 +2019,14 @@
1982 scrollbar = OS_SCROLLBAR (user_data);2019 scrollbar = OS_SCROLLBAR (user_data);
1983 priv = scrollbar->priv;2020 priv = scrollbar->priv;
19842021
2022#ifdef USE_GTK3
2023 /* On touch devices with XI2 and Gtk+ >= 3.3.18,
2024 * the event enter-notify is not emitted.
2025 * Deal with it in motion-notify. */
2026 if (!(priv->event & OS_EVENT_ENTER_NOTIFY))
2027 enter_event (scrollbar);
2028#endif
2029
1985 if (priv->event & OS_EVENT_BUTTON_PRESS)2030 if (priv->event & OS_EVENT_BUTTON_PRESS)
1986 {2031 {
1987 gint x, y;2032 gint x, y;
19882033
=== modified file 'os/os-thumb.c'
--- os/os-thumb.c 2012-01-18 17:30:27 +0000
+++ os/os-thumb.c 2012-03-13 14:25:23 +0000
@@ -945,6 +945,9 @@
945 thumb = OS_THUMB (widget);945 thumb = OS_THUMB (widget);
946 priv = thumb->priv;946 priv = thumb->priv;
947947
948 /* This event is called more times with Gtk+ 3 and XI2 devices,
949 * let's accept that because the overhead is still minimal. */
950
948 /* If we exit the thumb when a button is pressed,951 /* If we exit the thumb when a button is pressed,
949 * there's no need to stop the animation, it should952 * there's no need to stop the animation, it should
950 * already be stopped.953 * already be stopped.

Subscribers

People subscribed via source and target branches