Merge lp:~cimi/overlay-scrollbar/fine-scroll into lp:overlay-scrollbar
- fine-scroll
- Merge into trunk
Proposed by
Andrea Cimitan
Status: | Merged |
---|---|
Approved by: | Ted Gould |
Approved revision: | 287 |
Merged at revision: | 284 |
Proposed branch: | lp:~cimi/overlay-scrollbar/fine-scroll |
Merge into: | lp:overlay-scrollbar |
Diff against target: |
479 lines (+188/-171) 2 files modified
os/os-private.h (+1/-1) os/os-scrollbar.c (+187/-170) |
To merge this branch: | bzr merge lp:~cimi/overlay-scrollbar/fine-scroll |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ted Gould (community) | Approve | ||
Review via email: mp+67079@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 286. By Andrea Cimitan
-
Readd tolerance on pageup/down
- 287. By Andrea Cimitan
-
whitespace
Revision history for this message
Ted Gould (ted) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'os/os-private.h' | |||
2 | --- os/os-private.h 2011-06-27 17:03:25 +0000 | |||
3 | +++ os/os-private.h 2011-07-06 21:03:28 +0000 | |||
4 | @@ -71,7 +71,7 @@ | |||
5 | 71 | } \ | 71 | } \ |
6 | 72 | } G_STMT_END | 72 | } G_STMT_END |
7 | 73 | 73 | ||
9 | 74 | /* Macro loggging an error message to stderr and breaking the program execution | 74 | /* Macro logging an error message to stderr and breaking the program execution |
10 | 75 | * if the assertion fails. */ | 75 | * if the assertion fails. */ |
11 | 76 | #define OS_CHECK(cond) \ | 76 | #define OS_CHECK(cond) \ |
12 | 77 | G_STMT_START { \ | 77 | G_STMT_START { \ |
13 | 78 | 78 | ||
14 | === modified file 'os/os-scrollbar.c' | |||
15 | --- os/os-scrollbar.c 2011-07-05 18:13:09 +0000 | |||
16 | +++ os/os-scrollbar.c 2011-07-06 21:03:28 +0000 | |||
17 | @@ -98,6 +98,7 @@ | |||
18 | 98 | gboolean active_window; | 98 | gboolean active_window; |
19 | 99 | gboolean can_deactivate_pager; | 99 | gboolean can_deactivate_pager; |
20 | 100 | gboolean can_hide; | 100 | gboolean can_hide; |
21 | 101 | gboolean detached_scroll; | ||
22 | 101 | gboolean filter; | 102 | gboolean filter; |
23 | 102 | gboolean fullsize; | 103 | gboolean fullsize; |
24 | 103 | gboolean internal; | 104 | gboolean internal; |
25 | @@ -368,10 +369,7 @@ | |||
26 | 368 | priv = scrollbar->priv; | 369 | priv = scrollbar->priv; |
27 | 369 | 370 | ||
28 | 370 | if (priv->can_hide) | 371 | if (priv->can_hide) |
33 | 371 | { | 372 | gtk_widget_hide (priv->thumb); |
30 | 372 | priv->value_changed_event = FALSE; | ||
31 | 373 | gtk_widget_hide (priv->thumb); | ||
32 | 374 | } | ||
34 | 375 | } | 373 | } |
35 | 376 | 374 | ||
36 | 377 | /* timeout before hiding the thumb */ | 375 | /* timeout before hiding the thumb */ |
37 | @@ -773,19 +771,6 @@ | |||
38 | 773 | gtk_adjustment_set_value (priv->adjustment, new_value); | 771 | gtk_adjustment_set_value (priv->adjustment, new_value); |
39 | 774 | } | 772 | } |
40 | 775 | 773 | ||
41 | 776 | /* stop_func called by the set-scroll animation */ | ||
42 | 777 | static void | ||
43 | 778 | set_scroll_stop_cb (gpointer user_data) | ||
44 | 779 | { | ||
45 | 780 | OsScrollbar *scrollbar; | ||
46 | 781 | OsScrollbarPrivate *priv; | ||
47 | 782 | |||
48 | 783 | scrollbar = OS_SCROLLBAR (user_data); | ||
49 | 784 | priv = scrollbar->priv; | ||
50 | 785 | |||
51 | 786 | priv->value = gtk_adjustment_get_value (priv->adjustment); | ||
52 | 787 | } | ||
53 | 788 | |||
54 | 789 | /* swap adjustment pointer */ | 774 | /* swap adjustment pointer */ |
55 | 790 | static void | 775 | static void |
56 | 791 | swap_adjustment (OsScrollbar *scrollbar, | 776 | swap_adjustment (OsScrollbar *scrollbar, |
57 | @@ -939,6 +924,91 @@ | |||
58 | 939 | move_pager (scrollbar); | 924 | move_pager (scrollbar); |
59 | 940 | } | 925 | } |
60 | 941 | 926 | ||
61 | 927 | /* update the visual connection between pager and thumb. */ | ||
62 | 928 | static void | ||
63 | 929 | update_visual_connection (OsScrollbar *scrollbar) | ||
64 | 930 | { | ||
65 | 931 | OsScrollbarPrivate *priv; | ||
66 | 932 | gint x_pos, y_pos; | ||
67 | 933 | |||
68 | 934 | priv = scrollbar->priv; | ||
69 | 935 | |||
70 | 936 | gdk_window_get_origin (gtk_widget_get_window (priv->thumb), &x_pos, &y_pos); | ||
71 | 937 | |||
72 | 938 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | ||
73 | 939 | { | ||
74 | 940 | if (priv->win_y + priv->overlay.y >= y_pos + priv->slider.height) | ||
75 | 941 | { | ||
76 | 942 | GdkRectangle mask; | ||
77 | 943 | |||
78 | 944 | mask.x = 0; | ||
79 | 945 | mask.y = y_pos + priv->slider.height / 2 - priv->win_y; | ||
80 | 946 | mask.width = priv->pager_all.width; | ||
81 | 947 | mask.height = priv->overlay.y - mask.y; | ||
82 | 948 | |||
83 | 949 | os_pager_connect (priv->pager, mask); | ||
84 | 950 | os_pager_set_detached (priv->pager, TRUE); | ||
85 | 951 | |||
86 | 952 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
87 | 953 | } | ||
88 | 954 | else if (priv->win_y + priv->overlay.y + priv->overlay.height <= y_pos) | ||
89 | 955 | { | ||
90 | 956 | GdkRectangle mask; | ||
91 | 957 | |||
92 | 958 | mask.x = 0; | ||
93 | 959 | mask.y = priv->overlay.y + priv->overlay.height; | ||
94 | 960 | mask.width = priv->pager_all.width; | ||
95 | 961 | mask.height = y_pos + priv->slider.height / 2 - priv->win_y - mask.y; | ||
96 | 962 | |||
97 | 963 | os_pager_connect (priv->pager, mask); | ||
98 | 964 | os_pager_set_detached (priv->pager, TRUE); | ||
99 | 965 | |||
100 | 966 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
101 | 967 | } | ||
102 | 968 | else | ||
103 | 969 | { | ||
104 | 970 | os_pager_set_detached (priv->pager, FALSE); | ||
105 | 971 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); | ||
106 | 972 | } | ||
107 | 973 | } | ||
108 | 974 | else | ||
109 | 975 | { | ||
110 | 976 | if (priv->win_x + priv->overlay.x >= x_pos + priv->slider.width) | ||
111 | 977 | { | ||
112 | 978 | GdkRectangle mask; | ||
113 | 979 | |||
114 | 980 | mask.x = x_pos + priv->slider.width / 2 - priv->win_x; | ||
115 | 981 | mask.y = 0; | ||
116 | 982 | mask.width = priv->overlay.x - mask.x; | ||
117 | 983 | mask.height = priv->pager_all.height; | ||
118 | 984 | |||
119 | 985 | os_pager_connect (priv->pager, mask); | ||
120 | 986 | os_pager_set_detached (priv->pager, TRUE); | ||
121 | 987 | |||
122 | 988 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
123 | 989 | } | ||
124 | 990 | else if (priv->win_x + priv->overlay.x + priv->overlay.width <= x_pos) | ||
125 | 991 | { | ||
126 | 992 | GdkRectangle mask; | ||
127 | 993 | |||
128 | 994 | mask.x = priv->overlay.x + priv->overlay.width; | ||
129 | 995 | mask.y = 0; | ||
130 | 996 | mask.width = x_pos + priv->slider.width / 2 - priv->win_x - mask.x; | ||
131 | 997 | mask.height = priv->pager_all.height; | ||
132 | 998 | |||
133 | 999 | os_pager_connect (priv->pager, mask); | ||
134 | 1000 | os_pager_set_detached (priv->pager, TRUE); | ||
135 | 1001 | |||
136 | 1002 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
137 | 1003 | } | ||
138 | 1004 | else | ||
139 | 1005 | { | ||
140 | 1006 | os_pager_set_detached (priv->pager, FALSE); | ||
141 | 1007 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); | ||
142 | 1008 | } | ||
143 | 1009 | } | ||
144 | 1010 | } | ||
145 | 1011 | |||
146 | 942 | static void | 1012 | static void |
147 | 943 | adjustment_value_changed_cb (GtkAdjustment *adjustment, | 1013 | adjustment_value_changed_cb (GtkAdjustment *adjustment, |
148 | 944 | gpointer user_data) | 1014 | gpointer user_data) |
149 | @@ -964,83 +1034,7 @@ | |||
150 | 964 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); | 1034 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); |
151 | 965 | } | 1035 | } |
152 | 966 | else | 1036 | else |
230 | 967 | { | 1037 | update_visual_connection (scrollbar); |
154 | 968 | gint x_pos, y_pos; | ||
155 | 969 | gdk_window_get_origin (gtk_widget_get_window (priv->thumb), &x_pos, &y_pos); | ||
156 | 970 | |||
157 | 971 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | ||
158 | 972 | { | ||
159 | 973 | if (priv->win_y + priv->overlay.y > y_pos + priv->slider.height) | ||
160 | 974 | { | ||
161 | 975 | GdkRectangle mask; | ||
162 | 976 | |||
163 | 977 | mask.x = 0; | ||
164 | 978 | mask.y = y_pos + priv->slider.height / 2 - priv->win_y; | ||
165 | 979 | mask.width = priv->pager_all.width; | ||
166 | 980 | mask.height = priv->overlay.y - mask.y; | ||
167 | 981 | |||
168 | 982 | os_pager_connect (priv->pager, mask); | ||
169 | 983 | os_pager_set_detached (priv->pager, TRUE); | ||
170 | 984 | |||
171 | 985 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
172 | 986 | } | ||
173 | 987 | else if (priv->win_y + priv->overlay.y + priv->overlay.height < y_pos) | ||
174 | 988 | { | ||
175 | 989 | GdkRectangle mask; | ||
176 | 990 | |||
177 | 991 | mask.x = 0; | ||
178 | 992 | mask.y = priv->overlay.y + priv->overlay.height; | ||
179 | 993 | mask.width = priv->pager_all.width; | ||
180 | 994 | mask.height = y_pos + priv->slider.height / 2 - priv->win_y - mask.y; | ||
181 | 995 | |||
182 | 996 | os_pager_connect (priv->pager, mask); | ||
183 | 997 | os_pager_set_detached (priv->pager, TRUE); | ||
184 | 998 | |||
185 | 999 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
186 | 1000 | } | ||
187 | 1001 | else | ||
188 | 1002 | { | ||
189 | 1003 | os_pager_set_detached (priv->pager, FALSE); | ||
190 | 1004 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); | ||
191 | 1005 | } | ||
192 | 1006 | } | ||
193 | 1007 | else | ||
194 | 1008 | { | ||
195 | 1009 | if (priv->win_x + priv->overlay.x > x_pos + priv->slider.width) | ||
196 | 1010 | { | ||
197 | 1011 | GdkRectangle mask; | ||
198 | 1012 | |||
199 | 1013 | mask.x = x_pos + priv->slider.width / 2 - priv->win_x; | ||
200 | 1014 | mask.y = 0; | ||
201 | 1015 | mask.width = priv->overlay.x - mask.x; | ||
202 | 1016 | mask.height = priv->pager_all.height; | ||
203 | 1017 | |||
204 | 1018 | os_pager_connect (priv->pager, mask); | ||
205 | 1019 | os_pager_set_detached (priv->pager, TRUE); | ||
206 | 1020 | |||
207 | 1021 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
208 | 1022 | } | ||
209 | 1023 | else if (priv->win_x + priv->overlay.x + priv->overlay.width < x_pos) | ||
210 | 1024 | { | ||
211 | 1025 | GdkRectangle mask; | ||
212 | 1026 | |||
213 | 1027 | mask.x = priv->overlay.x + priv->overlay.width; | ||
214 | 1028 | mask.y = 0; | ||
215 | 1029 | mask.width = x_pos + priv->slider.width / 2 - priv->win_x - mask.x; | ||
216 | 1030 | mask.height = priv->pager_all.height; | ||
217 | 1031 | |||
218 | 1032 | os_pager_connect (priv->pager, mask); | ||
219 | 1033 | os_pager_set_detached (priv->pager, TRUE); | ||
220 | 1034 | |||
221 | 1035 | os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE); | ||
222 | 1036 | } | ||
223 | 1037 | else | ||
224 | 1038 | { | ||
225 | 1039 | os_pager_set_detached (priv->pager, FALSE); | ||
226 | 1040 | os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE); | ||
227 | 1041 | } | ||
228 | 1042 | } | ||
229 | 1043 | } | ||
231 | 1044 | } | 1038 | } |
232 | 1045 | 1039 | ||
233 | 1046 | move_pager (scrollbar); | 1040 | move_pager (scrollbar); |
234 | @@ -1257,6 +1251,8 @@ | |||
235 | 1257 | priv->present_time = g_get_monotonic_time (); | 1251 | priv->present_time = g_get_monotonic_time (); |
236 | 1258 | present_gdk_window_with_timestamp (GTK_WIDGET (scrollbar), event->time); | 1252 | present_gdk_window_with_timestamp (GTK_WIDGET (scrollbar), event->time); |
237 | 1259 | 1253 | ||
238 | 1254 | priv->detached_scroll = FALSE; | ||
239 | 1255 | |||
240 | 1260 | priv->button_press_event = TRUE; | 1256 | priv->button_press_event = TRUE; |
241 | 1261 | priv->motion_notify_event = FALSE; | 1257 | priv->motion_notify_event = FALSE; |
242 | 1262 | 1258 | ||
243 | @@ -1352,7 +1348,7 @@ | |||
244 | 1352 | 1348 | ||
245 | 1353 | gtk_window_set_transient_for (GTK_WINDOW (widget), NULL); | 1349 | gtk_window_set_transient_for (GTK_WINDOW (widget), NULL); |
246 | 1354 | 1350 | ||
248 | 1355 | if (!priv->motion_notify_event) | 1351 | if (!priv->motion_notify_event && !priv->detached_scroll) |
249 | 1356 | { | 1352 | { |
250 | 1357 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | 1353 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) |
251 | 1358 | { | 1354 | { |
252 | @@ -1586,46 +1582,6 @@ | |||
253 | 1586 | gtk_adjustment_set_value (priv->adjustment, new_value); | 1582 | gtk_adjustment_set_value (priv->adjustment, new_value); |
254 | 1587 | } | 1583 | } |
255 | 1588 | 1584 | ||
256 | 1589 | /* from pointer movement, store the right adjustment value */ | ||
257 | 1590 | static void | ||
258 | 1591 | capture_movement_for_animation (OsScrollbar *scrollbar, | ||
259 | 1592 | gint mouse_x, | ||
260 | 1593 | gint mouse_y) | ||
261 | 1594 | { | ||
262 | 1595 | OsScrollbarPrivate *priv; | ||
263 | 1596 | gint delta; | ||
264 | 1597 | gint c; | ||
265 | 1598 | gdouble current_value, old_value, new_value; | ||
266 | 1599 | |||
267 | 1600 | priv = scrollbar->priv; | ||
268 | 1601 | |||
269 | 1602 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | ||
270 | 1603 | delta = mouse_y - priv->slide_initial_coordinate; | ||
271 | 1604 | else | ||
272 | 1605 | delta = mouse_x - priv->slide_initial_coordinate; | ||
273 | 1606 | |||
274 | 1607 | c = priv->slide_initial_slider_position + delta; | ||
275 | 1608 | |||
276 | 1609 | current_value = gtk_adjustment_get_value (priv->adjustment); | ||
277 | 1610 | old_value = priv->value; | ||
278 | 1611 | new_value = coord_to_value (scrollbar, c); | ||
279 | 1612 | |||
280 | 1613 | /* stop the animation if we are connecting. */ | ||
281 | 1614 | if ((current_value > old_value && | ||
282 | 1615 | new_value > current_value) || | ||
283 | 1616 | (current_value < old_value && | ||
284 | 1617 | new_value < current_value)) | ||
285 | 1618 | { | ||
286 | 1619 | os_animation_stop (priv->animation, NULL); | ||
287 | 1620 | |||
288 | 1621 | gtk_adjustment_set_value (priv->adjustment, new_value); | ||
289 | 1622 | } | ||
290 | 1623 | |||
291 | 1624 | /* update the adjustment value for the reconnect animation: | ||
292 | 1625 | * set_scroll_cb could be running at that time. */ | ||
293 | 1626 | priv->value = new_value; | ||
294 | 1627 | } | ||
295 | 1628 | |||
296 | 1629 | static gboolean | 1585 | static gboolean |
297 | 1630 | thumb_motion_notify_event_cb (GtkWidget *widget, | 1586 | thumb_motion_notify_event_cb (GtkWidget *widget, |
298 | 1631 | GdkEventMotion *event, | 1587 | GdkEventMotion *event, |
299 | @@ -1641,7 +1597,9 @@ | |||
300 | 1641 | { | 1597 | { |
301 | 1642 | gint x, y; | 1598 | gint x, y; |
302 | 1643 | 1599 | ||
304 | 1644 | /* reconnect slider and overlay after key press */ | 1600 | /* thumb and pager are detached. |
305 | 1601 | * Detached scroll: keep the thumb detached during the scroll, | ||
306 | 1602 | * update the visual connection when reaching an edge. */ | ||
307 | 1645 | if (priv->value_changed_event) | 1603 | if (priv->value_changed_event) |
308 | 1646 | { | 1604 | { |
309 | 1647 | /* return if the mouse movement is small. */ | 1605 | /* return if the mouse movement is small. */ |
310 | @@ -1649,59 +1607,114 @@ | |||
311 | 1649 | abs (priv->pointer_y - event->y) <= TOLERANCE_PIXELS) | 1607 | abs (priv->pointer_y - event->y) <= TOLERANCE_PIXELS) |
312 | 1650 | return FALSE; | 1608 | return FALSE; |
313 | 1651 | 1609 | ||
324 | 1652 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | 1610 | priv->detached_scroll = TRUE; |
315 | 1653 | { | ||
316 | 1654 | priv->slide_initial_slider_position = event->y_root - priv->win_y - event->y; | ||
317 | 1655 | priv->slide_initial_coordinate = event->y_root; | ||
318 | 1656 | } | ||
319 | 1657 | else | ||
320 | 1658 | { | ||
321 | 1659 | priv->slide_initial_slider_position = event->x_root - priv->win_x - event->x; | ||
322 | 1660 | priv->slide_initial_coordinate = event->x_root; | ||
323 | 1661 | } | ||
325 | 1662 | 1611 | ||
326 | 1663 | /* stop the scroll animation if it's running. */ | 1612 | /* stop the scroll animation if it's running. */ |
345 | 1664 | os_animation_stop (priv->animation, set_scroll_stop_cb); | 1613 | os_animation_stop (priv->animation, NULL); |
346 | 1665 | 1614 | ||
347 | 1666 | /* set the initial adjustment value required for reconnect. */ | 1615 | /* limit x and y within the allocation. */ |
330 | 1667 | capture_movement_for_animation (scrollbar, event->x_root, event->y_root); | ||
331 | 1668 | |||
332 | 1669 | /* animate the reconnect, using the same animation object. */ | ||
333 | 1670 | os_animation_start (priv->animation); | ||
334 | 1671 | |||
335 | 1672 | priv->value_changed_event = FALSE; | ||
336 | 1673 | } | ||
337 | 1674 | |||
338 | 1675 | /* only the reconnect animation can be running at that time. */ | ||
339 | 1676 | if (os_animation_is_running (priv->animation)) | ||
340 | 1677 | { | ||
341 | 1678 | /* update the adjustment value. */ | ||
342 | 1679 | capture_movement_for_animation (scrollbar, event->x_root, event->y_root); | ||
343 | 1680 | |||
344 | 1681 | /* limit x and y within the thumb allocation. */ | ||
348 | 1682 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | 1616 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) |
349 | 1683 | { | 1617 | { |
350 | 1684 | x = priv->win_x; | 1618 | x = priv->win_x; |
351 | 1685 | y = CLAMP (event->y_root - priv->pointer_y, | 1619 | y = CLAMP (event->y_root - priv->pointer_y, |
352 | 1686 | priv->win_y, | 1620 | priv->win_y, |
354 | 1687 | priv->win_y + priv->thumb_all.height); | 1621 | priv->win_y + priv->thumb_all.height - priv->slider.height); |
355 | 1688 | } | 1622 | } |
356 | 1689 | else | 1623 | else |
357 | 1690 | { | 1624 | { |
358 | 1691 | x = CLAMP (event->x_root - priv->pointer_x, | 1625 | x = CLAMP (event->x_root - priv->pointer_x, |
359 | 1692 | priv->win_x, | 1626 | priv->win_x, |
361 | 1693 | priv->win_x + priv->thumb_all.width); | 1627 | priv->win_x + priv->thumb_all.width - priv->slider.width); |
362 | 1694 | y = priv->win_y; | 1628 | y = priv->win_y; |
363 | 1695 | } | 1629 | } |
364 | 1696 | 1630 | ||
365 | 1631 | /* fine scroll while detached, | ||
366 | 1632 | * do not scroll when hitting an edge. */ | ||
367 | 1633 | if ((priv->orientation == GTK_ORIENTATION_VERTICAL && | ||
368 | 1634 | y > priv->win_y && | ||
369 | 1635 | y < priv->win_y + priv->thumb_all.height - priv->slider.height) || | ||
370 | 1636 | (priv->orientation == GTK_ORIENTATION_HORIZONTAL && | ||
371 | 1637 | x > priv->win_x && | ||
372 | 1638 | x < priv->win_x + priv->thumb_all.width - priv->slider.width)) | ||
373 | 1639 | capture_movement (scrollbar, event->x_root, event->y_root); | ||
374 | 1640 | |||
375 | 1697 | move_thumb (scrollbar, x, y); | 1641 | move_thumb (scrollbar, x, y); |
376 | 1698 | 1642 | ||
381 | 1699 | /* return if the reconnect animation is still running after | 1643 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) |
382 | 1700 | * capture_movement_for_animation. */ | 1644 | { |
383 | 1701 | if (os_animation_is_running (priv->animation)) | 1645 | if (gtk_adjustment_get_value (priv->adjustment) == 0) |
384 | 1702 | return FALSE; | 1646 | { |
385 | 1647 | update_visual_connection (scrollbar); | ||
386 | 1648 | |||
387 | 1649 | if (priv->overlay.height > priv->slider.height) | ||
388 | 1650 | { | ||
389 | 1651 | priv->slide_initial_slider_position = 0; | ||
390 | 1652 | priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y); | ||
391 | 1653 | } | ||
392 | 1654 | else | ||
393 | 1655 | { | ||
394 | 1656 | priv->slide_initial_slider_position = 0; | ||
395 | 1657 | priv->slide_initial_coordinate = event->y_root; | ||
396 | 1658 | } | ||
397 | 1659 | } | ||
398 | 1660 | else if (priv->overlay.y + priv->overlay.height >= priv->trough.height) | ||
399 | 1661 | { | ||
400 | 1662 | update_visual_connection (scrollbar); | ||
401 | 1663 | |||
402 | 1664 | if (priv->overlay.height > priv->slider.height) | ||
403 | 1665 | { | ||
404 | 1666 | priv->slide_initial_slider_position = priv->trough.height - priv->overlay.height; | ||
405 | 1667 | priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y); | ||
406 | 1668 | } | ||
407 | 1669 | else | ||
408 | 1670 | { | ||
409 | 1671 | priv->slide_initial_slider_position = priv->trough.height - priv->slider.height; | ||
410 | 1672 | priv->slide_initial_coordinate = event->y_root; | ||
411 | 1673 | } | ||
412 | 1674 | } | ||
413 | 1675 | } | ||
414 | 1676 | else | ||
415 | 1677 | { | ||
416 | 1678 | if (gtk_adjustment_get_value (priv->adjustment) == 0) | ||
417 | 1679 | { | ||
418 | 1680 | update_visual_connection (scrollbar); | ||
419 | 1681 | |||
420 | 1682 | if (priv->overlay.width > priv->slider.width) | ||
421 | 1683 | { | ||
422 | 1684 | priv->slide_initial_slider_position = 0; | ||
423 | 1685 | priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x); | ||
424 | 1686 | } | ||
425 | 1687 | else | ||
426 | 1688 | { | ||
427 | 1689 | priv->slide_initial_slider_position = 0; | ||
428 | 1690 | priv->slide_initial_coordinate = event->x_root; | ||
429 | 1691 | } | ||
430 | 1692 | } | ||
431 | 1693 | else if (priv->overlay.x + priv->overlay.width >= priv->trough.width) | ||
432 | 1694 | { | ||
433 | 1695 | update_visual_connection (scrollbar); | ||
434 | 1696 | |||
435 | 1697 | if (priv->overlay.width > priv->slider.width) | ||
436 | 1698 | { | ||
437 | 1699 | priv->slide_initial_slider_position = priv->trough.width - priv->overlay.width; | ||
438 | 1700 | priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x); | ||
439 | 1701 | } | ||
440 | 1702 | else | ||
441 | 1703 | { | ||
442 | 1704 | priv->slide_initial_slider_position = priv->trough.width - priv->slider.width; | ||
443 | 1705 | priv->slide_initial_coordinate = event->x_root; | ||
444 | 1706 | } | ||
445 | 1707 | } | ||
446 | 1708 | } | ||
447 | 1709 | |||
448 | 1710 | return FALSE; | ||
449 | 1703 | } | 1711 | } |
450 | 1704 | 1712 | ||
451 | 1713 | OS_DCHECK (!priv->detached_scroll); | ||
452 | 1714 | |||
453 | 1715 | /* thumb and pager are connected. | ||
454 | 1716 | * Normal scroll: keep the thumb in sync with the pager, | ||
455 | 1717 | * do not update the visual connection. */ | ||
456 | 1705 | priv->motion_notify_event = TRUE; | 1718 | priv->motion_notify_event = TRUE; |
457 | 1706 | 1719 | ||
458 | 1707 | capture_movement (scrollbar, event->x_root, event->y_root); | 1720 | capture_movement (scrollbar, event->x_root, event->y_root); |
459 | @@ -1821,9 +1834,12 @@ | |||
460 | 1821 | scrollbar = OS_SCROLLBAR (user_data); | 1834 | scrollbar = OS_SCROLLBAR (user_data); |
461 | 1822 | priv = scrollbar->priv; | 1835 | priv = scrollbar->priv; |
462 | 1823 | 1836 | ||
463 | 1837 | priv->detached_scroll = FALSE; | ||
464 | 1838 | |||
465 | 1824 | priv->button_press_event = FALSE; | 1839 | priv->button_press_event = FALSE; |
466 | 1825 | priv->motion_notify_event = FALSE; | 1840 | priv->motion_notify_event = FALSE; |
467 | 1826 | priv->enter_notify_event = FALSE; | 1841 | priv->enter_notify_event = FALSE; |
468 | 1842 | priv->value_changed_event = FALSE; | ||
469 | 1827 | 1843 | ||
470 | 1828 | os_pager_set_detached (priv->pager, FALSE); | 1844 | os_pager_set_detached (priv->pager, FALSE); |
471 | 1829 | } | 1845 | } |
472 | @@ -2563,6 +2579,7 @@ | |||
473 | 2563 | priv->active_window = FALSE; | 2579 | priv->active_window = FALSE; |
474 | 2564 | priv->can_deactivate_pager = TRUE; | 2580 | priv->can_deactivate_pager = TRUE; |
475 | 2565 | priv->can_hide = TRUE; | 2581 | priv->can_hide = TRUE; |
476 | 2582 | priv->detached_scroll = FALSE; | ||
477 | 2566 | priv->filter = FALSE; | 2583 | priv->filter = FALSE; |
478 | 2567 | priv->fullsize = FALSE; | 2584 | priv->fullsize = FALSE; |
479 | 2568 | priv->internal = FALSE; | 2585 | priv->internal = FALSE; |