Merge lp:~cimi/overlay-scrollbar/fix-838733 into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Ted Gould
Approved revision: 304
Merged at revision: 304
Proposed branch: lp:~cimi/overlay-scrollbar/fix-838733
Merge into: lp:overlay-scrollbar
Diff against target: 67 lines (+20/-3)
1 file modified
os/os-scrollbar.c (+20/-3)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/fix-838733
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+73711@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve
305. By Andrea Cimitan

Dots

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-08-24 18:34:08 +0000
3+++ os/os-scrollbar.c 2011-09-01 18:52:40 +0000
4@@ -42,8 +42,11 @@
5 /* Rate of the paging. */
6 #define RATE_PAGING 30
7
8-/* Duration of the paging. */
9-#define DURATION_PAGING 1000
10+/* Max duration of the paging. */
11+#define MAX_DURATION_PAGING 1000
12+
13+/* Min duration of the paging. */
14+#define MIN_DURATION_PAGING 250
15
16 /* Timeout assumed for PropertyNotify _NET_ACTIVE_WINDOW event. */
17 #define TIMEOUT_PRESENT_WINDOW 400
18@@ -1295,6 +1298,7 @@
19 {
20 OsScrollbarPrivate *priv;
21 gdouble new_value;
22+ gint32 duration;
23
24 priv = scrollbar->priv;
25
26@@ -1313,6 +1317,12 @@
27 gtk_adjustment_get_lower (priv->adjustment),
28 gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment));
29
30+ /* calculate and set the duration. */
31+ duration = MIN_DURATION_PAGING + ((priv->value - gtk_adjustment_get_value (priv->adjustment)) /
32+ gtk_adjustment_get_page_increment (priv->adjustment)) *
33+ (MAX_DURATION_PAGING - MIN_DURATION_PAGING);
34+ os_animation_set_duration (priv->animation, duration);
35+
36 /* start the paging animation. */
37 os_animation_start (priv->animation);
38 }
39@@ -1323,6 +1333,7 @@
40 {
41 OsScrollbarPrivate *priv;
42 gdouble new_value;
43+ gint32 duration;
44
45 priv = scrollbar->priv;
46
47@@ -1341,6 +1352,12 @@
48 gtk_adjustment_get_lower (priv->adjustment),
49 gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment));
50
51+ /* calculate and set the duration. */
52+ duration = MIN_DURATION_PAGING + ((gtk_adjustment_get_value (priv->adjustment) - priv->value) /
53+ gtk_adjustment_get_page_increment (priv->adjustment)) *
54+ (MAX_DURATION_PAGING - MIN_DURATION_PAGING);
55+ os_animation_set_duration (priv->animation, duration);
56+
57 /* start the paging animation. */
58 os_animation_start (priv->animation);
59 }
60@@ -2639,7 +2656,7 @@
61
62 priv->window_group = gtk_window_group_new ();
63
64- priv->animation = os_animation_new (RATE_PAGING, DURATION_PAGING,
65+ priv->animation = os_animation_new (RATE_PAGING, MAX_DURATION_PAGING,
66 paging_cb, NULL, scrollbar);
67 priv->value = 0;
68

Subscribers

People subscribed via source and target branches