Merge lp:~cimi/overlay-scrollbar/deal-with-small-heights into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Ted Gould
Approved revision: 267
Merged at revision: 267
Proposed branch: lp:~cimi/overlay-scrollbar/deal-with-small-heights
Merge into: lp:overlay-scrollbar
Diff against target: 100 lines (+42/-4)
3 files modified
os/os-private.h (+4/-0)
os/os-scrollbar.c (+20/-4)
os/os-thumb.c (+18/-0)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/deal-with-small-heights
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+66027@code.launchpad.net

Description of the change

See the commit

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-private.h'
2--- os/os-private.h 2011-06-15 12:07:47 +0000
3+++ os/os-private.h 2011-06-27 17:07:42 +0000
4@@ -175,6 +175,10 @@
5
6 GtkWidget* os_thumb_new (GtkOrientation orientation);
7
8+void os_thumb_resize (OsThumb *thumb,
9+ gint width,
10+ gint height);
11+
12 void os_thumb_set_detached (OsThumb *thumb,
13 gboolean detached);
14
15
16=== modified file 'os/os-scrollbar.c'
17--- os/os-scrollbar.c 2011-06-27 13:37:17 +0000
18+++ os/os-scrollbar.c 2011-06-27 17:07:42 +0000
19@@ -2310,7 +2310,11 @@
20 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
21 *minimal_width = *natural_width = 0;
22 else
23- GTK_WIDGET_CLASS (os_scrollbar_parent_class)->get_preferred_width (widget, minimal_width, natural_width);
24+ {
25+ /* smaller than 35 pixels the thumb looks weird. */
26+ *minimal_width = 35;
27+ *natural_width = THUMB_HEIGHT;
28+ }
29 }
30
31 static void
32@@ -2327,7 +2331,11 @@
33 if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
34 *minimal_height = *natural_height = 0;
35 else
36- GTK_WIDGET_CLASS (os_scrollbar_parent_class)->get_preferred_height (widget, minimal_height, natural_height);
37+ {
38+ /* smaller than 35 pixels the thumb looks weird. */
39+ *minimal_height = 35;
40+ *natural_height = THUMB_HEIGHT;
41+ }
42 }
43 #endif
44
45@@ -2461,7 +2469,11 @@
46 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
47 {
48 priv->slider.width = THUMB_WIDTH;
49- priv->slider.height = THUMB_HEIGHT;
50+ if (priv->slider.height != MIN (THUMB_HEIGHT, allocation->height))
51+ {
52+ priv->slider.height = MIN (THUMB_HEIGHT, allocation->height);
53+ os_thumb_resize (OS_THUMB (priv->thumb), priv->slider.width, priv->slider.height);
54+ }
55
56 priv->pager_all.x = allocation->x - PAGER_SIZE;
57 priv->pager_all.width = PAGER_SIZE;
58@@ -2473,8 +2485,12 @@
59 }
60 else
61 {
62- priv->slider.width = THUMB_HEIGHT;
63 priv->slider.height = THUMB_WIDTH;
64+ if (priv->slider.width != MIN (THUMB_HEIGHT, allocation->width))
65+ {
66+ priv->slider.width = MIN (THUMB_HEIGHT, allocation->width);
67+ os_thumb_resize (OS_THUMB (priv->thumb), priv->slider.width, priv->slider.height);
68+ }
69
70 priv->pager_all.y = allocation->y - PAGER_SIZE;
71 priv->pager_all.height = PAGER_SIZE;
72
73=== modified file 'os/os-thumb.c'
74--- os/os-thumb.c 2011-06-27 16:02:50 +0000
75+++ os/os-thumb.c 2011-06-27 17:07:42 +0000
76@@ -855,6 +855,24 @@
77 }
78
79 /**
80+ * os_thumb_resize:
81+ * @thumb: a #OsThumb
82+ * @width: width in pixels
83+ * @height: height in pixels
84+ *
85+ * Resize the thumb.
86+ **/
87+void
88+os_thumb_resize (OsThumb *thumb,
89+ gint width,
90+ gint height)
91+{
92+ g_return_if_fail (OS_THUMB (thumb));
93+
94+ gtk_window_resize (GTK_WINDOW (thumb), width, height);
95+}
96+
97+/**
98 * os_thumb_set_detached:
99 * @thumb: a #OsThumb
100 * @detached: a gboolean

Subscribers

People subscribed via source and target branches