Merge lp:~cimi/overlay-scrollbar/lock-internal-thumb into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Merged at revision: 194
Proposed branch: lp:~cimi/overlay-scrollbar/lock-internal-thumb
Merge into: lp:overlay-scrollbar
Diff against target: 167 lines (+55/-10)
1 file modified
os/os-scrollbar.c (+55/-10)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/lock-internal-thumb
Reviewer Review Type Date Requested Status
Loïc Molinari (community) Approve
Kalle Valo (community) Approve
Review via email: mp+56371@code.launchpad.net

Description of the change

as in the bugreport, lock the internal thumb after leaving it

To post a comment you must log in.
Revision history for this message
Kalle Valo (kvalo) wrote :

Looks good to me.

review: Approve
Revision history for this message
Loïc Molinari (loic.molinari) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'os/os-scrollbar.c'
2--- os/os-scrollbar.c 2011-04-04 21:29:28 +0000
3+++ os/os-scrollbar.c 2011-04-05 14:16:38 +0000
4@@ -55,11 +55,13 @@
5 gboolean enter_notify_event;
6 gboolean motion_notify_event;
7 gboolean value_changed_event;
8+ gboolean can_deactivate_pager;
9+ gboolean can_hide;
10+ gboolean filter;
11 gboolean fullsize;
12+ gboolean internal;
13+ gboolean lock_position;
14 gboolean proximity;
15- gboolean filter;
16- gboolean can_deactivate_pager;
17- gboolean can_hide;
18 gint win_x;
19 gint win_y;
20 gint slide_initial_slider_position;
21@@ -86,6 +88,7 @@
22 static gboolean os_scrollbar_deactivate_pager_cb (gpointer user_data);
23 static void os_scrollbar_hide_thumb (OsScrollbar *scrollbar);
24 static gboolean os_scrollbar_hide_thumb_cb (gpointer user_data);
25+static gboolean os_scrollbar_unlock_thumb_cb (gpointer user_data);
26 static void os_scrollbar_move (OsScrollbar *scrollbar, gint mouse_x, gint mouse_y);
27 static void os_scrollbar_move_thumb (OsScrollbar *scrollbar, gint x, gint y);
28 static void os_scrollbar_notify_adjustment_cb (GObject *object, gpointer user_data);
29@@ -384,6 +387,23 @@
30 return FALSE;
31 }
32
33+static gboolean
34+os_scrollbar_unlock_thumb_cb (gpointer user_data)
35+{
36+ OsScrollbar *scrollbar = OS_SCROLLBAR (user_data);
37+
38+ OsScrollbarPrivate *priv;
39+
40+ priv = scrollbar->priv;
41+
42+ if (priv->can_hide)
43+ priv->lock_position = FALSE;
44+
45+ g_object_unref (scrollbar);
46+
47+ return FALSE;
48+}
49+
50 static void
51 os_scrollbar_move (OsScrollbar *scrollbar,
52 gint mouse_x,
53@@ -473,7 +493,13 @@
54 if (priv->orientation == GTK_ORIENTATION_VERTICAL &&
55 (n_monitor != gdk_screen_get_monitor_at_point (screen, x - 1 + priv->slider.width, y) ||
56 (x - 1 + priv->slider.width) >= screen_width))
57- return x - DEFAULT_PAGER_WIDTH - priv->slider.width;
58+ {
59+ priv->internal = TRUE;
60+ return x - DEFAULT_PAGER_WIDTH - priv->slider.width;
61+ }
62+
63+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
64+ priv->internal = FALSE;
65
66 return x;
67 }
68@@ -501,7 +527,13 @@
69 if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
70 (n_monitor != gdk_screen_get_monitor_at_point (screen, x, y - 1 + priv->slider.height) ||
71 (y - 1 + priv->slider.height) >= screen_height))
72- return y - DEFAULT_PAGER_WIDTH - priv->slider.height;
73+ {
74+ priv->internal = TRUE;
75+ return y - DEFAULT_PAGER_WIDTH - priv->slider.height;
76+ }
77+
78+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
79+ priv->internal = FALSE;
80
81 return y;
82 }
83@@ -715,6 +747,9 @@
84 priv->can_deactivate_pager = FALSE;
85 priv->can_hide = FALSE;
86
87+ if (priv->internal)
88+ priv->lock_position = TRUE;
89+
90 return FALSE;
91 }
92
93@@ -1057,6 +1092,8 @@
94 if (!priv->enter_notify_event)
95 gtk_widget_hide (GTK_WIDGET (priv->thumb));
96
97+ priv->lock_position = FALSE;
98+
99 os_scrollbar_calc_layout_pager (scrollbar, priv->adjustment->value);
100 os_scrollbar_calc_layout_slider (scrollbar, priv->adjustment->value);
101
102@@ -1102,6 +1139,9 @@
103 {
104 priv->can_hide = FALSE;
105
106+ if (priv->lock_position)
107+ return GDK_FILTER_CONTINUE;
108+
109 if (priv->overlay.height > priv->slider.height)
110 {
111 gint x, y, x_pos, y_pos;
112@@ -1125,6 +1165,7 @@
113 else
114 {
115 priv->can_hide = TRUE;
116+ priv->lock_position = FALSE;
117 os_scrollbar_hide_thumb (scrollbar);
118 }
119 }
120@@ -1137,6 +1178,9 @@
121 {
122 priv->can_hide = FALSE;
123
124+ if (priv->lock_position)
125+ return GDK_FILTER_CONTINUE;
126+
127 if (priv->overlay.width > priv->slider.width)
128 {
129 gint x, y, x_pos, y_pos;
130@@ -1160,15 +1204,12 @@
131 else
132 {
133 priv->can_hide = TRUE;
134+ priv->lock_position = FALSE;
135 os_scrollbar_hide_thumb (scrollbar);
136 }
137 }
138 }
139 }
140- else
141- {
142- return GDK_FILTER_CONTINUE;
143- }
144
145 return GDK_FILTER_CONTINUE;
146 }
147@@ -1192,6 +1233,8 @@
148 g_object_ref (scrollbar));
149 g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, os_scrollbar_hide_thumb_cb,
150 g_object_ref (scrollbar));
151+ g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, os_scrollbar_unlock_thumb_cb,
152+ g_object_ref (scrollbar));
153
154 return FALSE;
155 }
156@@ -1237,9 +1280,11 @@
157
158 priv->can_deactivate_pager = TRUE;
159 priv->can_hide = TRUE;
160+ priv->filter = FALSE;
161 priv->fullsize = FALSE;
162+ priv->internal = FALSE;
163+ priv->lock_position = FALSE;
164 priv->proximity = FALSE;
165- priv->filter = FALSE;
166
167 priv->pager = os_pager_new ();
168

Subscribers

People subscribed via source and target branches