1
=== modified file 'gtk/gtkmain.c'
2
--- old/gtk/gtkmain.c 2010-08-18 17:15:22 +0000
3
+++ new/gtk/gtkmain.c 2011-03-01 17:17:23 +0000
6
_gtk_accel_map_init ();
8
+ _gtk_scrolled_window_init ();
10
/* Set the 'initialized' flag.
13
=== modified file 'gtk/gtkscrolledwindow.c'
14
--- old/gtk/gtkscrolledwindow.c 2010-05-18 12:35:39 +0000
15
+++ new/gtk/gtkscrolledwindow.c 2011-03-03 10:53:04 +0000
18
static guint signals[LAST_SIGNAL] = {0};
20
+static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
21
+static gboolean use_overlay_scrollbar = FALSE;
23
G_DEFINE_TYPE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
27
if (!scrolled_window->hscrollbar)
29
gtk_widget_push_composite_child ();
30
- scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment);
32
+ if (use_overlay_scrollbar == FALSE)
33
+ scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment);
35
+ scrolled_window->hscrollbar = os_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadjustment);
37
gtk_widget_set_composite_name (scrolled_window->hscrollbar, "hscrollbar");
38
gtk_widget_pop_composite_child ();
41
if (!scrolled_window->vscrollbar)
43
gtk_widget_push_composite_child ();
44
- scrolled_window->vscrollbar = gtk_vscrollbar_new (vadjustment);
46
+ if (use_overlay_scrollbar == FALSE)
47
+ scrolled_window->vscrollbar = gtk_vscrollbar_new (vadjustment);
49
+ scrolled_window->vscrollbar = os_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadjustment);
51
gtk_widget_set_composite_name (scrolled_window->vscrollbar, "vscrollbar");
52
gtk_widget_pop_composite_child ();
54
@@ -1366,7 +1379,10 @@
55
priv->real_window_placement == GTK_CORNER_BOTTOM_LEFT)))
56
allocation->x += (vscrollbar_requisition.width + scrollbar_spacing);
58
- allocation->width = MAX (1, allocation->width - (vscrollbar_requisition.width + scrollbar_spacing));
59
+ if (use_overlay_scrollbar == FALSE)
60
+ allocation->width = MAX (1, allocation->width - (vscrollbar_requisition.width + scrollbar_spacing));
62
+ allocation->width = MAX (1, allocation->width);
64
if (scrolled_window->hscrollbar_visible)
66
@@ -1378,7 +1394,10 @@
67
priv->real_window_placement == GTK_CORNER_BOTTOM_RIGHT)
68
allocation->y += (hscrollbar_requisition.height + scrollbar_spacing);
70
- allocation->height = MAX (1, allocation->height - (hscrollbar_requisition.height + scrollbar_spacing));
71
+ if (use_overlay_scrollbar == FALSE)
72
+ allocation->height = MAX (1, allocation->height - (hscrollbar_requisition.height + scrollbar_spacing));
74
+ allocation->height = MAX (1, allocation->height);
78
@@ -1764,6 +1783,59 @@
82
+ * _gtk_scrolled_window_init:
84
+ * Initialize local use of the overlay-scrollbar library.
86
+ * In order to be activated for an application, the LIBOVERLAY_SCROLLBAR
87
+ * environment variable must be set and the liboverlay-scrollbar shared library
88
+ * must be installed. If it's installed locally, a custom path to
89
+ * liboverlay-scrollbar can be set using the LIBOVERLAY_SCROLLBAR_PATH
90
+ * environment variable. liboverlay-scrollbar is loaded at run-time so that it
91
+ * can be installed separately.
93
+ * NOTE: This is a beta feature meant for demonstration and early adopters only.
96
+_gtk_scrolled_window_init (void)
98
+ static gboolean init_once = FALSE;
100
+ if (init_once == FALSE)
102
+ if (g_getenv ("LIBOVERLAY_SCROLLBAR") != NULL)
104
+ GModule *module = NULL;
105
+ gpointer symbol = NULL;
108
+ path = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR_PATH");
110
+ path = "/usr/lib/liboverlay-scrollbar-0.1.so.0";
112
+ module = g_module_open (path, G_MODULE_BIND_LOCAL);
113
+ if (module != NULL)
115
+ if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
117
+ gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
118
+ if (os_utils_is_blacklisted (g_get_prgname ()) == FALSE)
120
+ if (g_module_symbol (module, "os_scrollbar_new", &symbol))
122
+ os_scrollbar_new = symbol;
123
+ use_overlay_scrollbar = TRUE;
135
* _gtk_scrolled_window_get_spacing:
136
* @scrolled_window: a scrolled window
139
=== modified file 'gtk/gtkscrolledwindow.h'
140
--- old/gtk/gtkscrolledwindow.h 2009-09-05 07:16:24 +0000
141
+++ new/gtk/gtkscrolledwindow.h 2011-03-01 17:18:02 +0000
143
void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
146
+void _gtk_scrolled_window_init (void);
147
gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);