Merge lp:~cimi/overlay-scrollbar/proximity-separate-function into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~cimi/overlay-scrollbar/proximity-separate-function
Merge into: lp:overlay-scrollbar
Diff against target: 969 lines (+176/-208)
4 files modified
os/os-pager.c (+1/-1)
os/os-private.h (+4/-4)
os/os-scrollbar.c (+169/-195)
os/os-thumb.c (+2/-8)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/proximity-separate-function
Reviewer Review Type Date Requested Status
Ayatana Scrollbar Team Pending
Review via email: mp+64684@code.launchpad.net

This proposal has been superseded by a proposal from 2011-06-15.

Description of the change

fork of lp:~cimi/ayatana-scrollbar/various-namings-and-refactoring, this branch contains a separate proximity function that can be easily extended to support scrollbars on other sides of the scrolled window

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'os/os-pager.c'
--- os/os-pager.c 2011-06-12 23:21:09 +0000
+++ os/os-pager.c 2011-06-15 13:28:34 +0000
@@ -315,7 +315,7 @@
315 *315 *
316 * Returns: the new #OsPager instance.316 * Returns: the new #OsPager instance.
317 */317 */
318GObject*318OsPager*
319os_pager_new (void)319os_pager_new (void)
320{320{
321 return g_object_new (OS_TYPE_PAGER, NULL);321 return g_object_new (OS_TYPE_PAGER, NULL);
322322
=== modified file 'os/os-private.h'
--- os/os-private.h 2011-06-10 10:32:53 +0000
+++ os/os-private.h 2011-06-15 13:28:34 +0000
@@ -30,9 +30,9 @@
30#pragma GCC visibility push(hidden)30#pragma GCC visibility push(hidden)
31#endif /* __GNUC__ */31#endif /* __GNUC__ */
3232
33/* Default size of the thumb in pixels. */33/* Size of the thumb in pixels. */
34#define DEFAULT_THUMB_WIDTH 1734#define THUMB_WIDTH 17
35#define DEFAULT_THUMB_HEIGHT 6935#define THUMB_HEIGHT 69
3636
37G_BEGIN_DECLS37G_BEGIN_DECLS
3838
@@ -208,7 +208,7 @@
208208
209GType os_pager_get_type (void) G_GNUC_CONST;209GType os_pager_get_type (void) G_GNUC_CONST;
210210
211GObject* os_pager_new (void);211OsPager* os_pager_new (void);
212212
213void os_pager_hide (OsPager *overlay);213void os_pager_hide (OsPager *overlay);
214214
215215
=== modified file 'os/os-scrollbar.c'
--- os/os-scrollbar.c 2011-06-14 17:20:10 +0000
+++ os/os-scrollbar.c 2011-06-15 13:28:34 +0000
@@ -32,14 +32,14 @@
32#include <X11/extensions/XInput2.h>32#include <X11/extensions/XInput2.h>
33#include "math.h"33#include "math.h"
3434
35/* Default size of the pager in pixels. */35/* Size of the pager in pixels. */
36#define DEFAULT_PAGER_WIDTH 336#define PAGER_SIZE 3
3737
38/* Default thumb allocation shift in pixels. */38/* Thumb allocation shift in pixels. */
39#define THUMB_ALLOCATION_SHIFT -339#define THUMB_ALLOCATION_SHIFT -3
4040
41/* Width of the proximity effect in pixels. */41/* Size of the proximity effect in pixels. */
42#define PROXIMITY_WIDTH 3042#define PROXIMITY_SIZE 30
4343
44/* Timeout assumed for PropertyNotify _NET_ACTIVE_WINDOW event. */44/* Timeout assumed for PropertyNotify _NET_ACTIVE_WINDOW event. */
45#define TIMEOUT_PRESENT_WINDOW 40045#define TIMEOUT_PRESENT_WINDOW 400
@@ -50,18 +50,26 @@
50/* Timeout before hiding in ms, after leaving the toplevel. */50/* Timeout before hiding in ms, after leaving the toplevel. */
51#define TIMEOUT_TOPLEVEL_HIDE 20051#define TIMEOUT_TOPLEVEL_HIDE 200
5252
53typedef enum
54{
55 OS_SIDE_TOP,
56 OS_SIDE_BOTTOM,
57 OS_SIDE_LEFT,
58 OS_SIDE_RIGHT
59} OsSide;
60
53struct _OsScrollbarPrivate61struct _OsScrollbarPrivate
54{62{
55 GdkRectangle trough;63 GdkRectangle trough;
56 GdkRectangle overlay;64 GdkRectangle overlay;
57 GdkRectangle slider;65 GdkRectangle slider;
58 GtkAllocation overlay_all;66 GtkAllocation pager_all;
59 GtkAllocation thumb_all;67 GtkAllocation thumb_all;
60 GObject *pager;
61 GtkWidget *thumb;68 GtkWidget *thumb;
62 GtkAdjustment *adjustment;69 GtkAdjustment *adjustment;
63 GtkOrientation orientation;70 GtkOrientation orientation;
64 GtkWindowGroup *window_group;71 GtkWindowGroup *window_group;
72 OsPager *pager;
65 gboolean button_press_event;73 gboolean button_press_event;
66 gboolean enter_notify_event;74 gboolean enter_notify_event;
67 gboolean motion_notify_event;75 gboolean motion_notify_event;
@@ -137,74 +145,56 @@
137145
138 if (priv->orientation == GTK_ORIENTATION_VERTICAL)146 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
139 {147 {
140 gint y, bottom, top, height;148 gint y, trough_length, height;
141149
142 top = priv->trough.y;150 trough_length = priv->trough.height;
143 bottom = priv->trough.y + priv->trough.height;
144
145 /* overlay height is the fraction (page_size /
146 * total_adjustment_range) times the trough height in pixels
147 */
148151
149 if (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment) != 0)152 if (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment) != 0)
150 height = ((bottom - top) * (gtk_adjustment_get_page_size (priv->adjustment) /153 height = (trough_length * (gtk_adjustment_get_page_size (priv->adjustment) /
151 (gtk_adjustment_get_upper (priv->adjustment) - 154 (gtk_adjustment_get_upper (priv->adjustment) -
152 gtk_adjustment_get_lower (priv->adjustment))));155 gtk_adjustment_get_lower (priv->adjustment))));
153 else156 else
154 height = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));157 height = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));
155158
156 height = MAX (height, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));159 height = MAX (height, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));
157160
158 height = MIN (height, priv->trough.height);
159
160 y = top;
161
162 if (gtk_adjustment_get_upper (priv->adjustment) -161 if (gtk_adjustment_get_upper (priv->adjustment) -
163 gtk_adjustment_get_lower (priv->adjustment) -162 gtk_adjustment_get_lower (priv->adjustment) -
164 gtk_adjustment_get_page_size (priv->adjustment) != 0)163 gtk_adjustment_get_page_size (priv->adjustment) != 0)
165 y += (bottom - top - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /164 y = (trough_length - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
166 (gtk_adjustment_get_upper (priv->adjustment) -165 (gtk_adjustment_get_upper (priv->adjustment) -
167 gtk_adjustment_get_lower (priv->adjustment) -166 gtk_adjustment_get_lower (priv->adjustment) -
168 gtk_adjustment_get_page_size (priv->adjustment)));167 gtk_adjustment_get_page_size (priv->adjustment)));
169168
170 y = CLAMP (y, top, bottom);169 y = CLAMP (y, 0, trough_length);
171170
172 priv->overlay.y = y;171 priv->overlay.y = y;
173 priv->overlay.height = height;172 priv->overlay.height = height;
174 }173 }
175 else174 else
176 {175 {
177 gint x, left, right, width;176 gint x, trough_length, width;
178177
179 left = priv->trough.x;178 trough_length = priv->trough.width;
180 right = priv->trough.x + priv->trough.width;
181
182 /* overlay width is the fraction (page_size /
183 * total_adjustment_range) times the trough width in pixels
184 */
185179
186 if (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment) != 0)180 if (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment) != 0)
187 width = ((right - left) * (gtk_adjustment_get_page_size (priv->adjustment) /181 width = (trough_length * (gtk_adjustment_get_page_size (priv->adjustment) /
188 (gtk_adjustment_get_upper (priv->adjustment) -182 (gtk_adjustment_get_upper (priv->adjustment) -
189 gtk_adjustment_get_lower (priv->adjustment))));183 gtk_adjustment_get_lower (priv->adjustment))));
190 else184 else
191 width = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));185 width = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));
192186
193 width = MAX (width, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));187 width = MAX (width, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));
194188
195 width = MIN (width, priv->trough.width);
196
197 x = left;
198
199 if (gtk_adjustment_get_upper (priv->adjustment) -189 if (gtk_adjustment_get_upper (priv->adjustment) -
200 gtk_adjustment_get_lower (priv->adjustment) -190 gtk_adjustment_get_lower (priv->adjustment) -
201 gtk_adjustment_get_page_size (priv->adjustment) != 0)191 gtk_adjustment_get_page_size (priv->adjustment) != 0)
202 x += (right - left - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /192 x = (trough_length - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
203 (gtk_adjustment_get_upper (priv->adjustment) -193 (gtk_adjustment_get_upper (priv->adjustment) -
204 gtk_adjustment_get_lower (priv->adjustment) -194 gtk_adjustment_get_lower (priv->adjustment) -
205 gtk_adjustment_get_page_size (priv->adjustment)));195 gtk_adjustment_get_page_size (priv->adjustment)));
206196
207 x = CLAMP (x, left, right);197 x = CLAMP (x, 0, trough_length);
208198
209 priv->overlay.x = x;199 priv->overlay.x = x;
210 priv->overlay.width = width;200 priv->overlay.width = width;
@@ -222,52 +212,40 @@
222212
223 if (priv->orientation == GTK_ORIENTATION_VERTICAL)213 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
224 {214 {
225 gint y, bottom, top, height;215 gint y, trough_length, height;
226216
227 top = priv->trough.y;217 trough_length = priv->trough.height;
228 bottom = priv->trough.y + priv->trough.height;
229
230 height = priv->slider.height;218 height = priv->slider.height;
231219
232 height = MIN (height, priv->trough.height);
233
234 y = top;
235
236 if (gtk_adjustment_get_upper (priv->adjustment) -220 if (gtk_adjustment_get_upper (priv->adjustment) -
237 gtk_adjustment_get_lower (priv->adjustment) -221 gtk_adjustment_get_lower (priv->adjustment) -
238 gtk_adjustment_get_page_size (priv->adjustment) != 0)222 gtk_adjustment_get_page_size (priv->adjustment) != 0)
239 y += (bottom - top - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /223 y = (trough_length - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
240 (gtk_adjustment_get_upper (priv->adjustment) -224 (gtk_adjustment_get_upper (priv->adjustment) -
241 gtk_adjustment_get_lower (priv->adjustment) -225 gtk_adjustment_get_lower (priv->adjustment) -
242 gtk_adjustment_get_page_size (priv->adjustment)));226 gtk_adjustment_get_page_size (priv->adjustment)));
243227
244 y = CLAMP (y, top, bottom);228 y = CLAMP (y, 0, trough_length);
245229
246 priv->slider.y = y;230 priv->slider.y = y;
247 priv->slider.height = height;231 priv->slider.height = height;
248 }232 }
249 else233 else
250 {234 {
251 gint x, left, right, width;235 gint x, trough_length, width;
252236
253 left = priv->trough.x;237 trough_length = priv->trough.width;
254 right = priv->trough.x + priv->trough.width;
255
256 width = priv->slider.width;238 width = priv->slider.width;
257239
258 width = MIN (width, priv->trough.width);
259
260 x = left;
261
262 if (gtk_adjustment_get_upper (priv->adjustment) -240 if (gtk_adjustment_get_upper (priv->adjustment) -
263 gtk_adjustment_get_lower (priv->adjustment) -241 gtk_adjustment_get_lower (priv->adjustment) -
264 gtk_adjustment_get_page_size (priv->adjustment) != 0)242 gtk_adjustment_get_page_size (priv->adjustment) != 0)
265 x += (right - left - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /243 x = (trough_length - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
266 (gtk_adjustment_get_upper (priv->adjustment) -244 (gtk_adjustment_get_upper (priv->adjustment) -
267 gtk_adjustment_get_lower (priv->adjustment) -245 gtk_adjustment_get_lower (priv->adjustment) -
268 gtk_adjustment_get_page_size (priv->adjustment)));246 gtk_adjustment_get_page_size (priv->adjustment)));
269247
270 x = CLAMP (x, left, right);248 x = CLAMP (x, 0, trough_length);
271249
272 priv->slider.x = x;250 priv->slider.x = x;
273 priv->slider.width = width;251 priv->slider.width = width;
@@ -333,7 +311,7 @@
333 priv = scrollbar->priv;311 priv = scrollbar->priv;
334312
335 if (priv->pager != NULL && priv->can_deactivate_pager)313 if (priv->pager != NULL && priv->can_deactivate_pager)
336 os_pager_set_active (OS_PAGER (priv->pager), FALSE, TRUE);314 os_pager_set_active (priv->pager, FALSE, TRUE);
337}315}
338316
339/* timeout before deactivating the pager */317/* timeout before deactivating the pager */
@@ -365,7 +343,7 @@
365 if (priv->can_hide)343 if (priv->can_hide)
366 {344 {
367 priv->value_changed_event = FALSE;345 priv->value_changed_event = FALSE;
368 gtk_widget_hide (GTK_WIDGET (priv->thumb));346 gtk_widget_hide (priv->thumb);
369 }347 }
370}348}
371349
@@ -398,7 +376,7 @@
398 {376 {
399 mask.x = 0;377 mask.x = 0;
400 mask.y = priv->overlay.y;378 mask.y = priv->overlay.y;
401 mask.width = DEFAULT_PAGER_WIDTH;379 mask.width = priv->pager_all.width;
402 mask.height = priv->overlay.height;380 mask.height = priv->overlay.height;
403 }381 }
404 else382 else
@@ -406,10 +384,10 @@
406 mask.x = priv->overlay.x;384 mask.x = priv->overlay.x;
407 mask.y = 0;385 mask.y = 0;
408 mask.width = priv->overlay.width;386 mask.width = priv->overlay.width;
409 mask.height = DEFAULT_PAGER_WIDTH;387 mask.height = priv->pager_all.height;
410 }388 }
411389
412 os_pager_move_resize (OS_PAGER (priv->pager), mask);390 os_pager_move_resize (priv->pager, mask);
413}391}
414392
415/* sanitize x coordinate of thumb window */393/* sanitize x coordinate of thumb window */
@@ -463,7 +441,7 @@
463441
464 if (priv->orientation == GTK_ORIENTATION_VERTICAL &&442 if (priv->orientation == GTK_ORIENTATION_VERTICAL &&
465 (n_monitor != gdk_screen_get_monitor_at_point (screen, x - 1 + priv->slider.width, y) ||443 (n_monitor != gdk_screen_get_monitor_at_point (screen, x - 1 + priv->slider.width, y) ||
466 (x - 1 + priv->slider.width) >= screen_width))444 x - 1 + priv->slider.width >= screen_width))
467 {445 {
468 priv->internal = TRUE;446 priv->internal = TRUE;
469 return MAX (x - priv->slider.width, screen_width - priv->slider.width);447 return MAX (x - priv->slider.width, screen_width - priv->slider.width);
@@ -526,7 +504,7 @@
526504
527 if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&505 if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
528 (n_monitor != gdk_screen_get_monitor_at_point (screen, x, y - 1 + priv->slider.height) ||506 (n_monitor != gdk_screen_get_monitor_at_point (screen, x, y - 1 + priv->slider.height) ||
529 (y - 1 + priv->slider.height) >= screen_height))507 y - 1 + priv->slider.height >= screen_height))
530 {508 {
531 priv->internal = TRUE;509 priv->internal = TRUE;
532 return MAX (y - priv->slider.height, screen_height - priv->slider.height);510 return MAX (y - priv->slider.height, screen_height - priv->slider.height);
@@ -707,19 +685,19 @@
707 * hidden a pager that is meant to be hidden/shown.685 * hidden a pager that is meant to be hidden/shown.
708 * I don't want to see pagers reappearing because686 * I don't want to see pagers reappearing because
709 * of a change in the adjustment of an invisible pager or viceversa. */687 * of a change in the adjustment of an invisible pager or viceversa. */
710 if ((gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) >688 if (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment) >
711 gtk_adjustment_get_page_size (adjustment))689 gtk_adjustment_get_page_size (adjustment))
712 {690 {
713 priv->fullsize = FALSE;691 priv->fullsize = FALSE;
714 if (priv->proximity != FALSE)692 if (priv->proximity != FALSE)
715 os_pager_show (OS_PAGER (priv->pager));693 os_pager_show (priv->pager);
716 }694 }
717 else695 else
718 {696 {
719 priv->fullsize = TRUE;697 priv->fullsize = TRUE;
720 if (priv->proximity != FALSE)698 if (priv->proximity != FALSE)
721 {699 {
722 os_pager_hide (OS_PAGER (priv->pager));700 os_pager_hide (priv->pager);
723701
724 gtk_widget_hide (priv->thumb);702 gtk_widget_hide (priv->thumb);
725 }703 }
@@ -729,7 +707,7 @@
729 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));707 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));
730708
731 if (!priv->motion_notify_event && !priv->enter_notify_event)709 if (!priv->motion_notify_event && !priv->enter_notify_event)
732 gtk_widget_hide (GTK_WIDGET (priv->thumb));710 gtk_widget_hide (priv->thumb);
733711
734 move_pager (scrollbar);712 move_pager (scrollbar);
735}713}
@@ -748,20 +726,20 @@
748 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));726 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));
749727
750 if (!priv->motion_notify_event && !priv->enter_notify_event)728 if (!priv->motion_notify_event && !priv->enter_notify_event)
751 gtk_widget_hide (GTK_WIDGET (priv->thumb));729 gtk_widget_hide (priv->thumb);
752730
753 if (gtk_widget_get_mapped (GTK_WIDGET (priv->thumb)))731 if (gtk_widget_get_mapped (priv->thumb))
754 {732 {
755 /* if we're dragging the thumb, it can't be detached. */733 /* if we're dragging the thumb, it can't be detached. */
756 if (priv->motion_notify_event)734 if (priv->motion_notify_event)
757 {735 {
758 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);736 os_pager_set_detached (priv->pager, FALSE);
759 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);737 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
760 }738 }
761 else739 else
762 {740 {
763 gint x_pos, y_pos;741 gint x_pos, y_pos;
764 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (priv->thumb)), &x_pos, &y_pos);742 gdk_window_get_origin (gtk_widget_get_window (priv->thumb), &x_pos, &y_pos);
765743
766 if (priv->orientation == GTK_ORIENTATION_VERTICAL)744 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
767 {745 {
@@ -771,11 +749,11 @@
771749
772 mask.x = 0;750 mask.x = 0;
773 mask.y = y_pos + priv->slider.height / 2 - priv->win_y;751 mask.y = y_pos + priv->slider.height / 2 - priv->win_y;
774 mask.width = DEFAULT_PAGER_WIDTH;752 mask.width = priv->pager_all.width;
775 mask.height = priv->overlay.y - mask.y;753 mask.height = priv->overlay.y - mask.y;
776754
777 os_pager_connect (OS_PAGER (priv->pager), mask);755 os_pager_connect (priv->pager, mask);
778 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);756 os_pager_set_detached (priv->pager, TRUE);
779757
780 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);758 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);
781 }759 }
@@ -785,17 +763,17 @@
785763
786 mask.x = 0;764 mask.x = 0;
787 mask.y = priv->overlay.y + priv->overlay.height;765 mask.y = priv->overlay.y + priv->overlay.height;
788 mask.width = DEFAULT_PAGER_WIDTH;766 mask.width = priv->pager_all.width;
789 mask.height = y_pos + priv->slider.height / 2 - priv->win_y - mask.y;767 mask.height = y_pos + priv->slider.height / 2 - priv->win_y - mask.y;
790768
791 os_pager_connect (OS_PAGER (priv->pager), mask);769 os_pager_connect (priv->pager, mask);
792 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);770 os_pager_set_detached (priv->pager, TRUE);
793771
794 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);772 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);
795 }773 }
796 else 774 else
797 {775 {
798 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);776 os_pager_set_detached (priv->pager, FALSE);
799 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);777 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
800 }778 }
801 }779 }
@@ -808,10 +786,10 @@
808 mask.x = x_pos + priv->slider.width / 2 - priv->win_x;786 mask.x = x_pos + priv->slider.width / 2 - priv->win_x;
809 mask.y = 0;787 mask.y = 0;
810 mask.width = priv->overlay.x - mask.x;788 mask.width = priv->overlay.x - mask.x;
811 mask.height = DEFAULT_PAGER_WIDTH;789 mask.height = priv->pager_all.height;
812790
813 os_pager_connect (OS_PAGER (priv->pager), mask);791 os_pager_connect (priv->pager, mask);
814 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);792 os_pager_set_detached (priv->pager, TRUE);
815793
816 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);794 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);
817 }795 }
@@ -822,14 +800,14 @@
822 mask.x = priv->overlay.y + priv->overlay.height;800 mask.x = priv->overlay.y + priv->overlay.height;
823 mask.y = 0;801 mask.y = 0;
824 mask.width = x_pos + priv->slider.width / 2 - priv->win_x - mask.x;802 mask.width = x_pos + priv->slider.width / 2 - priv->win_x - mask.x;
825 mask.height = DEFAULT_PAGER_WIDTH;803 mask.height = priv->pager_all.height;
826804
827 os_pager_connect (OS_PAGER (priv->pager), mask);805 os_pager_connect (priv->pager, mask);
828 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);806 os_pager_set_detached (priv->pager, TRUE);
829 }807 }
830 else808 else
831 {809 {
832 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);810 os_pager_set_detached (priv->pager, FALSE);
833 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);811 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
834 }812 }
835 }813 }
@@ -860,12 +838,12 @@
860 (y > allocation.y && y < allocation.y + allocation.height))838 (y > allocation.y && y < allocation.y + allocation.height))
861 {839 {
862 priv->can_deactivate_pager = FALSE;840 priv->can_deactivate_pager = FALSE;
863 os_pager_set_active (OS_PAGER (priv->pager), TRUE, TRUE);841 os_pager_set_active (priv->pager, TRUE, TRUE);
864 }842 }
865 else843 else
866 {844 {
867 priv->can_deactivate_pager = TRUE;845 priv->can_deactivate_pager = TRUE;
868 os_pager_set_active (OS_PAGER (priv->pager), FALSE, TRUE);846 os_pager_set_active (priv->pager, FALSE, TRUE);
869 }847 }
870}848}
871849
@@ -899,7 +877,7 @@
899 priv->active_window = TRUE;877 priv->active_window = TRUE;
900878
901 priv->can_deactivate_pager = FALSE;879 priv->can_deactivate_pager = FALSE;
902 os_pager_set_active (OS_PAGER (priv->pager), TRUE, TRUE);880 os_pager_set_active (priv->pager, TRUE, TRUE);
903 }881 }
904 else if (priv->active_window)882 else if (priv->active_window)
905 {883 {
@@ -938,7 +916,7 @@
938 {916 {
939 /* if the pointer is outside of the window, set it inactive. */917 /* if the pointer is outside of the window, set it inactive. */
940 priv->can_deactivate_pager = TRUE;918 priv->can_deactivate_pager = TRUE;
941 os_pager_set_active (OS_PAGER (priv->pager), FALSE, TRUE);919 os_pager_set_active (priv->pager, FALSE, TRUE);
942 }920 }
943921
944 if ((current_time > end_time) && priv->thumb != NULL)922 if ((current_time > end_time) && priv->thumb != NULL)
@@ -1196,7 +1174,7 @@
11961174
1197 /* immediately set the pager to be active. */1175 /* immediately set the pager to be active. */
1198 priv->can_deactivate_pager = FALSE;1176 priv->can_deactivate_pager = FALSE;
1199 os_pager_set_active (OS_PAGER (priv->pager), TRUE, FALSE);1177 os_pager_set_active (priv->pager, TRUE, FALSE);
12001178
1201 xid = GDK_WINDOW_XID (gtk_widget_get_window (widget));1179 xid = GDK_WINDOW_XID (gtk_widget_get_window (widget));
1202 xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (scrollbar)));1180 xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (scrollbar)));
@@ -1267,7 +1245,6 @@
1267 gdouble frac;1245 gdouble frac;
1268 gdouble value;1246 gdouble value;
1269 gint trough_length;1247 gint trough_length;
1270 gint trough_start;
1271 gint slider_length;1248 gint slider_length;
12721249
1273 priv = scrollbar->priv;1250 priv = scrollbar->priv;
@@ -1275,21 +1252,18 @@
1275 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1252 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1276 {1253 {
1277 trough_length = priv->trough.height;1254 trough_length = priv->trough.height;
1278 trough_start = priv->trough.y;
1279 slider_length = MAX (priv->slider.height, priv->overlay.height);1255 slider_length = MAX (priv->slider.height, priv->overlay.height);
1280 }1256 }
1281 else1257 else
1282 {1258 {
1283 trough_length = priv->trough.width;1259 trough_length = priv->trough.width;
1284 trough_start = priv->trough.y;
1285 slider_length = MAX (priv->slider.width, priv->overlay.width);1260 slider_length = MAX (priv->slider.width, priv->overlay.width);
1286 }1261 }
12871262
1288 if (trough_length == slider_length)1263 if (trough_length == slider_length)
1289 frac = 1.0;1264 frac = 1.0;
1290 else1265 else
1291 frac = (MAX (0, coord - trough_start) /1266 frac = (MAX (0, coord) / (gdouble) (trough_length - slider_length));
1292 (gdouble) (trough_length - slider_length));
12931267
1294 value = gtk_adjustment_get_lower (priv->adjustment) + frac * (gtk_adjustment_get_upper (priv->adjustment) -1268 value = gtk_adjustment_get_lower (priv->adjustment) + frac * (gtk_adjustment_get_upper (priv->adjustment) -
1295 gtk_adjustment_get_lower (priv->adjustment) -1269 gtk_adjustment_get_lower (priv->adjustment) -
@@ -1357,7 +1331,7 @@
1357 }1331 }
13581332
1359 /* FIXME(Cimi) seems useless. */1333 /* FIXME(Cimi) seems useless. */
1360 capture_movement (scrollbar, event->x_root, event->y_root);1334// capture_movement (scrollbar, event->x_root, event->y_root);
1361 priv->value_changed_event = FALSE;1335 priv->value_changed_event = FALSE;
1362 }1336 }
13631337
@@ -1379,9 +1353,9 @@
1379 priv->slide_initial_slider_position = 0;1353 priv->slide_initial_slider_position = 0;
1380 priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y);1354 priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y);
1381 }1355 }
1382 else if (priv->overlay.y + priv->overlay.height >= priv->trough.y + priv->trough.height)1356 else if (priv->overlay.y + priv->overlay.height >= priv->trough.height)
1383 {1357 {
1384 priv->slide_initial_slider_position = priv->trough.y + priv->trough.height - priv->overlay.height;1358 priv->slide_initial_slider_position = priv->trough.height - priv->overlay.height;
1385 priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y);1359 priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y);
1386 }1360 }
1387 }1361 }
@@ -1405,9 +1379,9 @@
1405 priv->slide_initial_slider_position = 0;1379 priv->slide_initial_slider_position = 0;
1406 priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x);1380 priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x);
1407 }1381 }
1408 else if (priv->overlay.x + priv->overlay.width >= priv->trough.x + priv->trough.width)1382 else if (priv->overlay.x + priv->overlay.width >= priv->trough.width)
1409 {1383 {
1410 priv->slide_initial_slider_position = priv->trough.x + priv->trough.width - priv->overlay.width;1384 priv->slide_initial_slider_position = priv->trough.width - priv->overlay.width;
1411 priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x);1385 priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x);
1412 }1386 }
1413 }1387 }
@@ -1482,7 +1456,7 @@
1482 priv->motion_notify_event = FALSE;1456 priv->motion_notify_event = FALSE;
1483 priv->enter_notify_event = FALSE;1457 priv->enter_notify_event = FALSE;
14841458
1485 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);1459 os_pager_set_detached (priv->pager, FALSE);
1486}1460}
14871461
1488/* toplevel functions */1462/* toplevel functions */
@@ -1492,24 +1466,16 @@
1492store_toplevel_position (OsScrollbar *scrollbar)1466store_toplevel_position (OsScrollbar *scrollbar)
1493{1467{
1494 OsScrollbarPrivate *priv;1468 OsScrollbarPrivate *priv;
1495 gint win_x, win_y;1469 gint x_pos, y_pos;
14961470
1497 priv = scrollbar->priv;1471 priv = scrollbar->priv;
14981472
1499 /* In reality, I'm storing widget's window, not the toplevel.1473 /* In reality, I'm storing widget's window, not the toplevel.
1500 * Is that the same with gdk_window_get_origin? */1474 * Is that the same with gdk_window_get_origin? */
1501 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &win_x, &win_y);1475 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
15021476
1503 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1477 priv->win_x = x_pos + priv->thumb_all.x;
1504 {1478 priv->win_y = y_pos + priv->thumb_all.y;
1505 priv->win_x = win_x + priv->thumb_all.x;
1506 priv->win_y = win_y + priv->thumb_all.y;
1507 }
1508 else
1509 {
1510 priv->win_x = win_x + priv->thumb_all.x;
1511 priv->win_y = win_y + priv->thumb_all.y;
1512 }
1513}1479}
15141480
1515static gboolean1481static gboolean
@@ -1560,12 +1526,12 @@
1560 else1526 else
1561 {1527 {
1562 priv->can_deactivate_pager = FALSE;1528 priv->can_deactivate_pager = FALSE;
1563 os_pager_set_active (OS_PAGER (priv->pager), TRUE, TRUE);1529 os_pager_set_active (priv->pager, TRUE, TRUE);
1564 }1530 }
1565 }1531 }
15661532
1567 if (current_time > end_time)1533 if (current_time > end_time)
1568 gtk_widget_hide (GTK_WIDGET (priv->thumb));1534 gtk_widget_hide (priv->thumb);
15691535
1570 priv->lock_position = FALSE;1536 priv->lock_position = FALSE;
15711537
@@ -1577,6 +1543,41 @@
1577 return FALSE;1543 return FALSE;
1578}1544}
15791545
1546/* checks if the pointer is in the proximity area. */
1547static gboolean
1548check_proximity (OsScrollbar *scrollbar,
1549 gint x,
1550 gint y,
1551 OsSide side)
1552{
1553 OsScrollbarPrivate *priv;
1554
1555 priv = scrollbar->priv;
1556
1557 switch (side)
1558 {
1559 case OS_SIDE_RIGHT:
1560 return (x >= priv->pager_all.x + priv->pager_all.width - PROXIMITY_SIZE &&
1561 x <= priv->pager_all.x + priv->pager_all.width) &&
1562 (y >= priv->pager_all.y + priv->overlay.y &&
1563 y <= priv->pager_all.y + priv->overlay.y + priv->overlay.height);
1564 break;
1565 case OS_SIDE_BOTTOM:
1566 return (y >= priv->pager_all.y + priv->pager_all.height - PROXIMITY_SIZE &&
1567 y <= priv->pager_all.y + priv->pager_all.height) &&
1568 (x >= priv->pager_all.x + priv->overlay.x &&
1569 x <= priv->pager_all.x + priv->overlay.x + priv->overlay.width);
1570 break;
1571 case OS_SIDE_LEFT:
1572 case OS_SIDE_TOP:
1573 /* FIXME not implemented yet.
1574 * Add support for different scrollbar positions here. */
1575 break;
1576 }
1577
1578 return FALSE;
1579}
1580
1580/* filter function applied to the toplevel window */1581/* filter function applied to the toplevel window */
1581#ifdef USE_GTK31582#ifdef USE_GTK3
1582static GdkFilterReturn1583static GdkFilterReturn
@@ -1591,8 +1592,8 @@
1591 g_return_val_if_fail (OS_SCROLLBAR (user_data), GDK_FILTER_CONTINUE);1592 g_return_val_if_fail (OS_SCROLLBAR (user_data), GDK_FILTER_CONTINUE);
15921593
1593 scrollbar = OS_SCROLLBAR (user_data);1594 scrollbar = OS_SCROLLBAR (user_data);
1594
1595 priv = scrollbar->priv;1595 priv = scrollbar->priv;
1596
1596 xev = gdkxevent;1597 xev = gdkxevent;
15971598
1598 g_return_val_if_fail (priv->pager != NULL, GDK_FILTER_CONTINUE);1599 g_return_val_if_fail (priv->pager != NULL, GDK_FILTER_CONTINUE);
@@ -1619,10 +1620,7 @@
1619 /* proximity area */1620 /* proximity area */
1620 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1621 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1621 {1622 {
1622 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x <= PROXIMITY_WIDTH &&1623 if (check_proximity (scrollbar, xiev->event_x, xiev->event_y, OS_SIDE_RIGHT))
1623 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x >= 0) &&
1624 (xiev->event_y >= priv->overlay_all.y + priv->overlay.y &&
1625 xiev->event_y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))
1626 {1624 {
1627 priv->can_hide = FALSE;1625 priv->can_hide = FALSE;
16281626
@@ -1647,15 +1645,12 @@
1647 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1645 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1648 }1646 }
16491647
1650 gtk_widget_show (GTK_WIDGET (priv->thumb));1648 gtk_widget_show (priv->thumb);
1651 }1649 }
1652 }1650 }
1653 else1651 else
1654 {1652 {
1655 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y <= PROXIMITY_WIDTH &&1653 if (check_proximity (scrollbar, xiev->event_x, xiev->event_y, OS_SIDE_BOTTOM))
1656 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y >= 0) &&
1657 (xiev->event_x >= priv->overlay_all.x + priv->overlay.x &&
1658 xiev->event_x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))
1659 {1654 {
1660 priv->can_hide = FALSE;1655 priv->can_hide = FALSE;
16611656
@@ -1680,7 +1675,7 @@
1680 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1675 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1681 }1676 }
16821677
1683 gtk_widget_show (GTK_WIDGET (priv->thumb));1678 gtk_widget_show (priv->thumb);
1684 }1679 }
1685 }1680 }
1686 }1681 }
@@ -1746,10 +1741,7 @@
1746 /* proximity area */1741 /* proximity area */
1747 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1742 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1748 {1743 {
1749 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x <= PROXIMITY_WIDTH &&1744 if (check_proximity (scrollbar, xiev->event_x, xiev->event_y, OS_SIDE_RIGHT))
1750 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x >= 0) &&
1751 (xiev->event_y >= priv->overlay_all.y + priv->overlay.y &&
1752 xiev->event_y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))
1753 {1745 {
1754 priv->can_hide = FALSE;1746 priv->can_hide = FALSE;
17551747
@@ -1774,9 +1766,9 @@
1774 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1766 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1775 }1767 }
17761768
1777 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);1769 os_pager_set_detached (priv->pager, FALSE);
1778 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);1770 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
1779 gtk_widget_show (GTK_WIDGET (priv->thumb));1771 gtk_widget_show (priv->thumb);
1780 }1772 }
1781 else1773 else
1782 {1774 {
@@ -1787,10 +1779,7 @@
1787 }1779 }
1788 else1780 else
1789 {1781 {
1790 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y <= PROXIMITY_WIDTH &&1782 if (check_proximity (scrollbar, xiev->event_x, xiev->event_y, OS_SIDE_BOTTOM))
1791 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y >= 0) &&
1792 (xiev->event_x >= priv->overlay_all.x + priv->overlay.x &&
1793 xiev->event_x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))
1794 {1783 {
1795 priv->can_hide = FALSE;1784 priv->can_hide = FALSE;
17961785
@@ -1815,9 +1804,9 @@
1815 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);1804 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);
1816 }1805 }
18171806
1818 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);1807 os_pager_set_detached (priv->pager, FALSE);
1819 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);1808 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
1820 gtk_widget_show (GTK_WIDGET (priv->thumb));1809 gtk_widget_show (priv->thumb);
1821 }1810 }
1822 else1811 else
1823 {1812 {
@@ -1845,8 +1834,8 @@
1845 g_return_val_if_fail (OS_SCROLLBAR (user_data), GDK_FILTER_CONTINUE);1834 g_return_val_if_fail (OS_SCROLLBAR (user_data), GDK_FILTER_CONTINUE);
18461835
1847 scrollbar = OS_SCROLLBAR (user_data);1836 scrollbar = OS_SCROLLBAR (user_data);
1848
1849 priv = scrollbar->priv;1837 priv = scrollbar->priv;
1838
1850 xev = gdkxevent;1839 xev = gdkxevent;
18511840
1852 g_return_val_if_fail (priv->pager != NULL, GDK_FILTER_CONTINUE);1841 g_return_val_if_fail (priv->pager != NULL, GDK_FILTER_CONTINUE);
@@ -1867,10 +1856,7 @@
1867 /* proximity area */1856 /* proximity area */
1868 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1857 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1869 {1858 {
1870 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xbutton.x <= PROXIMITY_WIDTH &&1859 if (check_proximity (scrollbar, xev->xbutton.x, xev->xbutton.y, OS_SIDE_RIGHT))
1871 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xbutton.x >= 0) &&
1872 (xev->xbutton.y >= priv->overlay_all.y + priv->overlay.y &&
1873 xev->xbutton.y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))
1874 {1860 {
1875 priv->can_hide = FALSE;1861 priv->can_hide = FALSE;
18761862
@@ -1895,15 +1881,12 @@
1895 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1881 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1896 }1882 }
18971883
1898 gtk_widget_show (GTK_WIDGET (priv->thumb));1884 gtk_widget_show (priv->thumb);
1899 }1885 }
1900 }1886 }
1901 else1887 else
1902 {1888 {
1903 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xbutton.y <= PROXIMITY_WIDTH &&1889 if (check_proximity (scrollbar, xev->xbutton.x, xev->xbutton.y, OS_SIDE_BOTTOM))
1904 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xbutton.y >= 0) &&
1905 (xev->xbutton.x >= priv->overlay_all.x + priv->overlay.x &&
1906 xev->xbutton.x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))
1907 {1890 {
1908 priv->can_hide = FALSE;1891 priv->can_hide = FALSE;
19091892
@@ -1928,7 +1911,7 @@
1928 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1911 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1929 }1912 }
19301913
1931 gtk_widget_show (GTK_WIDGET (priv->thumb));1914 gtk_widget_show (priv->thumb);
1932 }1915 }
1933 }1916 }
1934 }1917 }
@@ -1991,10 +1974,7 @@
1991 /* proximity area */1974 /* proximity area */
1992 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1975 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1993 {1976 {
1994 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xmotion.x <= PROXIMITY_WIDTH &&1977 if (check_proximity (scrollbar, xev->xmotion.x, xev->xmotion.y, OS_SIDE_RIGHT))
1995 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xmotion.x >= 0) &&
1996 (xev->xmotion.y >= priv->overlay_all.y + priv->overlay.y &&
1997 xev->xmotion.y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))
1998 {1978 {
1999 priv->can_hide = FALSE;1979 priv->can_hide = FALSE;
20001980
@@ -2019,9 +1999,9 @@
2019 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1999 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
2020 }2000 }
20212001
2022 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);2002 os_pager_set_detached (priv->pager, FALSE);
2023 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);2003 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
2024 gtk_widget_show (GTK_WIDGET (priv->thumb));2004 gtk_widget_show (priv->thumb);
2025 }2005 }
2026 else2006 else
2027 {2007 {
@@ -2032,10 +2012,7 @@
2032 }2012 }
2033 else2013 else
2034 {2014 {
2035 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xmotion.y <= PROXIMITY_WIDTH &&2015 if (check_proximity (scrollbar, xev->xmotion.x, xev->xmotion.y, OS_SIDE_BOTTOM))
2036 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xmotion.y >= 0) &&
2037 (xev->xmotion.x >= priv->overlay_all.x + priv->overlay.x &&
2038 xev->xmotion.x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))
2039 {2016 {
2040 priv->can_hide = FALSE;2017 priv->can_hide = FALSE;
20412018
@@ -2060,9 +2037,9 @@
2060 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);2037 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);
2061 }2038 }
20622039
2063 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);2040 os_pager_set_detached (priv->pager, FALSE);
2064 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);2041 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
2065 gtk_widget_show (GTK_WIDGET (priv->thumb));2042 gtk_widget_show (priv->thumb);
2066 }2043 }
2067 else2044 else
2068 {2045 {
@@ -2347,11 +2324,11 @@
2347 /* on map-event of an active window,2324 /* on map-event of an active window,
2348 * the pager should be active. */2325 * the pager should be active. */
2349 priv->can_deactivate_pager = FALSE;2326 priv->can_deactivate_pager = FALSE;
2350 os_pager_set_active (OS_PAGER (priv->pager), TRUE, FALSE);2327 os_pager_set_active (priv->pager, TRUE, FALSE);
2351 }2328 }
23522329
2353 if (priv->fullsize == FALSE)2330 if (priv->fullsize == FALSE)
2354 os_pager_show (OS_PAGER (priv->pager));2331 os_pager_show (priv->pager);
23552332
2356 if (gtk_widget_get_realized (widget) && priv->filter == FALSE)2333 if (gtk_widget_get_realized (widget) && priv->filter == FALSE)
2357 {2334 {
@@ -2388,7 +2365,7 @@
23882365
2389 calc_layout_pager (scrollbar, gtk_adjustment_get_value (priv->adjustment));2366 calc_layout_pager (scrollbar, gtk_adjustment_get_value (priv->adjustment));
23902367
2391 os_pager_set_parent (OS_PAGER (priv->pager), widget);2368 os_pager_set_parent (priv->pager, widget);
23922369
2393 store_toplevel_position (scrollbar);2370 store_toplevel_position (scrollbar);
2394}2371}
@@ -2403,46 +2380,43 @@
2403os_scrollbar_size_allocate (GtkWidget *widget,2380os_scrollbar_size_allocate (GtkWidget *widget,
2404 GdkRectangle *allocation)2381 GdkRectangle *allocation)
2405{2382{
2406 GdkRectangle rect;
2407 OsScrollbar *scrollbar;2383 OsScrollbar *scrollbar;
2408 OsScrollbarPrivate *priv;2384 OsScrollbarPrivate *priv;
24092385
2410 scrollbar = OS_SCROLLBAR (widget);2386 scrollbar = OS_SCROLLBAR (widget);
2411 priv = scrollbar->priv;2387 priv = scrollbar->priv;
24122388
2413 priv->trough.x = 0;2389 priv->trough.x = allocation->x;
2414 priv->trough.y = 0;2390 priv->trough.y = allocation->y;
2415 priv->trough.width = allocation->width;2391 priv->trough.width = allocation->width;
2416 priv->trough.height = allocation->height;2392 priv->trough.height = allocation->height;
24172393
2418 priv->overlay_all = *allocation;2394 priv->pager_all = *allocation;
2419 priv->thumb_all = *allocation;2395 priv->thumb_all = *allocation;
24202396
2421 if (priv->orientation == GTK_ORIENTATION_VERTICAL)2397 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
2422 {2398 {
2423 priv->slider.width = DEFAULT_THUMB_WIDTH;2399 priv->slider.width = THUMB_WIDTH;
2424 priv->slider.height = DEFAULT_THUMB_HEIGHT;2400 priv->slider.height = THUMB_HEIGHT;
2425 priv->overlay_all.x = allocation->x - DEFAULT_PAGER_WIDTH;2401
2402 priv->pager_all.x = allocation->x - PAGER_SIZE;
2403 priv->pager_all.width = PAGER_SIZE;
2404
2426 priv->thumb_all.x = allocation->x + THUMB_ALLOCATION_SHIFT;2405 priv->thumb_all.x = allocation->x + THUMB_ALLOCATION_SHIFT;
24272406 priv->thumb_all.width = THUMB_WIDTH;
2428 rect.x = priv->overlay_all.x;
2429 rect.y = priv->overlay_all.y;
2430 rect.width = DEFAULT_PAGER_WIDTH;
2431 rect.height = priv->overlay_all.height;
24322407
2433 allocation->width = 0;2408 allocation->width = 0;
2434 }2409 }
2435 else2410 else
2436 {2411 {
2437 priv->slider.width = DEFAULT_THUMB_HEIGHT;2412 priv->slider.width = THUMB_HEIGHT;
2438 priv->slider.height = DEFAULT_THUMB_WIDTH;2413 priv->slider.height = THUMB_WIDTH;
2439 priv->overlay_all.y = allocation->y - DEFAULT_PAGER_WIDTH;2414
2415 priv->pager_all.y = allocation->y - PAGER_SIZE;
2416 priv->pager_all.height = PAGER_SIZE;
2417
2440 priv->thumb_all.y = allocation->y + THUMB_ALLOCATION_SHIFT;2418 priv->thumb_all.y = allocation->y + THUMB_ALLOCATION_SHIFT;
24412419 priv->thumb_all.height = THUMB_HEIGHT;
2442 rect.x = priv->overlay_all.x;
2443 rect.y = priv->overlay_all.y;
2444 rect.width = priv->overlay_all.width;
2445 rect.height = DEFAULT_PAGER_WIDTH;
24462420
2447 allocation->height = 0;2421 allocation->height = 0;
2448 }2422 }
@@ -2453,7 +2427,7 @@
2453 calc_layout_slider (scrollbar, gtk_adjustment_get_value (priv->adjustment));2427 calc_layout_slider (scrollbar, gtk_adjustment_get_value (priv->adjustment));
2454 }2428 }
24552429
2456 os_pager_size_allocate (OS_PAGER (priv->pager), rect);2430 os_pager_size_allocate (priv->pager, priv->pager_all);
24572431
2458 move_pager (scrollbar);2432 move_pager (scrollbar);
24592433
@@ -2496,7 +2470,7 @@
24962470
2497 priv->proximity = FALSE;2471 priv->proximity = FALSE;
24982472
2499 os_pager_hide (OS_PAGER (priv->pager));2473 os_pager_hide (priv->pager);
25002474
2501 gtk_widget_hide (priv->thumb);2475 gtk_widget_hide (priv->thumb);
25022476
@@ -2517,7 +2491,7 @@
2517 scrollbar = OS_SCROLLBAR (widget);2491 scrollbar = OS_SCROLLBAR (widget);
2518 priv = scrollbar->priv;2492 priv = scrollbar->priv;
25192493
2520 os_pager_hide (OS_PAGER (priv->pager));2494 os_pager_hide (priv->pager);
25212495
2522 gtk_widget_hide (priv->thumb);2496 gtk_widget_hide (priv->thumb);
25232497
@@ -2527,7 +2501,7 @@
2527 g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_toplevel (widget)),2501 g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_toplevel (widget)),
2528 G_CALLBACK (toplevel_configure_event_cb), scrollbar);2502 G_CALLBACK (toplevel_configure_event_cb), scrollbar);
25292503
2530 os_pager_set_parent (OS_PAGER (priv->pager), NULL);2504 os_pager_set_parent (priv->pager, NULL);
25312505
2532 window_group_list = gtk_window_group_list_windows (priv->window_group);2506 window_group_list = gtk_window_group_list_windows (priv->window_group);
25332507
25342508
=== modified file 'os/os-thumb.c'
--- os/os-thumb.c 2011-06-09 11:19:20 +0000
+++ os/os-thumb.c 2011-06-15 13:28:34 +0000
@@ -828,15 +828,9 @@
828 {828 {
829 priv->orientation = g_value_get_enum (value);829 priv->orientation = g_value_get_enum (value);
830 if (priv->orientation == GTK_ORIENTATION_VERTICAL)830 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
831 {831 gtk_window_resize (GTK_WINDOW (object), THUMB_WIDTH, THUMB_HEIGHT);
832 gtk_window_resize (GTK_WINDOW (object), DEFAULT_THUMB_WIDTH,
833 DEFAULT_THUMB_HEIGHT);
834 }
835 else832 else
836 {833 gtk_window_resize (GTK_WINDOW (object), THUMB_HEIGHT, THUMB_WIDTH);
837 gtk_window_resize (GTK_WINDOW (object), DEFAULT_THUMB_HEIGHT,
838 DEFAULT_THUMB_WIDTH);
839 }
840 break;834 break;
841 }835 }
842836

Subscribers

People subscribed via source and target branches