Merge lp:~cimi/overlay-scrollbar/new-locked-mode into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Ted Gould
Approved revision: 320
Merged at revision: 318
Proposed branch: lp:~cimi/overlay-scrollbar/new-locked-mode
Merge into: lp:overlay-scrollbar
Diff against target: 67 lines (+25/-4)
1 file modified
os/os-scrollbar.c (+25/-4)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/new-locked-mode
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+84017@code.launchpad.net

Description of the change

Enlarge the proximity area in internal mode, and unset the state flag on unmap, might fix possible warnings

To post a comment you must log in.
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-scrollbar.c'
2--- os/os-scrollbar.c 2011-11-30 16:30:54 +0000
3+++ os/os-scrollbar.c 2011-11-30 21:22:24 +0000
4@@ -2068,6 +2068,7 @@
5
6 priv->event = OS_EVENT_NONE;
7 priv->hidable_thumb = TRUE;
8+ priv->state &= OS_STATE_FULLSIZE;
9
10 /* Remove running hide timeout, if there is one. */
11 if (priv->source_hide_thumb_id != 0)
12@@ -2316,31 +2317,51 @@
13 gint y)
14 {
15 OsScrollbarPrivate *priv;
16+ gint proximity_size;
17
18 priv = scrollbar->priv;
19
20+ proximity_size = PROXIMITY_SIZE;
21+
22+ /* If the thumb is internal, enlarge the proximity area. */
23+ if (priv->state & OS_STATE_INTERNAL)
24+ {
25+ gint x_pos, y_pos;
26+
27+ gdk_window_get_origin (gtk_widget_get_window (priv->thumb), &x_pos, &y_pos);
28+
29+ /* This absolute value to add is obtained subtracting
30+ * the real position of the thumb from the theoretical position.
31+ * This difference should consist exactly in the amount of pixels (of the thumb)
32+ * falling in the proximity, that is the value we want to enlarge this area. */
33+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
34+ proximity_size += abs (priv->thumb_win.x - x_pos);
35+ else
36+ proximity_size += abs (priv->thumb_win.y - y_pos);
37+ }
38+
39 switch (priv->side)
40 {
41 case OS_SIDE_RIGHT:
42- return (x >= priv->bar_all.x + priv->bar_all.width - PROXIMITY_SIZE &&
43+ return (x >= priv->bar_all.x + priv->bar_all.width - proximity_size &&
44 x <= priv->bar_all.x + priv->bar_all.width) &&
45 (y >= priv->bar_all.y &&
46 y <= priv->bar_all.y + priv->bar_all.height);
47 break;
48 case OS_SIDE_BOTTOM:
49- return (y >= priv->bar_all.y + priv->bar_all.height - PROXIMITY_SIZE &&
50+ return (y >= priv->bar_all.y + priv->bar_all.height - proximity_size &&
51 y <= priv->bar_all.y + priv->bar_all.height) &&
52 (x >= priv->bar_all.x &&
53 x <= priv->bar_all.x + priv->bar_all.width);
54 break;
55 case OS_SIDE_LEFT:
56- return (x <= priv->bar_all.x + priv->bar_all.width + PROXIMITY_SIZE &&
57+ return (x <= priv->bar_all.x + priv->bar_all.width + proximity_size &&
58 x >= priv->bar_all.x) &&
59 (y >= priv->bar_all.y &&
60 y <= priv->bar_all.y + priv->bar_all.height);
61 break;
62 case OS_SIDE_TOP:
63- return (y <= priv->bar_all.y + priv->bar_all.height + PROXIMITY_SIZE &&
64+ return (y <= priv->bar_all.y + priv->bar_all.height + proximity_size &&
65 y >= priv->bar_all.y) &&
66 (x >= priv->bar_all.x &&
67 x <= priv->bar_all.x + priv->bar_all.width);

Subscribers

People subscribed via source and target branches