Merge lp:~malaperle/overlay-scrollbar/default into lp:overlay-scrollbar

Proposed by Marc-Andre Laperle
Status: Needs review
Proposed branch: lp:~malaperle/overlay-scrollbar/default
Merge into: lp:overlay-scrollbar
Diff against target: 64 lines (+23/-2)
1 file modified
os/os-scrollbar.c (+23/-2)
To merge this branch: bzr merge lp:~malaperle/overlay-scrollbar/default
Reviewer Review Type Date Requested Status
Adolfo Jayme Barrientos (community) Abstain
Ayatana Scrollbar Team Pending
Review via email: mp+175867@code.launchpad.net

This proposal supersedes a proposal from 2013-07-18.

Description of the change

Fix scrollbar not visible when it's the only child in a container.

To post a comment you must log in.
Revision history for this message
Adolfo Jayme Barrientos (fitojb) wrote : Posted in a previous version of this proposal

Please rebase your branch and resolve conflicts :-)

review: Needs Fixing
Revision history for this message
Adolfo Jayme Barrientos (fitojb) wrote :

Thank you very much for sending this fix, and for keeping up with trunk! Looks sensible to me, but someone from the team must review this :-)

review: Abstain
Revision history for this message
Marc-Andre Laperle (malaperle) wrote :

Is there any way I can improve my fix or help with the review process? Should I add more comments to explain the issue?

Thanks!

Unmerged revisions

379. By Marc-Andre Laperle

Scrollbar not visible when it's the only child in a container (LP: #1188831)

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 2013-02-05 22:44:35 +0000
3+++ os/os-scrollbar.c 2013-07-19 15:43:30 +0000
4@@ -3712,6 +3712,8 @@
5 if (priv->side == OS_SIDE_RIGHT)
6 priv->bar_all.x = allocation->x - BAR_SIZE;
7
8+ priv->bar_all.x = MAX(priv->bar_all.x, 0);
9+
10 priv->bar_all.width = BAR_SIZE;
11
12 priv->thumb_all.width = THUMB_WIDTH;
13@@ -3721,6 +3723,8 @@
14 else
15 priv->thumb_all.x = allocation->x + priv->bar_all.width - priv->thumb_all.width;
16
17+ priv->thumb_all.x = MAX(priv->thumb_all.x, 0);
18+
19 allocation->width = 0;
20 }
21 else
22@@ -3735,6 +3739,8 @@
23 if (priv->side == OS_SIDE_BOTTOM)
24 priv->bar_all.y = allocation->y - BAR_SIZE;
25
26+ priv->bar_all.y = MAX(priv->bar_all.y, 0);
27+
28 priv->bar_all.height = BAR_SIZE;
29
30 priv->thumb_all.height = THUMB_WIDTH;
31@@ -3744,6 +3750,8 @@
32 else
33 priv->thumb_all.y = allocation->y + priv->bar_all.height - priv->thumb_all.height;
34
35+ priv->thumb_all.y = MAX(priv->thumb_all.y, 0);
36+
37 allocation->height = 0;
38 }
39
40@@ -3930,10 +3938,23 @@
41
42 priv = get_private (widget);
43
44+ int requested_bar_size = 0;
45+
46+ /* If the scrollbar is alone in a container, make sure it requests
47+ * some size so that it gets drawn */
48+ GtkWidget* parent = gtk_widget_get_parent (widget);
49+ if (!GTK_IS_SCROLLED_WINDOW (parent))
50+ {
51+ GList* list = gtk_container_get_children(GTK_CONTAINER(parent));
52+ if (!list->next)
53+ requested_bar_size = BAR_SIZE;
54+ g_list_free (list);
55+ }
56+
57 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
58- requisition->width = 0;
59+ requisition->width = requested_bar_size;
60 else
61- requisition->height = 0;
62+ requisition->height = requested_bar_size;
63
64 widget->requisition = *requisition;
65

Subscribers

People subscribed via source and target branches