Merge lp:~cimi/overlay-scrollbar/various-namings-and-refactoring into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Ted Gould
Approved revision: 253
Merged at revision: 253
Proposed branch: lp:~cimi/overlay-scrollbar/various-namings-and-refactoring
Merge into: lp:overlay-scrollbar
Diff against target: 918 lines (+155/-206)
4 files modified
os/os-pager.c (+1/-1)
os/os-private.h (+4/-4)
os/os-scrollbar.c (+148/-193)
os/os-thumb.c (+2/-8)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/various-namings-and-refactoring
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+64671@code.launchpad.net

Description of the change

Various changes, trying to have nicer variable names and some optimization associated (apart from the change in move_pager and in proximity, which are slower as it has to access the memory for the dimensions instead using a fixed value, but looks easier to read)

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Hard patch to read, but I can't see anything odd.

review: Approve

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 12:09:58 +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 12:09:58 +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 12:09:58 +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
@@ -55,13 +55,13 @@
55 GdkRectangle trough;55 GdkRectangle trough;
56 GdkRectangle overlay;56 GdkRectangle overlay;
57 GdkRectangle slider;57 GdkRectangle slider;
58 GtkAllocation overlay_all;58 GtkAllocation pager_all;
59 GtkAllocation thumb_all;59 GtkAllocation thumb_all;
60 GObject *pager;
61 GtkWidget *thumb;60 GtkWidget *thumb;
62 GtkAdjustment *adjustment;61 GtkAdjustment *adjustment;
63 GtkOrientation orientation;62 GtkOrientation orientation;
64 GtkWindowGroup *window_group;63 GtkWindowGroup *window_group;
64 OsPager *pager;
65 gboolean button_press_event;65 gboolean button_press_event;
66 gboolean enter_notify_event;66 gboolean enter_notify_event;
67 gboolean motion_notify_event;67 gboolean motion_notify_event;
@@ -137,74 +137,56 @@
137137
138 if (priv->orientation == GTK_ORIENTATION_VERTICAL)138 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
139 {139 {
140 gint y, bottom, top, height;140 gint y, trough_length, height;
141141
142 top = priv->trough.y;142 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 */
148143
149 if (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment) != 0)144 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) /145 height = (trough_length * (gtk_adjustment_get_page_size (priv->adjustment) /
151 (gtk_adjustment_get_upper (priv->adjustment) - 146 (gtk_adjustment_get_upper (priv->adjustment) -
152 gtk_adjustment_get_lower (priv->adjustment))));147 gtk_adjustment_get_lower (priv->adjustment))));
153 else148 else
154 height = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));149 height = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));
155150
156 height = MAX (height, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));151 height = MAX (height, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));
157152
158 height = MIN (height, priv->trough.height);
159
160 y = top;
161
162 if (gtk_adjustment_get_upper (priv->adjustment) -153 if (gtk_adjustment_get_upper (priv->adjustment) -
163 gtk_adjustment_get_lower (priv->adjustment) -154 gtk_adjustment_get_lower (priv->adjustment) -
164 gtk_adjustment_get_page_size (priv->adjustment) != 0)155 gtk_adjustment_get_page_size (priv->adjustment) != 0)
165 y += (bottom - top - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /156 y = (trough_length - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
166 (gtk_adjustment_get_upper (priv->adjustment) -157 (gtk_adjustment_get_upper (priv->adjustment) -
167 gtk_adjustment_get_lower (priv->adjustment) -158 gtk_adjustment_get_lower (priv->adjustment) -
168 gtk_adjustment_get_page_size (priv->adjustment)));159 gtk_adjustment_get_page_size (priv->adjustment)));
169160
170 y = CLAMP (y, top, bottom);161 y = CLAMP (y, 0, trough_length);
171162
172 priv->overlay.y = y;163 priv->overlay.y = y;
173 priv->overlay.height = height;164 priv->overlay.height = height;
174 }165 }
175 else166 else
176 {167 {
177 gint x, left, right, width;168 gint x, trough_length, width;
178169
179 left = priv->trough.x;170 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 */
185171
186 if (gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment) != 0)172 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) /173 width = (trough_length * (gtk_adjustment_get_page_size (priv->adjustment) /
188 (gtk_adjustment_get_upper (priv->adjustment) -174 (gtk_adjustment_get_upper (priv->adjustment) -
189 gtk_adjustment_get_lower (priv->adjustment))));175 gtk_adjustment_get_lower (priv->adjustment))));
190 else176 else
191 width = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));177 width = gtk_range_get_min_slider_size (GTK_RANGE (scrollbar));
192178
193 width = MAX (width, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));179 width = MAX (width, gtk_range_get_min_slider_size (GTK_RANGE (scrollbar)));
194180
195 width = MIN (width, priv->trough.width);
196
197 x = left;
198
199 if (gtk_adjustment_get_upper (priv->adjustment) -181 if (gtk_adjustment_get_upper (priv->adjustment) -
200 gtk_adjustment_get_lower (priv->adjustment) -182 gtk_adjustment_get_lower (priv->adjustment) -
201 gtk_adjustment_get_page_size (priv->adjustment) != 0)183 gtk_adjustment_get_page_size (priv->adjustment) != 0)
202 x += (right - left - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /184 x = (trough_length - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
203 (gtk_adjustment_get_upper (priv->adjustment) -185 (gtk_adjustment_get_upper (priv->adjustment) -
204 gtk_adjustment_get_lower (priv->adjustment) -186 gtk_adjustment_get_lower (priv->adjustment) -
205 gtk_adjustment_get_page_size (priv->adjustment)));187 gtk_adjustment_get_page_size (priv->adjustment)));
206188
207 x = CLAMP (x, left, right);189 x = CLAMP (x, 0, trough_length);
208190
209 priv->overlay.x = x;191 priv->overlay.x = x;
210 priv->overlay.width = width;192 priv->overlay.width = width;
@@ -222,52 +204,40 @@
222204
223 if (priv->orientation == GTK_ORIENTATION_VERTICAL)205 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
224 {206 {
225 gint y, bottom, top, height;207 gint y, trough_length, height;
226208
227 top = priv->trough.y;209 trough_length = priv->trough.height;
228 bottom = priv->trough.y + priv->trough.height;
229
230 height = priv->slider.height;210 height = priv->slider.height;
231211
232 height = MIN (height, priv->trough.height);
233
234 y = top;
235
236 if (gtk_adjustment_get_upper (priv->adjustment) -212 if (gtk_adjustment_get_upper (priv->adjustment) -
237 gtk_adjustment_get_lower (priv->adjustment) -213 gtk_adjustment_get_lower (priv->adjustment) -
238 gtk_adjustment_get_page_size (priv->adjustment) != 0)214 gtk_adjustment_get_page_size (priv->adjustment) != 0)
239 y += (bottom - top - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /215 y = (trough_length - height) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
240 (gtk_adjustment_get_upper (priv->adjustment) -216 (gtk_adjustment_get_upper (priv->adjustment) -
241 gtk_adjustment_get_lower (priv->adjustment) -217 gtk_adjustment_get_lower (priv->adjustment) -
242 gtk_adjustment_get_page_size (priv->adjustment)));218 gtk_adjustment_get_page_size (priv->adjustment)));
243219
244 y = CLAMP (y, top, bottom);220 y = CLAMP (y, 0, trough_length);
245221
246 priv->slider.y = y;222 priv->slider.y = y;
247 priv->slider.height = height;223 priv->slider.height = height;
248 }224 }
249 else225 else
250 {226 {
251 gint x, left, right, width;227 gint x, trough_length, width;
252228
253 left = priv->trough.x;229 trough_length = priv->trough.width;
254 right = priv->trough.x + priv->trough.width;
255
256 width = priv->slider.width;230 width = priv->slider.width;
257231
258 width = MIN (width, priv->trough.width);
259
260 x = left;
261
262 if (gtk_adjustment_get_upper (priv->adjustment) -232 if (gtk_adjustment_get_upper (priv->adjustment) -
263 gtk_adjustment_get_lower (priv->adjustment) -233 gtk_adjustment_get_lower (priv->adjustment) -
264 gtk_adjustment_get_page_size (priv->adjustment) != 0)234 gtk_adjustment_get_page_size (priv->adjustment) != 0)
265 x += (right - left - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /235 x = (trough_length - width) * ((adjustment_value - gtk_adjustment_get_lower (priv->adjustment)) /
266 (gtk_adjustment_get_upper (priv->adjustment) -236 (gtk_adjustment_get_upper (priv->adjustment) -
267 gtk_adjustment_get_lower (priv->adjustment) -237 gtk_adjustment_get_lower (priv->adjustment) -
268 gtk_adjustment_get_page_size (priv->adjustment)));238 gtk_adjustment_get_page_size (priv->adjustment)));
269239
270 x = CLAMP (x, left, right);240 x = CLAMP (x, 0, trough_length);
271241
272 priv->slider.x = x;242 priv->slider.x = x;
273 priv->slider.width = width;243 priv->slider.width = width;
@@ -333,7 +303,7 @@
333 priv = scrollbar->priv;303 priv = scrollbar->priv;
334304
335 if (priv->pager != NULL && priv->can_deactivate_pager)305 if (priv->pager != NULL && priv->can_deactivate_pager)
336 os_pager_set_active (OS_PAGER (priv->pager), FALSE, TRUE);306 os_pager_set_active (priv->pager, FALSE, TRUE);
337}307}
338308
339/* timeout before deactivating the pager */309/* timeout before deactivating the pager */
@@ -365,7 +335,7 @@
365 if (priv->can_hide)335 if (priv->can_hide)
366 {336 {
367 priv->value_changed_event = FALSE;337 priv->value_changed_event = FALSE;
368 gtk_widget_hide (GTK_WIDGET (priv->thumb));338 gtk_widget_hide (priv->thumb);
369 }339 }
370}340}
371341
@@ -398,7 +368,7 @@
398 {368 {
399 mask.x = 0;369 mask.x = 0;
400 mask.y = priv->overlay.y;370 mask.y = priv->overlay.y;
401 mask.width = DEFAULT_PAGER_WIDTH;371 mask.width = priv->pager_all.width;
402 mask.height = priv->overlay.height;372 mask.height = priv->overlay.height;
403 }373 }
404 else374 else
@@ -406,10 +376,10 @@
406 mask.x = priv->overlay.x;376 mask.x = priv->overlay.x;
407 mask.y = 0;377 mask.y = 0;
408 mask.width = priv->overlay.width;378 mask.width = priv->overlay.width;
409 mask.height = DEFAULT_PAGER_WIDTH;379 mask.height = priv->pager_all.height;
410 }380 }
411381
412 os_pager_move_resize (OS_PAGER (priv->pager), mask);382 os_pager_move_resize (priv->pager, mask);
413}383}
414384
415/* sanitize x coordinate of thumb window */385/* sanitize x coordinate of thumb window */
@@ -463,7 +433,7 @@
463433
464 if (priv->orientation == GTK_ORIENTATION_VERTICAL &&434 if (priv->orientation == GTK_ORIENTATION_VERTICAL &&
465 (n_monitor != gdk_screen_get_monitor_at_point (screen, x - 1 + priv->slider.width, y) ||435 (n_monitor != gdk_screen_get_monitor_at_point (screen, x - 1 + priv->slider.width, y) ||
466 (x - 1 + priv->slider.width) >= screen_width))436 x - 1 + priv->slider.width >= screen_width))
467 {437 {
468 priv->internal = TRUE;438 priv->internal = TRUE;
469 return MAX (x - priv->slider.width, screen_width - priv->slider.width);439 return MAX (x - priv->slider.width, screen_width - priv->slider.width);
@@ -526,7 +496,7 @@
526496
527 if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&497 if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
528 (n_monitor != gdk_screen_get_monitor_at_point (screen, x, y - 1 + priv->slider.height) ||498 (n_monitor != gdk_screen_get_monitor_at_point (screen, x, y - 1 + priv->slider.height) ||
529 (y - 1 + priv->slider.height) >= screen_height))499 y - 1 + priv->slider.height >= screen_height))
530 {500 {
531 priv->internal = TRUE;501 priv->internal = TRUE;
532 return MAX (y - priv->slider.height, screen_height - priv->slider.height);502 return MAX (y - priv->slider.height, screen_height - priv->slider.height);
@@ -707,19 +677,19 @@
707 * hidden a pager that is meant to be hidden/shown.677 * hidden a pager that is meant to be hidden/shown.
708 * I don't want to see pagers reappearing because678 * I don't want to see pagers reappearing because
709 * of a change in the adjustment of an invisible pager or viceversa. */679 * of a change in the adjustment of an invisible pager or viceversa. */
710 if ((gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) >680 if (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment) >
711 gtk_adjustment_get_page_size (adjustment))681 gtk_adjustment_get_page_size (adjustment))
712 {682 {
713 priv->fullsize = FALSE;683 priv->fullsize = FALSE;
714 if (priv->proximity != FALSE)684 if (priv->proximity != FALSE)
715 os_pager_show (OS_PAGER (priv->pager));685 os_pager_show (priv->pager);
716 }686 }
717 else687 else
718 {688 {
719 priv->fullsize = TRUE;689 priv->fullsize = TRUE;
720 if (priv->proximity != FALSE)690 if (priv->proximity != FALSE)
721 {691 {
722 os_pager_hide (OS_PAGER (priv->pager));692 os_pager_hide (priv->pager);
723693
724 gtk_widget_hide (priv->thumb);694 gtk_widget_hide (priv->thumb);
725 }695 }
@@ -729,7 +699,7 @@
729 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));699 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));
730700
731 if (!priv->motion_notify_event && !priv->enter_notify_event)701 if (!priv->motion_notify_event && !priv->enter_notify_event)
732 gtk_widget_hide (GTK_WIDGET (priv->thumb));702 gtk_widget_hide (priv->thumb);
733703
734 move_pager (scrollbar);704 move_pager (scrollbar);
735}705}
@@ -748,20 +718,20 @@
748 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));718 calc_layout_slider (scrollbar, gtk_adjustment_get_value (adjustment));
749719
750 if (!priv->motion_notify_event && !priv->enter_notify_event)720 if (!priv->motion_notify_event && !priv->enter_notify_event)
751 gtk_widget_hide (GTK_WIDGET (priv->thumb));721 gtk_widget_hide (priv->thumb);
752722
753 if (gtk_widget_get_mapped (GTK_WIDGET (priv->thumb)))723 if (gtk_widget_get_mapped (priv->thumb))
754 {724 {
755 /* if we're dragging the thumb, it can't be detached. */725 /* if we're dragging the thumb, it can't be detached. */
756 if (priv->motion_notify_event)726 if (priv->motion_notify_event)
757 {727 {
758 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);728 os_pager_set_detached (priv->pager, FALSE);
759 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);729 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
760 }730 }
761 else731 else
762 {732 {
763 gint x_pos, y_pos;733 gint x_pos, y_pos;
764 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (priv->thumb)), &x_pos, &y_pos);734 gdk_window_get_origin (gtk_widget_get_window (priv->thumb), &x_pos, &y_pos);
765735
766 if (priv->orientation == GTK_ORIENTATION_VERTICAL)736 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
767 {737 {
@@ -771,11 +741,11 @@
771741
772 mask.x = 0;742 mask.x = 0;
773 mask.y = y_pos + priv->slider.height / 2 - priv->win_y;743 mask.y = y_pos + priv->slider.height / 2 - priv->win_y;
774 mask.width = DEFAULT_PAGER_WIDTH;744 mask.width = priv->pager_all.width;
775 mask.height = priv->overlay.y - mask.y;745 mask.height = priv->overlay.y - mask.y;
776746
777 os_pager_connect (OS_PAGER (priv->pager), mask);747 os_pager_connect (priv->pager, mask);
778 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);748 os_pager_set_detached (priv->pager, TRUE);
779749
780 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);750 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);
781 }751 }
@@ -785,17 +755,17 @@
785755
786 mask.x = 0;756 mask.x = 0;
787 mask.y = priv->overlay.y + priv->overlay.height;757 mask.y = priv->overlay.y + priv->overlay.height;
788 mask.width = DEFAULT_PAGER_WIDTH;758 mask.width = priv->pager_all.width;
789 mask.height = y_pos + priv->slider.height / 2 - priv->win_y - mask.y;759 mask.height = y_pos + priv->slider.height / 2 - priv->win_y - mask.y;
790760
791 os_pager_connect (OS_PAGER (priv->pager), mask);761 os_pager_connect (priv->pager, mask);
792 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);762 os_pager_set_detached (priv->pager, TRUE);
793763
794 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);764 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);
795 }765 }
796 else 766 else
797 {767 {
798 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);768 os_pager_set_detached (priv->pager, FALSE);
799 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);769 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
800 }770 }
801 }771 }
@@ -808,10 +778,10 @@
808 mask.x = x_pos + priv->slider.width / 2 - priv->win_x;778 mask.x = x_pos + priv->slider.width / 2 - priv->win_x;
809 mask.y = 0;779 mask.y = 0;
810 mask.width = priv->overlay.x - mask.x;780 mask.width = priv->overlay.x - mask.x;
811 mask.height = DEFAULT_PAGER_WIDTH;781 mask.height = priv->pager_all.height;
812782
813 os_pager_connect (OS_PAGER (priv->pager), mask);783 os_pager_connect (priv->pager, mask);
814 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);784 os_pager_set_detached (priv->pager, TRUE);
815785
816 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);786 os_thumb_set_detached (OS_THUMB (priv->thumb), TRUE);
817 }787 }
@@ -822,14 +792,14 @@
822 mask.x = priv->overlay.y + priv->overlay.height;792 mask.x = priv->overlay.y + priv->overlay.height;
823 mask.y = 0;793 mask.y = 0;
824 mask.width = x_pos + priv->slider.width / 2 - priv->win_x - mask.x;794 mask.width = x_pos + priv->slider.width / 2 - priv->win_x - mask.x;
825 mask.height = DEFAULT_PAGER_WIDTH;795 mask.height = priv->pager_all.height;
826796
827 os_pager_connect (OS_PAGER (priv->pager), mask);797 os_pager_connect (priv->pager, mask);
828 os_pager_set_detached (OS_PAGER (priv->pager), TRUE);798 os_pager_set_detached (priv->pager, TRUE);
829 }799 }
830 else800 else
831 {801 {
832 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);802 os_pager_set_detached (priv->pager, FALSE);
833 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);803 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
834 }804 }
835 }805 }
@@ -860,12 +830,12 @@
860 (y > allocation.y && y < allocation.y + allocation.height))830 (y > allocation.y && y < allocation.y + allocation.height))
861 {831 {
862 priv->can_deactivate_pager = FALSE;832 priv->can_deactivate_pager = FALSE;
863 os_pager_set_active (OS_PAGER (priv->pager), TRUE, TRUE);833 os_pager_set_active (priv->pager, TRUE, TRUE);
864 }834 }
865 else835 else
866 {836 {
867 priv->can_deactivate_pager = TRUE;837 priv->can_deactivate_pager = TRUE;
868 os_pager_set_active (OS_PAGER (priv->pager), FALSE, TRUE);838 os_pager_set_active (priv->pager, FALSE, TRUE);
869 }839 }
870}840}
871841
@@ -899,7 +869,7 @@
899 priv->active_window = TRUE;869 priv->active_window = TRUE;
900870
901 priv->can_deactivate_pager = FALSE;871 priv->can_deactivate_pager = FALSE;
902 os_pager_set_active (OS_PAGER (priv->pager), TRUE, TRUE);872 os_pager_set_active (priv->pager, TRUE, TRUE);
903 }873 }
904 else if (priv->active_window)874 else if (priv->active_window)
905 {875 {
@@ -938,7 +908,7 @@
938 {908 {
939 /* if the pointer is outside of the window, set it inactive. */909 /* if the pointer is outside of the window, set it inactive. */
940 priv->can_deactivate_pager = TRUE;910 priv->can_deactivate_pager = TRUE;
941 os_pager_set_active (OS_PAGER (priv->pager), FALSE, TRUE);911 os_pager_set_active (priv->pager, FALSE, TRUE);
942 }912 }
943913
944 if ((current_time > end_time) && priv->thumb != NULL)914 if ((current_time > end_time) && priv->thumb != NULL)
@@ -1196,7 +1166,7 @@
11961166
1197 /* immediately set the pager to be active. */1167 /* immediately set the pager to be active. */
1198 priv->can_deactivate_pager = FALSE;1168 priv->can_deactivate_pager = FALSE;
1199 os_pager_set_active (OS_PAGER (priv->pager), TRUE, FALSE);1169 os_pager_set_active (priv->pager, TRUE, FALSE);
12001170
1201 xid = GDK_WINDOW_XID (gtk_widget_get_window (widget));1171 xid = GDK_WINDOW_XID (gtk_widget_get_window (widget));
1202 xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (scrollbar)));1172 xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (scrollbar)));
@@ -1267,7 +1237,6 @@
1267 gdouble frac;1237 gdouble frac;
1268 gdouble value;1238 gdouble value;
1269 gint trough_length;1239 gint trough_length;
1270 gint trough_start;
1271 gint slider_length;1240 gint slider_length;
12721241
1273 priv = scrollbar->priv;1242 priv = scrollbar->priv;
@@ -1275,21 +1244,18 @@
1275 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1244 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1276 {1245 {
1277 trough_length = priv->trough.height;1246 trough_length = priv->trough.height;
1278 trough_start = priv->trough.y;
1279 slider_length = MAX (priv->slider.height, priv->overlay.height);1247 slider_length = MAX (priv->slider.height, priv->overlay.height);
1280 }1248 }
1281 else1249 else
1282 {1250 {
1283 trough_length = priv->trough.width;1251 trough_length = priv->trough.width;
1284 trough_start = priv->trough.y;
1285 slider_length = MAX (priv->slider.width, priv->overlay.width);1252 slider_length = MAX (priv->slider.width, priv->overlay.width);
1286 }1253 }
12871254
1288 if (trough_length == slider_length)1255 if (trough_length == slider_length)
1289 frac = 1.0;1256 frac = 1.0;
1290 else1257 else
1291 frac = (MAX (0, coord - trough_start) /1258 frac = (MAX (0, coord) / (gdouble) (trough_length - slider_length));
1292 (gdouble) (trough_length - slider_length));
12931259
1294 value = gtk_adjustment_get_lower (priv->adjustment) + frac * (gtk_adjustment_get_upper (priv->adjustment) -1260 value = gtk_adjustment_get_lower (priv->adjustment) + frac * (gtk_adjustment_get_upper (priv->adjustment) -
1295 gtk_adjustment_get_lower (priv->adjustment) -1261 gtk_adjustment_get_lower (priv->adjustment) -
@@ -1357,7 +1323,7 @@
1357 }1323 }
13581324
1359 /* FIXME(Cimi) seems useless. */1325 /* FIXME(Cimi) seems useless. */
1360 capture_movement (scrollbar, event->x_root, event->y_root);1326// capture_movement (scrollbar, event->x_root, event->y_root);
1361 priv->value_changed_event = FALSE;1327 priv->value_changed_event = FALSE;
1362 }1328 }
13631329
@@ -1379,9 +1345,9 @@
1379 priv->slide_initial_slider_position = 0;1345 priv->slide_initial_slider_position = 0;
1380 priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y);1346 priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y);
1381 }1347 }
1382 else if (priv->overlay.y + priv->overlay.height >= priv->trough.y + priv->trough.height)1348 else if (priv->overlay.y + priv->overlay.height >= priv->trough.height)
1383 {1349 {
1384 priv->slide_initial_slider_position = priv->trough.y + priv->trough.height - priv->overlay.height;1350 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);1351 priv->slide_initial_coordinate = MAX (event->y_root, priv->win_y + priv->pointer_y);
1386 }1352 }
1387 }1353 }
@@ -1405,9 +1371,9 @@
1405 priv->slide_initial_slider_position = 0;1371 priv->slide_initial_slider_position = 0;
1406 priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x);1372 priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x);
1407 }1373 }
1408 else if (priv->overlay.x + priv->overlay.width >= priv->trough.x + priv->trough.width)1374 else if (priv->overlay.x + priv->overlay.width >= priv->trough.width)
1409 {1375 {
1410 priv->slide_initial_slider_position = priv->trough.x + priv->trough.width - priv->overlay.width;1376 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);1377 priv->slide_initial_coordinate = MAX (event->x_root, priv->win_x + priv->pointer_x);
1412 }1378 }
1413 }1379 }
@@ -1482,7 +1448,7 @@
1482 priv->motion_notify_event = FALSE;1448 priv->motion_notify_event = FALSE;
1483 priv->enter_notify_event = FALSE;1449 priv->enter_notify_event = FALSE;
14841450
1485 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);1451 os_pager_set_detached (priv->pager, FALSE);
1486}1452}
14871453
1488/* toplevel functions */1454/* toplevel functions */
@@ -1492,24 +1458,16 @@
1492store_toplevel_position (OsScrollbar *scrollbar)1458store_toplevel_position (OsScrollbar *scrollbar)
1493{1459{
1494 OsScrollbarPrivate *priv;1460 OsScrollbarPrivate *priv;
1495 gint win_x, win_y;1461 gint x_pos, y_pos;
14961462
1497 priv = scrollbar->priv;1463 priv = scrollbar->priv;
14981464
1499 /* In reality, I'm storing widget's window, not the toplevel.1465 /* In reality, I'm storing widget's window, not the toplevel.
1500 * Is that the same with gdk_window_get_origin? */1466 * 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);1467 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
15021468
1503 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1469 priv->win_x = x_pos + priv->thumb_all.x;
1504 {1470 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}1471}
15141472
1515static gboolean1473static gboolean
@@ -1560,12 +1518,12 @@
1560 else1518 else
1561 {1519 {
1562 priv->can_deactivate_pager = FALSE;1520 priv->can_deactivate_pager = FALSE;
1563 os_pager_set_active (OS_PAGER (priv->pager), TRUE, TRUE);1521 os_pager_set_active (priv->pager, TRUE, TRUE);
1564 }1522 }
1565 }1523 }
15661524
1567 if (current_time > end_time)1525 if (current_time > end_time)
1568 gtk_widget_hide (GTK_WIDGET (priv->thumb));1526 gtk_widget_hide (priv->thumb);
15691527
1570 priv->lock_position = FALSE;1528 priv->lock_position = FALSE;
15711529
@@ -1619,10 +1577,10 @@
1619 /* proximity area */1577 /* proximity area */
1620 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1578 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1621 {1579 {
1622 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x <= PROXIMITY_WIDTH &&1580 if ((xiev->event_x >= priv->pager_all.x + priv->pager_all.width - PROXIMITY_SIZE &&
1623 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x >= 0) &&1581 xiev->event_x <= priv->pager_all.x + priv->pager_all.width) &&
1624 (xiev->event_y >= priv->overlay_all.y + priv->overlay.y &&1582 (xiev->event_y >= priv->pager_all.y + priv->overlay.y &&
1625 xiev->event_y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))1583 xiev->event_y <= priv->pager_all.y + priv->overlay.y + priv->overlay.height))
1626 {1584 {
1627 priv->can_hide = FALSE;1585 priv->can_hide = FALSE;
16281586
@@ -1647,15 +1605,15 @@
1647 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1605 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1648 }1606 }
16491607
1650 gtk_widget_show (GTK_WIDGET (priv->thumb));1608 gtk_widget_show (priv->thumb);
1651 }1609 }
1652 }1610 }
1653 else1611 else
1654 {1612 {
1655 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y <= PROXIMITY_WIDTH &&1613 if ((xiev->event_y >= priv->pager_all.y + priv->pager_all.height - PROXIMITY_SIZE &&
1656 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y >= 0) &&1614 xiev->event_y <= priv->pager_all.y + priv->pager_all.height) &&
1657 (xiev->event_x >= priv->overlay_all.x + priv->overlay.x &&1615 (xiev->event_x >= priv->pager_all.x + priv->overlay.x &&
1658 xiev->event_x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))1616 xiev->event_x <= priv->pager_all.x + priv->overlay.x + priv->overlay.width))
1659 {1617 {
1660 priv->can_hide = FALSE;1618 priv->can_hide = FALSE;
16611619
@@ -1680,7 +1638,7 @@
1680 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1638 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1681 }1639 }
16821640
1683 gtk_widget_show (GTK_WIDGET (priv->thumb));1641 gtk_widget_show (priv->thumb);
1684 }1642 }
1685 }1643 }
1686 }1644 }
@@ -1746,10 +1704,10 @@
1746 /* proximity area */1704 /* proximity area */
1747 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1705 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1748 {1706 {
1749 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x <= PROXIMITY_WIDTH &&1707 if ((xiev->event_x >= priv->pager_all.x + priv->pager_all.width - PROXIMITY_SIZE &&
1750 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xiev->event_x >= 0) &&1708 xiev->event_x <= priv->pager_all.x + priv->pager_all.width) &&
1751 (xiev->event_y >= priv->overlay_all.y + priv->overlay.y &&1709 (xiev->event_y >= priv->pager_all.y + priv->overlay.y &&
1752 xiev->event_y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))1710 xiev->event_y <= priv->pager_all.y + priv->overlay.y + priv->overlay.height))
1753 {1711 {
1754 priv->can_hide = FALSE;1712 priv->can_hide = FALSE;
17551713
@@ -1774,9 +1732,9 @@
1774 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1732 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1775 }1733 }
17761734
1777 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);1735 os_pager_set_detached (priv->pager, FALSE);
1778 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);1736 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
1779 gtk_widget_show (GTK_WIDGET (priv->thumb));1737 gtk_widget_show (priv->thumb);
1780 }1738 }
1781 else1739 else
1782 {1740 {
@@ -1787,10 +1745,10 @@
1787 }1745 }
1788 else1746 else
1789 {1747 {
1790 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y <= PROXIMITY_WIDTH &&1748 if ((xiev->event_y >= priv->pager_all.y + priv->pager_all.height - PROXIMITY_SIZE &&
1791 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xiev->event_y >= 0) &&1749 xiev->event_y <= priv->pager_all.y + priv->pager_all.height) &&
1792 (xiev->event_x >= priv->overlay_all.x + priv->overlay.x &&1750 (xiev->event_x >= priv->pager_all.x + priv->overlay.x &&
1793 xiev->event_x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))1751 xiev->event_x <= priv->pager_all.x + priv->overlay.x + priv->overlay.width))
1794 {1752 {
1795 priv->can_hide = FALSE;1753 priv->can_hide = FALSE;
17961754
@@ -1815,9 +1773,9 @@
1815 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);1773 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);
1816 }1774 }
18171775
1818 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);1776 os_pager_set_detached (priv->pager, FALSE);
1819 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);1777 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
1820 gtk_widget_show (GTK_WIDGET (priv->thumb));1778 gtk_widget_show (priv->thumb);
1821 }1779 }
1822 else1780 else
1823 {1781 {
@@ -1867,10 +1825,10 @@
1867 /* proximity area */1825 /* proximity area */
1868 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1826 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1869 {1827 {
1870 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xbutton.x <= PROXIMITY_WIDTH &&1828 if ((xev->xbutton.x >= priv->pager_all.x + priv->pager_all.width - PROXIMITY_SIZE &&
1871 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xbutton.x >= 0) &&1829 xev->xbutton.x <= priv->pager_all.x + priv->pager_all.width) &&
1872 (xev->xbutton.y >= priv->overlay_all.y + priv->overlay.y &&1830 (xev->xbutton.y >= priv->pager_all.y + priv->overlay.y &&
1873 xev->xbutton.y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))1831 xev->xbutton.y <= priv->pager_all.y + priv->overlay.y + priv->overlay.height))
1874 {1832 {
1875 priv->can_hide = FALSE;1833 priv->can_hide = FALSE;
18761834
@@ -1895,15 +1853,15 @@
1895 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1853 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1896 }1854 }
18971855
1898 gtk_widget_show (GTK_WIDGET (priv->thumb));1856 gtk_widget_show (priv->thumb);
1899 }1857 }
1900 }1858 }
1901 else1859 else
1902 {1860 {
1903 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xbutton.y <= PROXIMITY_WIDTH &&1861 if ((xev->xbutton.y >= priv->pager_all.y + priv->pager_all.height - PROXIMITY_SIZE &&
1904 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xbutton.y >= 0) &&1862 xev->xbutton.y <= priv->pager_all.y + priv->pager_all.height) &&
1905 (xev->xbutton.x >= priv->overlay_all.x + priv->overlay.x &&1863 (xev->xbutton.x >= priv->pager_all.x + priv->overlay.x &&
1906 xev->xbutton.x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))1864 xev->xbutton.x <= priv->pager_all.x + priv->overlay.x + priv->overlay.width))
1907 {1865 {
1908 priv->can_hide = FALSE;1866 priv->can_hide = FALSE;
19091867
@@ -1928,7 +1886,7 @@
1928 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1886 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1929 }1887 }
19301888
1931 gtk_widget_show (GTK_WIDGET (priv->thumb));1889 gtk_widget_show (priv->thumb);
1932 }1890 }
1933 }1891 }
1934 }1892 }
@@ -1991,10 +1949,10 @@
1991 /* proximity area */1949 /* proximity area */
1992 if (priv->orientation == GTK_ORIENTATION_VERTICAL)1950 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1993 {1951 {
1994 if ((priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xmotion.x <= PROXIMITY_WIDTH &&1952 if ((xev->xmotion.x >= priv->pager_all.x + priv->pager_all.width - PROXIMITY_SIZE &&
1995 priv->overlay_all.x + DEFAULT_PAGER_WIDTH - xev->xmotion.x >= 0) &&1953 xev->xmotion.x <= priv->pager_all.x + priv->pager_all.width) &&
1996 (xev->xmotion.y >= priv->overlay_all.y + priv->overlay.y &&1954 (xev->xmotion.y >= priv->pager_all.y + priv->overlay.y &&
1997 xev->xmotion.y <= priv->overlay_all.y + priv->overlay.y + priv->overlay.height))1955 xev->xmotion.y <= priv->pager_all.y + priv->overlay.y + priv->overlay.height))
1998 {1956 {
1999 priv->can_hide = FALSE;1957 priv->can_hide = FALSE;
20001958
@@ -2019,9 +1977,9 @@
2019 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);1977 move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
2020 }1978 }
20211979
2022 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);1980 os_pager_set_detached (priv->pager, FALSE);
2023 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);1981 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
2024 gtk_widget_show (GTK_WIDGET (priv->thumb));1982 gtk_widget_show (priv->thumb);
2025 }1983 }
2026 else1984 else
2027 {1985 {
@@ -2032,10 +1990,10 @@
2032 }1990 }
2033 else1991 else
2034 {1992 {
2035 if ((priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xmotion.y <= PROXIMITY_WIDTH &&1993 if ((xev->xmotion.y >= priv->pager_all.y + priv->pager_all.height - PROXIMITY_SIZE &&
2036 priv->overlay_all.y + DEFAULT_PAGER_WIDTH - xev->xmotion.y >= 0) &&1994 xev->xmotion.y <= priv->pager_all.y + priv->pager_all.height) &&
2037 (xev->xmotion.x >= priv->overlay_all.x + priv->overlay.x &&1995 (xev->xmotion.x >= priv->pager_all.x + priv->overlay.x &&
2038 xev->xmotion.x <= priv->overlay_all.x + priv->overlay.x + priv->overlay.width))1996 xev->xmotion.x <= priv->pager_all.x + priv->overlay.x + priv->overlay.width))
2039 {1997 {
2040 priv->can_hide = FALSE;1998 priv->can_hide = FALSE;
20411999
@@ -2060,9 +2018,9 @@
2060 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);2018 move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);
2061 }2019 }
20622020
2063 os_pager_set_detached (OS_PAGER (priv->pager), FALSE);2021 os_pager_set_detached (priv->pager, FALSE);
2064 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);2022 os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
2065 gtk_widget_show (GTK_WIDGET (priv->thumb));2023 gtk_widget_show (priv->thumb);
2066 }2024 }
2067 else2025 else
2068 {2026 {
@@ -2347,11 +2305,11 @@
2347 /* on map-event of an active window,2305 /* on map-event of an active window,
2348 * the pager should be active. */2306 * the pager should be active. */
2349 priv->can_deactivate_pager = FALSE;2307 priv->can_deactivate_pager = FALSE;
2350 os_pager_set_active (OS_PAGER (priv->pager), TRUE, FALSE);2308 os_pager_set_active (priv->pager, TRUE, FALSE);
2351 }2309 }
23522310
2353 if (priv->fullsize == FALSE)2311 if (priv->fullsize == FALSE)
2354 os_pager_show (OS_PAGER (priv->pager));2312 os_pager_show (priv->pager);
23552313
2356 if (gtk_widget_get_realized (widget) && priv->filter == FALSE)2314 if (gtk_widget_get_realized (widget) && priv->filter == FALSE)
2357 {2315 {
@@ -2388,7 +2346,7 @@
23882346
2389 calc_layout_pager (scrollbar, gtk_adjustment_get_value (priv->adjustment));2347 calc_layout_pager (scrollbar, gtk_adjustment_get_value (priv->adjustment));
23902348
2391 os_pager_set_parent (OS_PAGER (priv->pager), widget);2349 os_pager_set_parent (priv->pager, widget);
23922350
2393 store_toplevel_position (scrollbar);2351 store_toplevel_position (scrollbar);
2394}2352}
@@ -2403,46 +2361,43 @@
2403os_scrollbar_size_allocate (GtkWidget *widget,2361os_scrollbar_size_allocate (GtkWidget *widget,
2404 GdkRectangle *allocation)2362 GdkRectangle *allocation)
2405{2363{
2406 GdkRectangle rect;
2407 OsScrollbar *scrollbar;2364 OsScrollbar *scrollbar;
2408 OsScrollbarPrivate *priv;2365 OsScrollbarPrivate *priv;
24092366
2410 scrollbar = OS_SCROLLBAR (widget);2367 scrollbar = OS_SCROLLBAR (widget);
2411 priv = scrollbar->priv;2368 priv = scrollbar->priv;
24122369
2413 priv->trough.x = 0;2370 priv->trough.x = allocation->x;
2414 priv->trough.y = 0;2371 priv->trough.y = allocation->y;
2415 priv->trough.width = allocation->width;2372 priv->trough.width = allocation->width;
2416 priv->trough.height = allocation->height;2373 priv->trough.height = allocation->height;
24172374
2418 priv->overlay_all = *allocation;2375 priv->pager_all = *allocation;
2419 priv->thumb_all = *allocation;2376 priv->thumb_all = *allocation;
24202377
2421 if (priv->orientation == GTK_ORIENTATION_VERTICAL)2378 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
2422 {2379 {
2423 priv->slider.width = DEFAULT_THUMB_WIDTH;2380 priv->slider.width = THUMB_WIDTH;
2424 priv->slider.height = DEFAULT_THUMB_HEIGHT;2381 priv->slider.height = THUMB_HEIGHT;
2425 priv->overlay_all.x = allocation->x - DEFAULT_PAGER_WIDTH;2382
2383 priv->pager_all.x = allocation->x - PAGER_SIZE;
2384 priv->pager_all.width = PAGER_SIZE;
2385
2426 priv->thumb_all.x = allocation->x + THUMB_ALLOCATION_SHIFT;2386 priv->thumb_all.x = allocation->x + THUMB_ALLOCATION_SHIFT;
24272387 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;
24322388
2433 allocation->width = 0;2389 allocation->width = 0;
2434 }2390 }
2435 else2391 else
2436 {2392 {
2437 priv->slider.width = DEFAULT_THUMB_HEIGHT;2393 priv->slider.width = THUMB_HEIGHT;
2438 priv->slider.height = DEFAULT_THUMB_WIDTH;2394 priv->slider.height = THUMB_WIDTH;
2439 priv->overlay_all.y = allocation->y - DEFAULT_PAGER_WIDTH;2395
2396 priv->pager_all.y = allocation->y - PAGER_SIZE;
2397 priv->pager_all.height = PAGER_SIZE;
2398
2440 priv->thumb_all.y = allocation->y + THUMB_ALLOCATION_SHIFT;2399 priv->thumb_all.y = allocation->y + THUMB_ALLOCATION_SHIFT;
24412400 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;
24462401
2447 allocation->height = 0;2402 allocation->height = 0;
2448 }2403 }
@@ -2453,7 +2408,7 @@
2453 calc_layout_slider (scrollbar, gtk_adjustment_get_value (priv->adjustment));2408 calc_layout_slider (scrollbar, gtk_adjustment_get_value (priv->adjustment));
2454 }2409 }
24552410
2456 os_pager_size_allocate (OS_PAGER (priv->pager), rect);2411 os_pager_size_allocate (priv->pager, priv->pager_all);
24572412
2458 move_pager (scrollbar);2413 move_pager (scrollbar);
24592414
@@ -2496,7 +2451,7 @@
24962451
2497 priv->proximity = FALSE;2452 priv->proximity = FALSE;
24982453
2499 os_pager_hide (OS_PAGER (priv->pager));2454 os_pager_hide (priv->pager);
25002455
2501 gtk_widget_hide (priv->thumb);2456 gtk_widget_hide (priv->thumb);
25022457
@@ -2517,7 +2472,7 @@
2517 scrollbar = OS_SCROLLBAR (widget);2472 scrollbar = OS_SCROLLBAR (widget);
2518 priv = scrollbar->priv;2473 priv = scrollbar->priv;
25192474
2520 os_pager_hide (OS_PAGER (priv->pager));2475 os_pager_hide (priv->pager);
25212476
2522 gtk_widget_hide (priv->thumb);2477 gtk_widget_hide (priv->thumb);
25232478
@@ -2527,7 +2482,7 @@
2527 g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_toplevel (widget)),2482 g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_toplevel (widget)),
2528 G_CALLBACK (toplevel_configure_event_cb), scrollbar);2483 G_CALLBACK (toplevel_configure_event_cb), scrollbar);
25292484
2530 os_pager_set_parent (OS_PAGER (priv->pager), NULL);2485 os_pager_set_parent (priv->pager, NULL);
25312486
2532 window_group_list = gtk_window_group_list_windows (priv->window_group);2487 window_group_list = gtk_window_group_list_windows (priv->window_group);
25332488
25342489
=== modified file 'os/os-thumb.c'
--- os/os-thumb.c 2011-06-09 11:19:20 +0000
+++ os/os-thumb.c 2011-06-15 12:09:58 +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