Merge lp:~cimi/overlay-scrollbar/scrolled-window-offset into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Merged at revision: 156
Proposed branch: lp:~cimi/overlay-scrollbar/scrolled-window-offset
Merge into: lp:overlay-scrollbar
Diff against target: 74 lines (+22/-8)
1 file modified
os/os-scrollbar.c (+22/-8)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/scrolled-window-offset
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+53061@code.launchpad.net

Description of the change

checks for scrolled window on parent set, eventually applies an offset

To post a comment you must log in.
156. By Andrea Cimitan

check at allocation, because the shadow type may change after swap_parent

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

12 + if (GTK_SCROLLED_WINDOW (priv->parent) &&
13 + gtk_scrolled_window_get_shadow_type (GTK_SCROLLED_WINDOW (priv->parent)) != GTK_SHADOW_NONE)
14 + offset = 1;

Is guess you mean GTK_IS_SCROLLED_WINDOW() here and not just GTK_SCROLLED_WINDOW()

49 + if (GTK_SCROLLED_WINDOW (widget) &&
50 + gtk_scrolled_window_get_shadow_type (GTK_SCROLLED_WINDOW (widget)) != GTK_SHADOW_NONE)
51 + offset = 1;

Ditto.

Otherwise looks good to me, so conditionally approved with ^^ fixed :-)

review: Approve
Revision history for this message
Andrea Cimitan (cimi) wrote :

yup typo :) that's why reviews are useful :D

157. By Andrea Cimitan

Fixes typo (thx kamstrup for noticing this!)

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-03-14 15:37:53 +0000
3+++ os/os-scrollbar.c 2011-03-15 15:38:45 +0000
4@@ -881,21 +881,28 @@
5 {
6 GdkRectangle rect;
7 OsScrollbarPrivate *priv;
8+ gint offset;
9
10 priv = scrollbar->priv;
11
12+ if (GTK_IS_SCROLLED_WINDOW (priv->parent) &&
13+ gtk_scrolled_window_get_shadow_type (GTK_SCROLLED_WINDOW (priv->parent)) != GTK_SHADOW_NONE)
14+ offset = 1;
15+ else
16+ offset = 0;
17+
18 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
19 {
20 rect.x = priv->overlay_all.x;
21- rect.y = priv->overlay_all.y + 1;
22+ rect.y = priv->overlay_all.y + offset;
23 rect.width = DEFAULT_PAGER_WIDTH;
24- rect.height = priv->overlay_all.height - 2;
25+ rect.height = priv->overlay_all.height - offset * 2;
26 }
27 else
28 {
29- rect.x = priv->overlay_all.x + 1;
30+ rect.x = priv->overlay_all.x + offset;
31 rect.y = priv->overlay_all.y;
32- rect.width = priv->overlay_all.width - 2;
33+ rect.width = priv->overlay_all.width - offset * 2;
34 rect.height = DEFAULT_PAGER_WIDTH;
35 }
36
37@@ -1000,6 +1007,7 @@
38 {
39 OsScrollbar *scrollbar;
40 OsScrollbarPrivate *priv;
41+ gint offset;
42
43 scrollbar = OS_SCROLLBAR (user_data);
44 priv = scrollbar->priv;
45@@ -1012,19 +1020,25 @@
46 priv->overlay_all = *allocation;
47 priv->thumb_all = *allocation;
48
49+ if (GTK_IS_SCROLLED_WINDOW (widget) &&
50+ gtk_scrolled_window_get_shadow_type (GTK_SCROLLED_WINDOW (widget)) != GTK_SHADOW_NONE)
51+ offset = 1;
52+ else
53+ offset = 0;
54+
55 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
56 {
57 priv->slider.width = DEFAULT_SCROLLBAR_WIDTH;
58 priv->slider.height = DEFAULT_SCROLLBAR_HEIGHT;
59- priv->overlay_all.x = allocation->x + allocation->width - DEFAULT_PAGER_WIDTH - 1;
60- priv->thumb_all.x = allocation->x + allocation->width - 1;
61+ priv->overlay_all.x = allocation->x + allocation->width - DEFAULT_PAGER_WIDTH - offset;
62+ priv->thumb_all.x = allocation->x + allocation->width - offset;
63 }
64 else
65 {
66 priv->slider.width = DEFAULT_SCROLLBAR_HEIGHT;
67 priv->slider.height = DEFAULT_SCROLLBAR_WIDTH;
68- priv->overlay_all.y = allocation->y + allocation->height - DEFAULT_PAGER_WIDTH - 1;
69- priv->thumb_all.y = allocation->y + allocation->height - 1;
70+ priv->overlay_all.y = allocation->y + allocation->height - DEFAULT_PAGER_WIDTH - offset;
71+ priv->thumb_all.y = allocation->y + allocation->height - offset;
72 }
73
74 if (priv->adjustment != NULL)

Subscribers

People subscribed via source and target branches