1 Index: gtk+-3.0.9/gtk/gtkhscrollbar.c
2 ===================================================================
3 --- gtk+-3.0.9.orig/gtk/gtkhscrollbar.c 2011-06-06 22:01:31.455723443 +0200
4 +++ gtk+-3.0.9/gtk/gtkhscrollbar.c 2011-06-06 19:54:05.177807603 +0200
6 #include "gtkorientable.h"
9 +static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
10 +static gboolean use_overlay_scrollbar = FALSE;
12 G_DEFINE_TYPE (GtkHScrollbar, gtk_hscrollbar, GTK_TYPE_SCROLLBAR)
15 g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
18 + if (use_overlay_scrollbar)
19 + return os_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
21 return g_object_new (GTK_TYPE_HSCROLLBAR,
22 "adjustment", adjustment,
27 + * ubuntu_gtk_hscrollbar_init:
29 + * Initialize local use of the overlay-scrollbar module.
31 + * If the module is installed, this code checks both a whitelist
32 + * and a blacklist to decide whether to activate the remplacement
35 + * It is possible to force the feature to be disabled by setting
36 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
40 +ubuntu_gtk_hscrollbar_init (void)
42 + static gboolean init_once = FALSE;
44 + if (init_once == FALSE)
46 + GModule *module = NULL;
47 + gpointer symbol = NULL;
49 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
51 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
52 + and disable the feature in this case */
53 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
56 + /* default extension library to use for this release */
57 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
59 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
63 + /* check the blacklist, in all cases */
64 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
66 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
67 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
71 + /* all controls are positive: the feature can be activated now */
72 + if (g_module_symbol (module, "os_scrollbar_new", &symbol))
74 + os_scrollbar_new = symbol;
75 + use_overlay_scrollbar = TRUE;
82 Index: gtk+-3.0.9/gtk/gtkhscrollbar.h
83 ===================================================================
84 --- gtk+-3.0.9.orig/gtk/gtkhscrollbar.h 2011-06-06 22:01:31.479723561 +0200
85 +++ gtk+-3.0.9/gtk/gtkhscrollbar.h 2011-06-06 19:54:26.889915270 +0200
88 GType gtk_hscrollbar_get_type (void) G_GNUC_CONST;
89 GtkWidget* gtk_hscrollbar_new (GtkAdjustment *adjustment);
90 +void ubuntu_gtk_hscrollbar_init (void);
94 Index: gtk+-3.0.9/gtk/gtkmain.c
95 ===================================================================
96 --- gtk+-3.0.9.orig/gtk/gtkmain.c 2011-06-06 22:01:31.435723345 +0200
97 +++ gtk+-3.0.9/gtk/gtkmain.c 2011-06-06 19:55:18.630171830 +0200
100 _gtk_accel_map_init ();
102 + ubuntu_gtk_scrolled_window_init ();
103 + ubuntu_gtk_scrollbar_init ();
104 + ubuntu_gtk_hscrollbar_init ();
105 + ubuntu_gtk_vscrollbar_init ();
107 /* Set the 'initialized' flag.
109 gtk_initialized = TRUE;
110 Index: gtk+-3.0.9/gtk/gtkscrollbar.c
111 ===================================================================
112 --- gtk+-3.0.9.orig/gtk/gtkscrollbar.c 2011-06-06 22:01:31.579724063 +0200
113 +++ gtk+-3.0.9/gtk/gtkscrollbar.c 2011-06-06 19:57:52.322933951 +0200
116 static void gtk_scrollbar_style_updated (GtkWidget *widget);
118 +static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
119 +static gboolean use_overlay_scrollbar = FALSE;
121 G_DEFINE_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
125 g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
128 + if (use_overlay_scrollbar)
129 + return os_scrollbar_new (orientation, adjustment);
131 return g_object_new (GTK_TYPE_SCROLLBAR,
132 "orientation", orientation,
133 "adjustment", adjustment,
138 + * ubuntu_gtk_scrollbar_init:
140 + * Initialize local use of the overlay-scrollbar module.
142 + * If the module is installed, this code checks both a whitelist
143 + * and a blacklist to decide whether to activate the remplacement
146 + * It is possible to force the feature to be disabled by setting
147 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
151 +ubuntu_gtk_scrollbar_init (void)
153 + static gboolean init_once = FALSE;
155 + if (init_once == FALSE)
157 + GModule *module = NULL;
158 + gpointer symbol = NULL;
160 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
162 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
163 + and disable the feature in this case */
164 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
167 + /* default extension library to use for this release */
168 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
170 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
171 + if (module == NULL)
174 + /* check the blacklist, in all cases */
175 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
177 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
178 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
182 + /* all controls are positive: the feature can be activated now */
183 + if (g_module_symbol (module, "os_scrollbar_new", &symbol))
185 + os_scrollbar_new = symbol;
186 + use_overlay_scrollbar = TRUE;
193 Index: gtk+-3.0.9/gtk/gtkscrollbar.h
194 ===================================================================
195 --- gtk+-3.0.9.orig/gtk/gtkscrollbar.h 2011-06-06 22:01:31.619724258 +0200
196 +++ gtk+-3.0.9/gtk/gtkscrollbar.h 2011-06-06 19:58:12.079031917 +0200
198 GType gtk_scrollbar_get_type (void) G_GNUC_CONST;
199 GtkWidget * gtk_scrollbar_new (GtkOrientation orientation,
200 GtkAdjustment *adjustment);
201 +void ubuntu_gtk_scrollbar_init (void);
205 Index: gtk+-3.0.9/gtk/gtkscrolledwindow.c
206 ===================================================================
207 --- gtk+-3.0.9.orig/gtk/gtkscrolledwindow.c 2011-06-06 22:01:31.659724455 +0200
208 +++ gtk+-3.0.9/gtk/gtkscrolledwindow.c 2011-06-06 20:02:19.400258318 +0200
211 static guint signals[LAST_SIGNAL] = {0};
213 +static gboolean use_overlay_scrollbar = FALSE;
215 G_DEFINE_TYPE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
218 @@ -1210,7 +1212,7 @@
220 gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
222 - if (!scrollbars_within_bevel)
223 + if (!scrollbars_within_bevel && !use_overlay_scrollbar)
226 GtkBorder padding, border;
227 @@ -1766,7 +1768,7 @@
229 if (priv->shadow_type != GTK_SHADOW_NONE)
231 - if (!scrollbars_within_bevel)
232 + if (!scrollbars_within_bevel && !use_overlay_scrollbar)
234 child_allocation.x -= padding.left + border.left;
235 child_allocation.width += padding.left + padding.right + border.left + border.right;
236 @@ -1814,7 +1816,7 @@
238 if (priv->shadow_type != GTK_SHADOW_NONE)
240 - if (!scrollbars_within_bevel)
241 + if (!scrollbars_within_bevel && !use_overlay_scrollbar)
243 child_allocation.y -= padding.top + border.top;
244 child_allocation.height += padding.top + padding.bottom + border.top + border.bottom;
245 @@ -2055,6 +2057,58 @@
249 + * ubuntu_gtk_scrolled_window_init:
251 + * Initialize local use of the overlay-scrollbar module.
253 + * If the module is installed, this code checks both a whitelist
254 + * and a blacklist to decide whether to activate the remplacement
257 + * It is possible to force the feature to be disabled by setting
258 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
262 +ubuntu_gtk_scrolled_window_init (void)
264 + static gboolean init_once = FALSE;
266 + if (init_once == FALSE)
268 + GModule *module = NULL;
269 + gpointer symbol = NULL;
271 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
273 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
274 + and disable the feature in this case */
275 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
278 + /* default extension library to use for this release */
279 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
281 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
282 + if (module == NULL)
285 + /* check the blacklist, in all cases */
286 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
288 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
289 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
293 + use_overlay_scrollbar = TRUE;
301 * _gtk_scrolled_window_get_spacing:
302 * @scrolled_window: a scrolled window
304 @@ -2070,6 +2124,9 @@
306 g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
308 + if (use_overlay_scrollbar)
311 class = GTK_SCROLLED_WINDOW_GET_CLASS (scrolled_window);
313 if (class->scrollbar_spacing >= 0)
314 Index: gtk+-3.0.9/gtk/gtkscrolledwindow.h
315 ===================================================================
316 --- gtk+-3.0.9.orig/gtk/gtkscrolledwindow.h 2011-06-06 22:01:31.679724552 +0200
317 +++ gtk+-3.0.9/gtk/gtkscrolledwindow.h 2011-06-06 20:02:52.764423758 +0200
321 gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
322 +void ubuntu_gtk_scrolled_window_init (void);
326 Index: gtk+-3.0.9/gtk/gtkvscrollbar.c
327 ===================================================================
328 --- gtk+-3.0.9.orig/gtk/gtkvscrollbar.c 2011-06-06 22:01:31.507723704 +0200
329 +++ gtk+-3.0.9/gtk/gtkvscrollbar.c 2011-06-06 20:05:06.117085008 +0200
331 #include "gtkvscrollbar.h"
334 +static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
335 +static gboolean use_overlay_scrollbar = FALSE;
338 * SECTION:gtkvscrollbar
340 g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
343 + if (use_overlay_scrollbar)
344 + return os_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjustment);
346 return g_object_new (GTK_TYPE_VSCROLLBAR,
347 "adjustment", adjustment,
352 + * ubuntu_gtk_vscrollbar_init:
354 + * Initialize local use of the overlay-scrollbar module.
356 + * If the module is installed, this code checks both a whitelist
357 + * and a blacklist to decide whether to activate the remplacement
360 + * It is possible to force the feature to be disabled by setting
361 + * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
365 +ubuntu_gtk_vscrollbar_init (void)
367 + static gboolean init_once = FALSE;
369 + if (init_once == FALSE)
371 + GModule *module = NULL;
372 + gpointer symbol = NULL;
374 + gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
376 + /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
377 + and disable the feature in this case */
378 + if (flag != NULL && (*flag == '\0' || *flag == '0'))
381 + /* default extension library to use for this release */
382 + gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
384 + module = g_module_open (path, G_MODULE_BIND_LOCAL);
385 + if (module == NULL)
388 + /* check the blacklist, in all cases */
389 + if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
391 + gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
392 + if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
396 + /* all controls are positive: the feature can be activated now */
397 + if (g_module_symbol (module, "os_scrollbar_new", &symbol))
399 + os_scrollbar_new = symbol;
400 + use_overlay_scrollbar = TRUE;
407 Index: gtk+-3.0.9/gtk/gtkvscrollbar.h
408 ===================================================================
409 --- gtk+-3.0.9.orig/gtk/gtkvscrollbar.h 2011-06-06 22:01:31.543723883 +0200
410 +++ gtk+-3.0.9/gtk/gtkvscrollbar.h 2011-06-06 20:08:59.662243113 +0200
413 GType gtk_vscrollbar_get_type (void) G_GNUC_CONST;
414 GtkWidget* gtk_vscrollbar_new (GtkAdjustment *adjustment);
415 +void ubuntu_gtk_vscrollbar_init (void);