1 === modified file 'gtk/gtkhscrollbar.c'
2 Index: gtk+3.0-3.1.16/gtk/gtkhscrollbar.c
3 ===================================================================
4 --- gtk+3.0-3.1.16.orig/gtk/gtkhscrollbar.c 2011-09-05 08:52:01.439554654 +0200
5 +++ gtk+3.0-3.1.16/gtk/gtkhscrollbar.c 2011-09-05 08:52:44.339554938 +0200
7 #include "gtkorientable.h"
10 +static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
11 +static gboolean use_overlay_scrollbar = FALSE;
14 * SECTION:gtkhscrollbar
16 g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
19 + if (use_overlay_scrollbar)
20 + return os_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
22 return g_object_new (GTK_TYPE_HSCROLLBAR,
23 "adjustment", adjustment,
28 + * ubuntu_gtk_hscrollbar_init:
30 + * Initialize local use of the overlay-scrollbar module.
32 + * If the module is installed, this code checks both a whitelist
33 + * and a blacklist to decide whether to activate the remplacement
36 + * It is possible to force the feature to be disabled by setting
37 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
41 +ubuntu_gtk_hscrollbar_init (void)
43 + static gboolean init_once = FALSE;
45 + if (init_once == FALSE)
47 + GModule *module = NULL;
48 + gpointer symbol = NULL;
50 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
52 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
53 + and disable the feature in this case */
54 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
57 + /* default extension library to use for this release */
58 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
60 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
64 + /* check the blacklist, in all cases */
65 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
67 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
68 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
72 + /* all controls are positive: the feature can be activated now */
73 + if (g_module_symbol (module, "os_scrollbar_new", &symbol))
75 + os_scrollbar_new = symbol;
76 + use_overlay_scrollbar = TRUE;
83 Index: gtk+3.0-3.1.16/gtk/gtkhscrollbar.h
84 ===================================================================
85 --- gtk+3.0-3.1.16.orig/gtk/gtkhscrollbar.h 2011-09-05 08:52:01.459554651 +0200
86 +++ gtk+3.0-3.1.16/gtk/gtkhscrollbar.h 2011-09-05 08:52:44.339554938 +0200
89 GType gtk_hscrollbar_get_type (void) G_GNUC_CONST;
90 GtkWidget* gtk_hscrollbar_new (GtkAdjustment *adjustment);
91 +void ubuntu_gtk_hscrollbar_init (void);
95 Index: gtk+3.0-3.1.16/gtk/gtkmain.c
96 ===================================================================
97 --- gtk+3.0-3.1.16.orig/gtk/gtkmain.c 2011-09-05 08:52:19.209554770 +0200
98 +++ gtk+3.0-3.1.16/gtk/gtkmain.c 2011-09-05 08:52:44.349554937 +0200
101 _gtk_accel_map_init ();
103 + ubuntu_gtk_scrolled_window_init ();
104 + ubuntu_gtk_scrollbar_init ();
105 + ubuntu_gtk_hscrollbar_init ();
106 + ubuntu_gtk_vscrollbar_init ();
108 /* Set the 'initialized' flag.
110 gtk_initialized = TRUE;
111 Index: gtk+3.0-3.1.16/gtk/gtkscrollbar.c
112 ===================================================================
113 --- gtk+3.0-3.1.16.orig/gtk/gtkscrollbar.c 2011-09-05 08:52:01.499554651 +0200
114 +++ gtk+3.0-3.1.16/gtk/gtkscrollbar.c 2011-09-05 08:52:44.349554937 +0200
117 static void gtk_scrollbar_style_updated (GtkWidget *widget);
119 +static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
120 +static gboolean use_overlay_scrollbar = FALSE;
122 G_DEFINE_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
126 g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
129 + if (use_overlay_scrollbar)
130 + return os_scrollbar_new (orientation, adjustment);
132 return g_object_new (GTK_TYPE_SCROLLBAR,
133 "orientation", orientation,
134 "adjustment", adjustment,
139 + * ubuntu_gtk_scrollbar_init:
141 + * Initialize local use of the overlay-scrollbar module.
143 + * If the module is installed, this code checks both a whitelist
144 + * and a blacklist to decide whether to activate the remplacement
147 + * It is possible to force the feature to be disabled by setting
148 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
152 +ubuntu_gtk_scrollbar_init (void)
154 + static gboolean init_once = FALSE;
156 + if (init_once == FALSE)
158 + GModule *module = NULL;
159 + gpointer symbol = NULL;
161 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
163 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
164 + and disable the feature in this case */
165 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
168 + /* default extension library to use for this release */
169 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
171 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
172 + if (module == NULL)
175 + /* check the blacklist, in all cases */
176 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
178 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
179 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
183 + /* all controls are positive: the feature can be activated now */
184 + if (g_module_symbol (module, "os_scrollbar_new", &symbol))
186 + os_scrollbar_new = symbol;
187 + use_overlay_scrollbar = TRUE;
194 Index: gtk+3.0-3.1.16/gtk/gtkscrollbar.h
195 ===================================================================
196 --- gtk+3.0-3.1.16.orig/gtk/gtkscrollbar.h 2011-09-05 08:52:01.539554654 +0200
197 +++ gtk+3.0-3.1.16/gtk/gtkscrollbar.h 2011-09-05 08:52:44.349554937 +0200
199 GType gtk_scrollbar_get_type (void) G_GNUC_CONST;
200 GtkWidget * gtk_scrollbar_new (GtkOrientation orientation,
201 GtkAdjustment *adjustment);
202 +void ubuntu_gtk_scrollbar_init (void);
206 Index: gtk+3.0-3.1.16/gtk/gtkscrolledwindow.c
207 ===================================================================
208 --- gtk+3.0-3.1.16.orig/gtk/gtkscrolledwindow.c 2011-09-05 08:52:01.429554652 +0200
209 +++ gtk+3.0-3.1.16/gtk/gtkscrolledwindow.c 2011-09-05 08:52:44.349554937 +0200
212 static guint signals[LAST_SIGNAL] = {0};
214 +static gboolean use_overlay_scrollbar = FALSE;
216 G_DEFINE_TYPE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
219 @@ -1212,7 +1214,7 @@
221 gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
223 - if (!scrollbars_within_bevel)
224 + if (!scrollbars_within_bevel && !use_overlay_scrollbar)
227 GtkBorder padding, border;
228 @@ -1768,7 +1770,7 @@
230 if (priv->shadow_type != GTK_SHADOW_NONE)
232 - if (!scrollbars_within_bevel)
233 + if (!scrollbars_within_bevel && !use_overlay_scrollbar)
235 child_allocation.x -= padding.left + border.left;
236 child_allocation.width += padding.left + padding.right + border.left + border.right;
237 @@ -1816,7 +1818,7 @@
239 if (priv->shadow_type != GTK_SHADOW_NONE)
241 - if (!scrollbars_within_bevel)
242 + if (!scrollbars_within_bevel && !use_overlay_scrollbar)
244 child_allocation.y -= padding.top + border.top;
245 child_allocation.height += padding.top + padding.bottom + border.top + border.bottom;
246 @@ -2057,6 +2059,58 @@
250 + * ubuntu_gtk_scrolled_window_init:
252 + * Initialize local use of the overlay-scrollbar module.
254 + * If the module is installed, this code checks both a whitelist
255 + * and a blacklist to decide whether to activate the remplacement
258 + * It is possible to force the feature to be disabled by setting
259 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
263 +ubuntu_gtk_scrolled_window_init (void)
265 + static gboolean init_once = FALSE;
267 + if (init_once == FALSE)
269 + GModule *module = NULL;
270 + gpointer symbol = NULL;
272 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
274 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
275 + and disable the feature in this case */
276 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
279 + /* default extension library to use for this release */
280 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
282 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
283 + if (module == NULL)
286 + /* check the blacklist, in all cases */
287 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
289 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
290 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
294 + use_overlay_scrollbar = TRUE;
302 * _gtk_scrolled_window_get_spacing:
303 * @scrolled_window: a scrolled window
305 @@ -2072,6 +2126,9 @@
307 g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
309 + if (use_overlay_scrollbar)
312 class = GTK_SCROLLED_WINDOW_GET_CLASS (scrolled_window);
314 if (class->scrollbar_spacing >= 0)
315 Index: gtk+3.0-3.1.16/gtk/gtkscrolledwindow.h
316 ===================================================================
317 --- gtk+3.0-3.1.16.orig/gtk/gtkscrolledwindow.h 2011-09-05 08:52:01.519554653 +0200
318 +++ gtk+3.0-3.1.16/gtk/gtkscrolledwindow.h 2011-09-05 08:52:44.349554937 +0200
322 gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
323 +void ubuntu_gtk_scrolled_window_init (void);
327 Index: gtk+3.0-3.1.16/gtk/gtkvscrollbar.c
328 ===================================================================
329 --- gtk+3.0-3.1.16.orig/gtk/gtkvscrollbar.c 2011-09-05 08:52:01.469554652 +0200
330 +++ gtk+3.0-3.1.16/gtk/gtkvscrollbar.c 2011-09-05 08:52:44.349554937 +0200
332 #include "gtkvscrollbar.h"
335 +static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
336 +static gboolean use_overlay_scrollbar = FALSE;
339 * SECTION:gtkvscrollbar
341 g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
344 + if (use_overlay_scrollbar)
345 + return os_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjustment);
347 return g_object_new (GTK_TYPE_VSCROLLBAR,
348 "adjustment", adjustment,
353 + * ubuntu_gtk_vscrollbar_init:
355 + * Initialize local use of the overlay-scrollbar module.
357 + * If the module is installed, this code checks both a whitelist
358 + * and a blacklist to decide whether to activate the remplacement
361 + * It is possible to force the feature to be disabled by setting
362 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
366 +ubuntu_gtk_vscrollbar_init (void)
368 + static gboolean init_once = FALSE;
370 + if (init_once == FALSE)
372 + GModule *module = NULL;
373 + gpointer symbol = NULL;
375 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
377 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
378 + and disable the feature in this case */
379 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
382 + /* default extension library to use for this release */
383 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
385 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
386 + if (module == NULL)
389 + /* check the blacklist, in all cases */
390 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
392 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
393 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
397 + /* all controls are positive: the feature can be activated now */
398 + if (g_module_symbol (module, "os_scrollbar_new", &symbol))
400 + os_scrollbar_new = symbol;
401 + use_overlay_scrollbar = TRUE;
408 Index: gtk+3.0-3.1.16/gtk/gtkvscrollbar.h
409 ===================================================================
410 --- gtk+3.0-3.1.16.orig/gtk/gtkvscrollbar.h 2011-09-05 08:52:01.479554654 +0200
411 +++ gtk+3.0-3.1.16/gtk/gtkvscrollbar.h 2011-09-05 08:52:44.349554937 +0200
414 GType gtk_vscrollbar_get_type (void) G_GNUC_CONST;
415 GtkWidget* gtk_vscrollbar_new (GtkAdjustment *adjustment);
416 +void ubuntu_gtk_vscrollbar_init (void);