Merge lp:~cimi/overlay-scrollbar/gtk3 into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Ted Gould
Approved revision: 248
Merged at revision: 244
Proposed branch: lp:~cimi/overlay-scrollbar/gtk3
Merge into: lp:overlay-scrollbar
Diff against target: 1895 lines (+1248/-217)
13 files modified
configure.ac (+19/-3)
data/81overlay-scrollbar.in (+5/-0)
misc/Makefile.am (+4/-1)
misc/gtk+-2.0-maverick-use-overlay-scrollbar-from-module.patch (+0/-150)
misc/gtk+-3.0-right-filter-window-for-XI2-events.patch (+331/-0)
misc/gtk+-3.0-use-overlay-form-module.patch (+418/-0)
misc/gtk+-fix-upstream-bug-652102.patch (+13/-0)
os/Makefile.am (+27/-5)
os/os-pager.c (+35/-18)
os/os-scrollbar.c (+324/-12)
os/os-thumb.c (+56/-24)
pkgconfig/Makefile.am (+9/-3)
tests/Makefile.am (+7/-1)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/gtk3
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+63686@code.launchpad.net

Description of the change

WIP port to gtk3 (compile with --with-gtk=3)

To post a comment you must log in.
lp:~cimi/overlay-scrollbar/gtk3 updated
249. By Andrea Cimitan

Code formatting

250. By Andrea Cimitan

Removed old gtk+ patch

Revision history for this message
Ted Gould (ted) :
review: Approve
Revision history for this message
Ted Gould (ted) wrote :

Let's get this in so the little patches are easier to read ;-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2011-05-19 15:06:11 +0000
3+++ configure.ac 2011-06-08 15:38:03 +0000
4@@ -66,11 +66,27 @@
5
6 AC_SUBST(glib_req, 2.26.0)
7 AC_SUBST(gtk_req, 2.22.0)
8+AC_SUBST(gtk3_req, 3.0.9)
9 AC_SUBST(cairo_req, 1.10)
10
11-PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-2.0 >= $gtk_req cairo >= $cairo_req)
12-AC_SUBST(DEPS_CFLAGS)
13-AC_SUBST(DEPS_LIBS)
14+AC_ARG_WITH([gtk],
15+ [AS_HELP_STRING([--with-gtk],
16+ [Which version of gtk to use @<:@default=2@:>@])],
17+ [],
18+ [with_gtk=2])
19+AS_IF([test "x$with_gtk" = x3],
20+ [PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-3.0 >= $gtk3_req cairo >= $cairo_req)
21+ AC_SUBST(DEPS_CFLAGS)
22+ AC_SUBST(DEPS_LIBS)
23+ ],
24+ [test "x$with_gtk" = x2],
25+ [PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-2.0 >= $gtk_req cairo >= $cairo_req)
26+ AC_SUBST(DEPS_CFLAGS)
27+ AC_SUBST(DEPS_LIBS)
28+ ],
29+ [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])]
30+)
31+AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3])
32
33 # Debug flags
34
35
36=== modified file 'data/81overlay-scrollbar.in'
37--- data/81overlay-scrollbar.in 2011-04-21 14:33:22 +0000
38+++ data/81overlay-scrollbar.in 2011-06-08 15:38:03 +0000
39@@ -2,3 +2,8 @@
40 then
41 export LIBOVERLAY_SCROLLBAR=1
42 fi
43+
44+if [ -f @libdir@/liboverlay-scrollbar3-@OS_MAJORMINOR@.so.@OS_LT_CURRENT@ ]
45+then
46+ export LIBOVERLAY_SCROLLBAR=1
47+fi
48
49=== modified file 'misc/Makefile.am'
50--- misc/Makefile.am 2011-05-18 21:15:16 +0000
51+++ misc/Makefile.am 2011-06-08 15:38:03 +0000
52@@ -1,3 +1,6 @@
53 EXTRA_DIST = \
54 gtk+-2.0-maverick-use-overlay-scrollbar-from-module.patch \
55- gtk+-2.0-oneiric-use-overlay-scrollbar-from-module.patch
56+ gtk+-2.0-oneiric-use-overlay-scrollbar-from-module.patch \
57+ gtk+-fix-upstream-bug-652102.patch \
58+ gtk+-3.0-right-filter-window-for-XI2-events.patch \
59+ gtk+-3.0-use-overlay-form-module.patch
60
61=== removed file 'misc/gtk+-2.0-maverick-use-overlay-scrollbar-from-module.patch'
62--- misc/gtk+-2.0-maverick-use-overlay-scrollbar-from-module.patch 2011-03-03 10:54:18 +0000
63+++ misc/gtk+-2.0-maverick-use-overlay-scrollbar-from-module.patch 1970-01-01 00:00:00 +0000
64@@ -1,150 +0,0 @@
65-=== modified file 'gtk/gtkmain.c'
66---- old/gtk/gtkmain.c 2010-08-18 17:15:22 +0000
67-+++ new/gtk/gtkmain.c 2011-03-01 17:17:23 +0000
68-@@ -740,6 +740,7 @@
69-
70- _gtk_accel_map_init ();
71- _gtk_rc_init ();
72-+ _gtk_scrolled_window_init ();
73-
74- /* Set the 'initialized' flag.
75- */
76-
77-=== modified file 'gtk/gtkscrolledwindow.c'
78---- old/gtk/gtkscrolledwindow.c 2010-05-18 12:35:39 +0000
79-+++ new/gtk/gtkscrolledwindow.c 2011-03-03 10:53:04 +0000
80-@@ -144,6 +144,9 @@
81-
82- static guint signals[LAST_SIGNAL] = {0};
83-
84-+static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
85-+static gboolean use_overlay_scrollbar = FALSE;
86-+
87- G_DEFINE_TYPE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
88-
89- static void
90-@@ -434,7 +437,12 @@
91- if (!scrolled_window->hscrollbar)
92- {
93- gtk_widget_push_composite_child ();
94-- scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment);
95-+
96-+ if (use_overlay_scrollbar == FALSE)
97-+ scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment);
98-+ else
99-+ scrolled_window->hscrollbar = os_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadjustment);
100-+
101- gtk_widget_set_composite_name (scrolled_window->hscrollbar, "hscrollbar");
102- gtk_widget_pop_composite_child ();
103-
104-@@ -495,7 +503,12 @@
105- if (!scrolled_window->vscrollbar)
106- {
107- gtk_widget_push_composite_child ();
108-- scrolled_window->vscrollbar = gtk_vscrollbar_new (vadjustment);
109-+
110-+ if (use_overlay_scrollbar == FALSE)
111-+ scrolled_window->vscrollbar = gtk_vscrollbar_new (vadjustment);
112-+ else
113-+ scrolled_window->vscrollbar = os_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadjustment);
114-+
115- gtk_widget_set_composite_name (scrolled_window->vscrollbar, "vscrollbar");
116- gtk_widget_pop_composite_child ();
117-
118-@@ -1366,7 +1379,10 @@
119- priv->real_window_placement == GTK_CORNER_BOTTOM_LEFT)))
120- allocation->x += (vscrollbar_requisition.width + scrollbar_spacing);
121-
122-- allocation->width = MAX (1, allocation->width - (vscrollbar_requisition.width + scrollbar_spacing));
123-+ if (use_overlay_scrollbar == FALSE)
124-+ allocation->width = MAX (1, allocation->width - (vscrollbar_requisition.width + scrollbar_spacing));
125-+ else
126-+ allocation->width = MAX (1, allocation->width);
127- }
128- if (scrolled_window->hscrollbar_visible)
129- {
130-@@ -1378,7 +1394,10 @@
131- priv->real_window_placement == GTK_CORNER_BOTTOM_RIGHT)
132- allocation->y += (hscrollbar_requisition.height + scrollbar_spacing);
133-
134-- allocation->height = MAX (1, allocation->height - (hscrollbar_requisition.height + scrollbar_spacing));
135-+ if (use_overlay_scrollbar == FALSE)
136-+ allocation->height = MAX (1, allocation->height - (hscrollbar_requisition.height + scrollbar_spacing));
137-+ else
138-+ allocation->height = MAX (1, allocation->height);
139- }
140- }
141-
142-@@ -1764,6 +1783,59 @@
143- }
144-
145- /*
146-+ * _gtk_scrolled_window_init:
147-+ *
148-+ * Initialize local use of the overlay-scrollbar library.
149-+ *
150-+ * In order to be activated for an application, the LIBOVERLAY_SCROLLBAR
151-+ * environment variable must be set and the liboverlay-scrollbar shared library
152-+ * must be installed. If it's installed locally, a custom path to
153-+ * liboverlay-scrollbar can be set using the LIBOVERLAY_SCROLLBAR_PATH
154-+ * environment variable. liboverlay-scrollbar is loaded at run-time so that it
155-+ * can be installed separately.
156-+ *
157-+ * NOTE: This is a beta feature meant for demonstration and early adopters only.
158-+ */
159-+void
160-+_gtk_scrolled_window_init (void)
161-+{
162-+ static gboolean init_once = FALSE;
163-+
164-+ if (init_once == FALSE)
165-+ {
166-+ if (g_getenv ("LIBOVERLAY_SCROLLBAR") != NULL)
167-+ {
168-+ GModule *module = NULL;
169-+ gpointer symbol = NULL;
170-+ gchar *path;
171-+
172-+ path = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR_PATH");
173-+ if (path == NULL)
174-+ path = "/usr/lib/liboverlay-scrollbar-0.1.so.0";
175-+
176-+ module = g_module_open (path, G_MODULE_BIND_LOCAL);
177-+ if (module != NULL)
178-+ {
179-+ if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
180-+ {
181-+ gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
182-+ if (os_utils_is_blacklisted (g_get_prgname ()) == FALSE)
183-+ {
184-+ if (g_module_symbol (module, "os_scrollbar_new", &symbol))
185-+ {
186-+ os_scrollbar_new = symbol;
187-+ use_overlay_scrollbar = TRUE;
188-+ }
189-+ }
190-+ }
191-+ }
192-+ }
193-+
194-+ init_once = TRUE;
195-+ }
196-+}
197-+
198-+/*
199- * _gtk_scrolled_window_get_spacing:
200- * @scrolled_window: a scrolled window
201- *
202-
203-=== modified file 'gtk/gtkscrolledwindow.h'
204---- old/gtk/gtkscrolledwindow.h 2009-09-05 07:16:24 +0000
205-+++ new/gtk/gtkscrolledwindow.h 2011-03-01 17:18:02 +0000
206-@@ -127,6 +127,7 @@
207- void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
208- GtkWidget *child);
209-
210-+void _gtk_scrolled_window_init (void);
211- gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
212-
213-
214-
215
216=== added file 'misc/gtk+-3.0-right-filter-window-for-XI2-events.patch'
217--- misc/gtk+-3.0-right-filter-window-for-XI2-events.patch 1970-01-01 00:00:00 +0000
218+++ misc/gtk+-3.0-right-filter-window-for-XI2-events.patch 2011-06-08 15:38:03 +0000
219@@ -0,0 +1,331 @@
220+Index: gtk+-3.0.9/gdk/gdkwindow.c
221+===================================================================
222+--- gtk+-3.0.9.orig/gdk/gdkwindow.c 2011-06-07 08:29:40.860881065 +0200
223++++ gtk+-3.0.9/gdk/gdkwindow.c 2011-06-07 08:30:21.297081582 +0200
224+@@ -2410,6 +2410,10 @@
225+ *
226+ * See gdk_display_add_client_message_filter() if you are interested
227+ * in X ClientMessage events.
228++ *
229++ * If you are interested in X GenericEvents, bear in mind that
230++ * XGetEventData() has been already called on the event, and
231++ * XFreeEventData() must not be called within @function.
232+ **/
233+ void
234+ gdk_window_add_filter (GdkWindow *window,
235+Index: gtk+-3.0.9/gdk/x11/gdkdevicemanager-xi2.c
236+===================================================================
237+--- gtk+-3.0.9.orig/gdk/x11/gdkdevicemanager-xi2.c 2011-06-07 08:15:02.136197362 +0200
238++++ gtk+-3.0.9/gdk/x11/gdkdevicemanager-xi2.c 2011-06-07 08:29:18.380769587 +0200
239+@@ -91,7 +91,8 @@
240+ static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
241+ Window window,
242+ GdkEventMask event_mask);
243+-
244++static GdkWindow * gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
245++ XEvent *xevent);
246+
247+ enum {
248+ PROP_0,
249+@@ -561,6 +562,7 @@
250+ iface->translate_event = gdk_x11_device_manager_xi2_translate_event;
251+ iface->get_handled_events = gdk_x11_device_manager_xi2_get_handled_events;
252+ iface->select_window_events = gdk_x11_device_manager_xi2_select_window_events;
253++ iface->get_window = gdk_x11_device_manager_xi2_get_window;
254+ }
255+
256+ static void
257+@@ -1007,43 +1009,27 @@
258+ gboolean return_val = TRUE;
259+ GdkWindow *window;
260+ XIEvent *ev;
261+- Display *dpy;
262+
263+- dpy = GDK_DISPLAY_XDISPLAY (display);
264+ device_manager = (GdkX11DeviceManagerXI2 *) translator;
265+ cookie = &xevent->xcookie;
266+
267+ if (xevent->type != GenericEvent)
268+ return gdk_x11_device_manager_xi2_translate_core_event (translator, display, event, xevent);
269+-
270+- if (!XGetEventData (dpy, cookie))
271++ else if (cookie->extension != device_manager->opcode)
272+ return FALSE;
273+
274+- if (cookie->type != GenericEvent ||
275+- cookie->extension != device_manager->opcode)
276+- {
277+- XFreeEventData (dpy, cookie);
278+- return FALSE;
279+- }
280+-
281+ ev = (XIEvent *) cookie->data;
282+
283+ window = get_event_window (translator, ev);
284+
285+ if (window && GDK_WINDOW_DESTROYED (window))
286+- {
287+- XFreeEventData (dpy, cookie);
288+- return FALSE;
289+- }
290++ return FALSE;
291+
292+ if (ev->evtype == XI_Motion ||
293+ ev->evtype == XI_ButtonRelease)
294+ {
295+ if (_gdk_x11_moveresize_handle_event (xevent))
296+- {
297+- XFreeEventData (dpy, cookie);
298+- return FALSE;
299+- }
300++ return FALSE;
301+ }
302+
303+ switch (ev->evtype)
304+@@ -1325,8 +1311,6 @@
305+ event->any.type = GDK_NOTHING;
306+ }
307+
308+- XFreeEventData (dpy, cookie);
309+-
310+ return return_val;
311+ }
312+
313+@@ -1366,6 +1350,24 @@
314+ g_free (event_mask.mask);
315+ }
316+
317++static GdkWindow *
318++gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
319++ XEvent *xevent)
320++{
321++ GdkX11DeviceManagerXI2 *device_manager;
322++ XIEvent *ev;
323++
324++ device_manager = (GdkX11DeviceManagerXI2 *) translator;
325++
326++ if (xevent->type != GenericEvent ||
327++ xevent->xcookie.extension != device_manager->opcode)
328++ return NULL;
329++
330++ ev = (XIEvent *) xevent->xcookie.data;
331++
332++ return get_event_window (translator, ev);
333++}
334++
335+ #else /* XINPUT_2 */
336+
337+ static void
338+Index: gtk+-3.0.9/gdk/x11/gdkeventsource.c
339+===================================================================
340+--- gtk+-3.0.9.orig/gdk/x11/gdkeventsource.c 2011-06-07 08:15:11.743439030 +0200
341++++ gtk+-3.0.9/gdk/x11/gdkeventsource.c 2011-06-07 08:25:06.887522506 +0200
342+@@ -97,11 +97,30 @@
343+ }
344+
345+ static GdkWindow *
346+-gdk_event_source_get_filter_window (GdkEventSource *event_source,
347+- XEvent *xevent)
348++gdk_event_source_get_filter_window (GdkEventSource *event_source,
349++ XEvent *xevent,
350++ GdkEventTranslator **event_translator)
351+ {
352++ GList *list = event_source->translators;
353+ GdkWindow *window;
354+
355++ *event_translator = NULL;
356++
357++ while (list)
358++ {
359++ GdkEventTranslator *translator = list->data;
360++
361++ list = list->next;
362++ window = _gdk_x11_event_translator_get_window (translator,
363++ event_source->display,
364++ xevent);
365++ if (window)
366++ {
367++ *event_translator = translator;
368++ return window;
369++ }
370++ }
371++
372+ window = gdk_x11_window_lookup_for_display (event_source->display,
373+ xevent->xany.window);
374+
375+@@ -151,11 +170,21 @@
376+ XEvent *xevent)
377+ {
378+ GdkEvent *event = gdk_event_new (GDK_NOTHING);
379+- GList *list = event_source->translators;
380+- GdkFilterReturn result;
381++ GdkFilterReturn result = GDK_FILTER_CONTINUE;
382++ GdkEventTranslator *event_translator;
383+ GdkWindow *filter_window;
384++ Display *dpy;
385++
386++ dpy = GDK_DISPLAY_XDISPLAY (event_source->display);
387++
388++ /* Get cookie data here so it's available
389++ * to every event translator and event filter.
390++ */
391++ if (xevent->type == GenericEvent)
392++ XGetEventData (dpy, &xevent->xcookie);
393+
394+- filter_window = gdk_event_source_get_filter_window (event_source, xevent);
395++ filter_window = gdk_event_source_get_filter_window (event_source, xevent,
396++ &event_translator);
397+ if (filter_window)
398+ event->any.window = g_object_ref (filter_window);
399+
400+@@ -165,48 +194,53 @@
401+ /* Apply global filters */
402+
403+ result = gdk_event_apply_filters (xevent, event, NULL);
404++ }
405++
406++ if (result == GDK_FILTER_CONTINUE &&
407++ filter_window && filter_window->filters)
408++ {
409++ /* Apply per-window filters */
410++ result = gdk_event_apply_filters (xevent, event, filter_window);
411++ }
412++
413++ if (result != GDK_FILTER_CONTINUE)
414++ {
415++ if (xevent->type == GenericEvent)
416++ XFreeEventData (dpy, &xevent->xcookie);
417+
418+ if (result == GDK_FILTER_REMOVE)
419+ {
420+ gdk_event_free (event);
421+ return NULL;
422+ }
423+- else if (result == GDK_FILTER_TRANSLATE)
424++ else /* GDK_FILTER_TRANSLATE */
425+ return event;
426+ }
427+
428+- if (filter_window)
429+- {
430+- /* Apply per-window filters */
431+- GdkFilterReturn result;
432+-
433+- if (filter_window->filters)
434+- {
435+- result = gdk_event_apply_filters (xevent, event,
436+- filter_window);
437+-
438+- if (result == GDK_FILTER_REMOVE)
439+- {
440+- gdk_event_free (event);
441+- return NULL;
442+- }
443+- else if (result == GDK_FILTER_TRANSLATE)
444+- return event;
445+- }
446+- }
447+-
448+ gdk_event_free (event);
449+ event = NULL;
450+
451+- while (list && !event)
452++ if (event_translator)
453+ {
454+- GdkEventTranslator *translator = list->data;
455+-
456+- list = list->next;
457+- event = _gdk_x11_event_translator_translate (translator,
458++ /* Event translator was gotten before in get_filter_window() */
459++ event = _gdk_x11_event_translator_translate (event_translator,
460+ event_source->display,
461+ xevent);
462+ }
463++ else
464++ {
465++ GList *list = event_source->translators;
466++
467++ while (list && !event)
468++ {
469++ GdkEventTranslator *translator = list->data;
470++
471++ list = list->next;
472++ event = _gdk_x11_event_translator_translate (translator,
473++ event_source->display,
474++ xevent);
475++ }
476++ }
477+
478+ if (event &&
479+ (event->type == GDK_ENTER_NOTIFY ||
480+@@ -217,6 +251,9 @@
481+ handle_focus_change (&event->crossing);
482+ }
483+
484++ if (xevent->type == GenericEvent)
485++ XFreeEventData (dpy, &xevent->xcookie);
486++
487+ return event;
488+ }
489+
490+Index: gtk+-3.0.9/gdk/x11/gdkeventtranslator.c
491+===================================================================
492+--- gtk+-3.0.9.orig/gdk/x11/gdkeventtranslator.c 2011-06-07 08:21:29.734445694 +0200
493++++ gtk+-3.0.9/gdk/x11/gdkeventtranslator.c 2011-06-07 08:26:13.543853032 +0200
494+@@ -20,7 +20,7 @@
495+ #include "config.h"
496+
497+ #include "gdkeventtranslator.h"
498+-
499++#include "gdkwindow-x11.h"
500+
501+ typedef GdkEventTranslatorIface GdkEventTranslatorInterface;
502+ G_DEFINE_INTERFACE (GdkEventTranslator, _gdk_x11_event_translator, G_TYPE_OBJECT);
503+@@ -87,3 +87,24 @@
504+ if (iface->select_window_events)
505+ iface->select_window_events (translator, window, event_mask);
506+ }
507++
508++GdkWindow *
509++_gdk_x11_event_translator_get_window (GdkEventTranslator *translator,
510++ GdkDisplay *display,
511++ XEvent *xevent)
512++{
513++ GdkEventTranslatorIface *iface;
514++ GdkWindow *window = NULL;
515++
516++ g_return_val_if_fail (GDK_IS_EVENT_TRANSLATOR (translator), NULL);
517++
518++ iface = GDK_EVENT_TRANSLATOR_GET_IFACE (translator);
519++
520++ if (iface->get_window)
521++ window = iface->get_window (translator, xevent);
522++
523++ if (!window)
524++ window = gdk_x11_window_lookup_for_display (display, xevent->xany.window);
525++
526++ return window;
527++}
528+Index: gtk+-3.0.9/gdk/x11/gdkeventtranslator.h
529+===================================================================
530+--- gtk+-3.0.9.orig/gdk/x11/gdkeventtranslator.h 2011-06-07 08:21:31.894456415 +0200
531++++ gtk+-3.0.9/gdk/x11/gdkeventtranslator.h 2011-06-07 08:26:57.220069609 +0200
532+@@ -49,6 +49,8 @@
533+ void (* select_window_events) (GdkEventTranslator *translator,
534+ Window window,
535+ GdkEventMask event_mask);
536++ GdkWindow * (* get_window) (GdkEventTranslator *translator,
537++ XEvent *xevent);
538+ };
539+
540+ GType _gdk_x11_event_translator_get_type (void) G_GNUC_CONST;
541+@@ -60,6 +62,9 @@
542+ void _gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator,
543+ Window window,
544+ GdkEventMask event_mask);
545++GdkWindow * _gdk_x11_event_translator_get_window (GdkEventTranslator *translator,
546++ GdkDisplay *display,
547++ XEvent *xevent);
548+
549+ G_END_DECLS
550+
551
552=== added file 'misc/gtk+-3.0-use-overlay-form-module.patch'
553--- misc/gtk+-3.0-use-overlay-form-module.patch 1970-01-01 00:00:00 +0000
554+++ misc/gtk+-3.0-use-overlay-form-module.patch 2011-06-08 15:38:03 +0000
555@@ -0,0 +1,418 @@
556+Index: gtk+-3.0.9/gtk/gtkhscrollbar.c
557+===================================================================
558+--- gtk+-3.0.9.orig/gtk/gtkhscrollbar.c 2011-06-06 22:01:31.455723443 +0200
559++++ gtk+-3.0.9/gtk/gtkhscrollbar.c 2011-06-06 19:54:05.177807603 +0200
560+@@ -31,6 +31,8 @@
561+ #include "gtkorientable.h"
562+ #include "gtkintl.h"
563+
564++static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
565++static gboolean use_overlay_scrollbar = FALSE;
566+
567+ G_DEFINE_TYPE (GtkHScrollbar, gtk_hscrollbar, GTK_TYPE_SCROLLBAR)
568+
569+@@ -61,7 +63,67 @@
570+ g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
571+ NULL);
572+
573++ if (use_overlay_scrollbar)
574++ return os_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
575++
576+ return g_object_new (GTK_TYPE_HSCROLLBAR,
577+ "adjustment", adjustment,
578+ NULL);
579+ }
580++
581++/*
582++ * ubuntu_gtk_hscrollbar_init:
583++ *
584++ * Initialize local use of the overlay-scrollbar module.
585++ *
586++ * If the module is installed, this code checks both a whitelist
587++ * and a blacklist to decide whether to activate the remplacement
588++ * scrollbars.
589++ *
590++ * It is possible to force the feature to be disabled by setting
591++ * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
592++ * empty value.
593++ */
594++void
595++ubuntu_gtk_hscrollbar_init (void)
596++{
597++ static gboolean init_once = FALSE;
598++
599++ if (init_once == FALSE)
600++ {
601++ GModule *module = NULL;
602++ gpointer symbol = NULL;
603++
604++ gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
605++
606++ /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
607++ and disable the feature in this case */
608++ if (flag != NULL && (*flag == '\0' || *flag == '0'))
609++ goto skip_loading;
610++
611++ /* default extension library to use for this release */
612++ gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
613++
614++ module = g_module_open (path, G_MODULE_BIND_LOCAL);
615++ if (module == NULL)
616++ goto skip_loading;
617++
618++ /* check the blacklist, in all cases */
619++ if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
620++ {
621++ gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
622++ if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
623++ goto skip_loading;
624++ }
625++
626++ /* all controls are positive: the feature can be activated now */
627++ if (g_module_symbol (module, "os_scrollbar_new", &symbol))
628++ {
629++ os_scrollbar_new = symbol;
630++ use_overlay_scrollbar = TRUE;
631++ }
632++
633++skip_loading:
634++ init_once = TRUE;
635++ }
636++}
637+Index: gtk+-3.0.9/gtk/gtkhscrollbar.h
638+===================================================================
639+--- gtk+-3.0.9.orig/gtk/gtkhscrollbar.h 2011-06-06 22:01:31.479723561 +0200
640++++ gtk+-3.0.9/gtk/gtkhscrollbar.h 2011-06-06 19:54:26.889915270 +0200
641+@@ -62,6 +62,7 @@
642+
643+ GType gtk_hscrollbar_get_type (void) G_GNUC_CONST;
644+ GtkWidget* gtk_hscrollbar_new (GtkAdjustment *adjustment);
645++void ubuntu_gtk_hscrollbar_init (void);
646+
647+
648+ G_END_DECLS
649+Index: gtk+-3.0.9/gtk/gtkmain.c
650+===================================================================
651+--- gtk+-3.0.9.orig/gtk/gtkmain.c 2011-06-06 22:01:31.435723345 +0200
652++++ gtk+-3.0.9/gtk/gtkmain.c 2011-06-06 19:55:18.630171830 +0200
653+@@ -855,6 +855,11 @@
654+
655+ _gtk_accel_map_init ();
656+
657++ ubuntu_gtk_scrolled_window_init ();
658++ ubuntu_gtk_scrollbar_init ();
659++ ubuntu_gtk_hscrollbar_init ();
660++ ubuntu_gtk_vscrollbar_init ();
661++
662+ /* Set the 'initialized' flag.
663+ */
664+ gtk_initialized = TRUE;
665+Index: gtk+-3.0.9/gtk/gtkscrollbar.c
666+===================================================================
667+--- gtk+-3.0.9.orig/gtk/gtkscrollbar.c 2011-06-06 22:01:31.579724063 +0200
668++++ gtk+-3.0.9/gtk/gtkscrollbar.c 2011-06-06 19:57:52.322933951 +0200
669+@@ -58,6 +58,9 @@
670+
671+ static void gtk_scrollbar_style_updated (GtkWidget *widget);
672+
673++static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
674++static gboolean use_overlay_scrollbar = FALSE;
675++
676+ G_DEFINE_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
677+
678+ static void
679+@@ -164,8 +167,68 @@
680+ g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
681+ NULL);
682+
683++ if (use_overlay_scrollbar)
684++ return os_scrollbar_new (orientation, adjustment);
685++
686+ return g_object_new (GTK_TYPE_SCROLLBAR,
687+ "orientation", orientation,
688+ "adjustment", adjustment,
689+ NULL);
690+ }
691++
692++/*
693++ * ubuntu_gtk_scrollbar_init:
694++ *
695++ * Initialize local use of the overlay-scrollbar module.
696++ *
697++ * If the module is installed, this code checks both a whitelist
698++ * and a blacklist to decide whether to activate the remplacement
699++ * scrollbars.
700++ *
701++ * It is possible to force the feature to be disabled by setting
702++ * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
703++ * empty value.
704++ */
705++void
706++ubuntu_gtk_scrollbar_init (void)
707++{
708++ static gboolean init_once = FALSE;
709++
710++ if (init_once == FALSE)
711++ {
712++ GModule *module = NULL;
713++ gpointer symbol = NULL;
714++
715++ gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
716++
717++ /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
718++ and disable the feature in this case */
719++ if (flag != NULL && (*flag == '\0' || *flag == '0'))
720++ goto skip_loading;
721++
722++ /* default extension library to use for this release */
723++ gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
724++
725++ module = g_module_open (path, G_MODULE_BIND_LOCAL);
726++ if (module == NULL)
727++ goto skip_loading;
728++
729++ /* check the blacklist, in all cases */
730++ if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
731++ {
732++ gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
733++ if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
734++ goto skip_loading;
735++ }
736++
737++ /* all controls are positive: the feature can be activated now */
738++ if (g_module_symbol (module, "os_scrollbar_new", &symbol))
739++ {
740++ os_scrollbar_new = symbol;
741++ use_overlay_scrollbar = TRUE;
742++ }
743++
744++skip_loading:
745++ init_once = TRUE;
746++ }
747++}
748+Index: gtk+-3.0.9/gtk/gtkscrollbar.h
749+===================================================================
750+--- gtk+-3.0.9.orig/gtk/gtkscrollbar.h 2011-06-06 22:01:31.619724258 +0200
751++++ gtk+-3.0.9/gtk/gtkscrollbar.h 2011-06-06 19:58:12.079031917 +0200
752+@@ -68,6 +68,7 @@
753+ GType gtk_scrollbar_get_type (void) G_GNUC_CONST;
754+ GtkWidget * gtk_scrollbar_new (GtkOrientation orientation,
755+ GtkAdjustment *adjustment);
756++void ubuntu_gtk_scrollbar_init (void);
757+
758+ G_END_DECLS
759+
760+Index: gtk+-3.0.9/gtk/gtkscrolledwindow.c
761+===================================================================
762+--- gtk+-3.0.9.orig/gtk/gtkscrolledwindow.c 2011-06-06 22:01:31.659724455 +0200
763++++ gtk+-3.0.9/gtk/gtkscrolledwindow.c 2011-06-06 20:02:19.400258318 +0200
764+@@ -220,6 +220,8 @@
765+
766+ static guint signals[LAST_SIGNAL] = {0};
767+
768++static gboolean use_overlay_scrollbar = FALSE;
769++
770+ G_DEFINE_TYPE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
771+
772+
773+@@ -1210,7 +1212,7 @@
774+
775+ gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
776+
777+- if (!scrollbars_within_bevel)
778++ if (!scrollbars_within_bevel && !use_overlay_scrollbar)
779+ {
780+ GtkStateFlags state;
781+ GtkBorder padding, border;
782+@@ -1766,7 +1768,7 @@
783+
784+ if (priv->shadow_type != GTK_SHADOW_NONE)
785+ {
786+- if (!scrollbars_within_bevel)
787++ if (!scrollbars_within_bevel && !use_overlay_scrollbar)
788+ {
789+ child_allocation.x -= padding.left + border.left;
790+ child_allocation.width += padding.left + padding.right + border.left + border.right;
791+@@ -1814,7 +1816,7 @@
792+
793+ if (priv->shadow_type != GTK_SHADOW_NONE)
794+ {
795+- if (!scrollbars_within_bevel)
796++ if (!scrollbars_within_bevel && !use_overlay_scrollbar)
797+ {
798+ child_allocation.y -= padding.top + border.top;
799+ child_allocation.height += padding.top + padding.bottom + border.top + border.bottom;
800+@@ -2055,6 +2057,58 @@
801+ }
802+
803+ /*
804++ * ubuntu_gtk_scrolled_window_init:
805++ *
806++ * Initialize local use of the overlay-scrollbar module.
807++ *
808++ * If the module is installed, this code checks both a whitelist
809++ * and a blacklist to decide whether to activate the remplacement
810++ * scrollbars.
811++ *
812++ * It is possible to force the feature to be disabled by setting
813++ * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
814++ * empty value.
815++ */
816++void
817++ubuntu_gtk_scrolled_window_init (void)
818++{
819++ static gboolean init_once = FALSE;
820++
821++ if (init_once == FALSE)
822++ {
823++ GModule *module = NULL;
824++ gpointer symbol = NULL;
825++
826++ gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
827++
828++ /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
829++ and disable the feature in this case */
830++ if (flag != NULL && (*flag == '\0' || *flag == '0'))
831++ goto skip_loading;
832++
833++ /* default extension library to use for this release */
834++ gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
835++
836++ module = g_module_open (path, G_MODULE_BIND_LOCAL);
837++ if (module == NULL)
838++ goto skip_loading;
839++
840++ /* check the blacklist, in all cases */
841++ if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
842++ {
843++ gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
844++ if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
845++ goto skip_loading;
846++ }
847++
848++ use_overlay_scrollbar = TRUE;
849++
850++skip_loading:
851++ init_once = TRUE;
852++ }
853++}
854++
855++/*
856+ * _gtk_scrolled_window_get_spacing:
857+ * @scrolled_window: a scrolled window
858+ *
859+@@ -2070,6 +2124,9 @@
860+
861+ g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
862+
863++ if (use_overlay_scrollbar)
864++ return 0;
865++
866+ class = GTK_SCROLLED_WINDOW_GET_CLASS (scrolled_window);
867+
868+ if (class->scrollbar_spacing >= 0)
869+Index: gtk+-3.0.9/gtk/gtkscrolledwindow.h
870+===================================================================
871+--- gtk+-3.0.9.orig/gtk/gtkscrolledwindow.h 2011-06-06 22:01:31.679724552 +0200
872++++ gtk+-3.0.9/gtk/gtkscrolledwindow.h 2011-06-06 20:02:52.764423758 +0200
873+@@ -123,6 +123,7 @@
874+ gint height);
875+
876+ gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
877++void ubuntu_gtk_scrolled_window_init (void);
878+
879+
880+ G_END_DECLS
881+Index: gtk+-3.0.9/gtk/gtkvscrollbar.c
882+===================================================================
883+--- gtk+-3.0.9.orig/gtk/gtkvscrollbar.c 2011-06-06 22:01:31.507723704 +0200
884++++ gtk+-3.0.9/gtk/gtkvscrollbar.c 2011-06-06 20:05:06.117085008 +0200
885+@@ -31,6 +31,8 @@
886+ #include "gtkvscrollbar.h"
887+ #include "gtkintl.h"
888+
889++static GtkWidget* (*os_scrollbar_new) (GtkOrientation, GtkAdjustment*) = NULL;
890++static gboolean use_overlay_scrollbar = FALSE;
891+
892+ /**
893+ * SECTION:gtkvscrollbar
894+@@ -75,7 +77,67 @@
895+ g_return_val_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment),
896+ NULL);
897+
898++ if (use_overlay_scrollbar)
899++ return os_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjustment);
900++
901+ return g_object_new (GTK_TYPE_VSCROLLBAR,
902+ "adjustment", adjustment,
903+ NULL);
904+ }
905++
906++/*
907++ * ubuntu_gtk_vscrollbar_init:
908++ *
909++ * Initialize local use of the overlay-scrollbar module.
910++ *
911++ * If the module is installed, this code checks both a whitelist
912++ * and a blacklist to decide whether to activate the remplacement
913++ * scrollbars.
914++ *
915++ * It is possible to force the feature to be disabled by setting
916++ * the LIBOVERLAY_SCROLLBAR environment variable to either '0' or an
917++ * empty value.
918++ */
919++void
920++ubuntu_gtk_vscrollbar_init (void)
921++{
922++ static gboolean init_once = FALSE;
923++
924++ if (init_once == FALSE)
925++ {
926++ GModule *module = NULL;
927++ gpointer symbol = NULL;
928++
929++ gchar *flag = (gchar*) g_getenv ("LIBOVERLAY_SCROLLBAR");
930++
931++ /* check if LIBOVERLAY_SCROLLBAR is set to 0 or an empty value
932++ and disable the feature in this case */
933++ if (flag != NULL && (*flag == '\0' || *flag == '0'))
934++ goto skip_loading;
935++
936++ /* default extension library to use for this release */
937++ gchar *path = "/usr/lib/liboverlay-scrollbar3-0.2.so.0";
938++
939++ module = g_module_open (path, G_MODULE_BIND_LOCAL);
940++ if (module == NULL)
941++ goto skip_loading;
942++
943++ /* check the blacklist, in all cases */
944++ if (g_module_symbol (module, "os_utils_is_blacklisted", &symbol))
945++ {
946++ gboolean (*os_utils_is_blacklisted) (const gchar*) = symbol;
947++ if (os_utils_is_blacklisted (g_get_prgname ()) == TRUE)
948++ goto skip_loading;
949++ }
950++
951++ /* all controls are positive: the feature can be activated now */
952++ if (g_module_symbol (module, "os_scrollbar_new", &symbol))
953++ {
954++ os_scrollbar_new = symbol;
955++ use_overlay_scrollbar = TRUE;
956++ }
957++
958++skip_loading:
959++ init_once = TRUE;
960++ }
961++}
962+Index: gtk+-3.0.9/gtk/gtkvscrollbar.h
963+===================================================================
964+--- gtk+-3.0.9.orig/gtk/gtkvscrollbar.h 2011-06-06 22:01:31.543723883 +0200
965++++ gtk+-3.0.9/gtk/gtkvscrollbar.h 2011-06-06 20:08:59.662243113 +0200
966+@@ -68,6 +68,7 @@
967+
968+ GType gtk_vscrollbar_get_type (void) G_GNUC_CONST;
969+ GtkWidget* gtk_vscrollbar_new (GtkAdjustment *adjustment);
970++void ubuntu_gtk_vscrollbar_init (void);
971+
972+
973+ G_END_DECLS
974
975=== added file 'misc/gtk+-fix-upstream-bug-652102.patch'
976--- misc/gtk+-fix-upstream-bug-652102.patch 1970-01-01 00:00:00 +0000
977+++ misc/gtk+-fix-upstream-bug-652102.patch 2011-06-08 15:38:03 +0000
978@@ -0,0 +1,13 @@
979+diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
980+index 0be4656..a643619 100644
981+--- a/gdk/gdkwindow.c
982++++ b/gdk/gdkwindow.c
983+@@ -6546,6 +6546,8 @@ gdk_window_set_background_pattern (GdkWindow *window,
984+ GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
985+ impl_class->set_background (window, pattern);
986+ }
987++ else
988++ gdk_window_invalidate_rect_full (window, NULL, TRUE, CLEAR_BG_ALL);
989+ }
990+
991+ /**
992
993=== modified file 'os/Makefile.am'
994--- os/Makefile.am 2011-04-01 16:55:19 +0000
995+++ os/Makefile.am 2011-06-08 15:38:03 +0000
996@@ -1,3 +1,11 @@
997+if USE_GTK3
998+VER=3
999+lib_LTLIBRARIES = liboverlay-scrollbar3-@OS_MAJORMINOR@.la
1000+else
1001+VER=
1002+lib_LTLIBRARIES = liboverlay-scrollbar-@OS_MAJORMINOR@.la
1003+endif
1004+
1005 noinst_HEADERS = \
1006 os-private.h
1007
1008@@ -13,14 +21,12 @@
1009 $(srcdir)/os-pager.c \
1010 $(srcdir)/os-thumb.c \
1011 $(srcdir)/os-scrollbar.c
1012-
1013-osincludedir = $(includedir)/overlay-scrollbar-@OS_MAJORMINOR@/os
1014+
1015+osincludedir = $(includedir)/overlay-scrollbar$(VER)-@OS_MAJORMINOR@/os
1016 osinclude_HEADERS = $(source_h)
1017
1018 liboverlay_scrollbar_@OS_MAJORMINOR@_la_SOURCES = $(source_c)
1019
1020-lib_LTLIBRARIES = liboverlay-scrollbar-@OS_MAJORMINOR@.la
1021-
1022 liboverlay_scrollbar_@OS_MAJORMINOR@_la_CFLAGS = $(OS_CFLAGS)
1023
1024 liboverlay_scrollbar_@OS_MAJORMINOR@_la_LIBADD = $(OS_LIBADD)
1025@@ -28,12 +34,28 @@
1026 liboverlay_scrollbar_@OS_MAJORMINOR@_la_LDFLAGS = $(OS_LDFLAGS)
1027
1028 liboverlay_scrollbar_@OS_MAJORMINOR@_includedir = \
1029- $(includedir)/overlay-scrollbar-@OS_MAJORMINOR@/os
1030+ $(includedir)/overlay-scrollbar$(VER)-@OS_MAJORMINOR@/os
1031
1032 liboverlay_scrollbar_@OS_MAJORMINOR@_include_HEADERS = \
1033 $(source_h) \
1034 os-version.h
1035
1036+# We duplicate these here because Automake won't let us use $(VER) on the left hand side.
1037+# Since we carefully use $(VER) in the right hand side above, we can assign the same values.
1038+# Only one version of the library is every compiled at the same time, so it is safe to reuse
1039+# the right hand sides like this.
1040+os3includedir = $(osincludedir)
1041+os3include_HEADERS = $(osinclude_HEADERS)
1042+liboverlay_scrollbar3_@OS_MAJORMINOR@_la_SOURCES = $(source_c)
1043+liboverlay_scrollbar3_@OS_MAJORMINOR@_la_CFLAGS = $(OS_CFLAGS) \
1044+ -DUSE_GTK3
1045+liboverlay_scrollbar3_@OS_MAJORMINOR@_la_LIBADD = $(OS_LIBADD)
1046+liboverlay_scrollbar3_@OS_MAJORMINOR@_la_LDFLAGS = $(OS_LDFLAGS)
1047+liboverlay_scrollbar3_@OS_MAJORMINOR@_includedir = $(includedir)/overlay-scrollbar$(VER)-@OS_MAJORMINOR@/os
1048+liboverlay_scrollbar3_@OS_MAJORMINOR@_include_HEADERS = \
1049+ $(source_h) \
1050+ os-version.h
1051+
1052 EXTRA_DIST = \
1053 os-version.h.in
1054
1055
1056=== modified file 'os/os-pager.c'
1057--- os/os-pager.c 2011-05-18 18:25:13 +0000
1058+++ os/os-pager.c 2011-06-08 15:38:03 +0000
1059@@ -37,6 +37,12 @@
1060 /* Duration of the fade-out */
1061 #define DURATION_FADE_OUT 400
1062
1063+#ifdef USE_GTK3
1064+#define SHAPE_REGION(x) (cairo_region_create_rectangle (x))
1065+#else
1066+#define SHAPE_REGION(x) (gdk_region_rectangle (x))
1067+#endif
1068+
1069 struct _OsPagerPrivate {
1070 GdkWindow *pager_window;
1071 GdkWindow *connection_window;
1072@@ -71,12 +77,12 @@
1073 color.green = 65535 * 0.6;
1074 color.blue = 65535 * 0.6;
1075
1076+#ifndef USE_GTK3
1077 gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->connection_window), &color, FALSE, TRUE);
1078+#endif
1079
1080 gdk_window_set_background (priv->connection_window, &color);
1081
1082- gdk_window_clear (priv->connection_window);
1083-
1084 gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE);
1085 }
1086
1087@@ -110,12 +116,12 @@
1088 color.green = weight * c1.green + (1.0 - weight) * c2.green;
1089 color.blue = weight * c1.blue + (1.0 - weight) * c2.blue;
1090
1091+#ifndef USE_GTK3
1092 gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->pager_window), &color, FALSE, TRUE);
1093+#endif
1094
1095 gdk_window_set_background (priv->pager_window, &color);
1096
1097- gdk_window_clear (priv->pager_window);
1098-
1099 gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE);
1100 }
1101
1102@@ -307,10 +313,8 @@
1103 priv = pager->priv;
1104
1105 gdk_window_shape_combine_region (priv->connection_window,
1106- gdk_region_rectangle (&priv->connection_mask),
1107+ SHAPE_REGION(&priv->connection_mask),
1108 0, 0);
1109-
1110- gdk_window_clear (priv->connection_window);
1111 }
1112
1113 /**
1114@@ -377,10 +381,8 @@
1115 priv = pager->priv;
1116
1117 gdk_window_shape_combine_region (priv->pager_window,
1118- gdk_region_rectangle (&priv->mask),
1119+ SHAPE_REGION(&priv->mask),
1120 0, 0);
1121-
1122- gdk_window_clear (priv->pager_window);
1123 }
1124
1125 /**
1126@@ -481,8 +483,7 @@
1127 if (priv->detached)
1128 {
1129 gdk_window_show (priv->connection_window);
1130-
1131- gdk_window_clear (priv->connection_window);
1132+ gdk_window_raise (priv->pager_window);
1133 }
1134 else
1135 gdk_window_hide (priv->connection_window);
1136@@ -529,40 +530,60 @@
1137 priv->pager_window = NULL;
1138 }
1139
1140+ attributes.event_mask = 0;
1141 attributes.width = priv->allocation.width;
1142 attributes.height = priv->allocation.height;
1143 attributes.wclass = GDK_INPUT_OUTPUT;
1144 attributes.window_type = GDK_WINDOW_CHILD;
1145 attributes.visual = gtk_widget_get_visual (priv->parent);
1146+#ifndef USE_GTK3
1147 attributes.colormap = gtk_widget_get_colormap (priv->parent);
1148+#endif
1149
1150 /* connection_window */
1151 priv->connection_window = gdk_window_new (gtk_widget_get_window (priv->parent),
1152 &attributes,
1153+#ifdef USE_GTK3
1154+ GDK_WA_VISUAL);
1155+#else
1156 GDK_WA_VISUAL | GDK_WA_COLORMAP);
1157+#endif
1158
1159 g_object_ref_sink (priv->connection_window);
1160
1161 gdk_window_set_transient_for (priv->connection_window,
1162 gtk_widget_get_window (priv->parent));
1163
1164+ /* FIXME(Cimi) maybe this is not required with 0 as event mask */
1165 gdk_window_input_shape_combine_region (priv->connection_window,
1166+#ifdef USE_GTK3
1167+ cairo_region_create (),
1168+#else
1169 gdk_region_new (),
1170+#endif
1171 0, 0);
1172
1173 /* pager_window */
1174 priv->pager_window = gdk_window_new (gtk_widget_get_window (priv->parent),
1175 &attributes,
1176+#ifdef USE_GTK3
1177+ GDK_WA_VISUAL);
1178+#else
1179 GDK_WA_VISUAL | GDK_WA_COLORMAP);
1180+#endif
1181
1182 g_object_ref_sink (priv->pager_window);
1183
1184- /* stay above the connection_window */
1185 gdk_window_set_transient_for (priv->pager_window,
1186- priv->connection_window);
1187+ gtk_widget_get_window (priv->parent));
1188
1189+ /* FIXME(Cimi) maybe this is not required with 0 as event mask */
1190 gdk_window_input_shape_combine_region (priv->pager_window,
1191+#ifdef USE_GTK3
1192+ cairo_region_create (),
1193+#else
1194 gdk_region_new (),
1195+#endif
1196 0, 0);
1197 }
1198
1199@@ -620,8 +641,6 @@
1200 if (priv->visible)
1201 {
1202 gdk_window_show (priv->pager_window);
1203-
1204- gdk_window_clear (priv->pager_window);
1205 }
1206 }
1207 }
1208@@ -647,8 +666,6 @@
1209 return;
1210
1211 gdk_window_show (priv->pager_window);
1212-
1213- gdk_window_clear (priv->pager_window);
1214 }
1215
1216 /**
1217
1218=== modified file 'os/os-scrollbar.c'
1219--- os/os-scrollbar.c 2011-06-03 15:47:48 +0000
1220+++ os/os-scrollbar.c 2011-06-08 15:38:03 +0000
1221@@ -27,6 +27,7 @@
1222 #include "os-scrollbar.h"
1223 #include "os-private.h"
1224 #include <gdk/gdkx.h>
1225+#include <X11/extensions/XInput2.h>
1226 #include "math.h"
1227
1228 /* Default size of the pager in pixels. */
1229@@ -99,8 +100,14 @@
1230 static gboolean thumb_motion_notify_event_cb (GtkWidget *widget, GdkEventMotion *event, gpointer user_data);
1231 static gboolean thumb_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, gpointer user_data);
1232 static void thumb_unmap_cb (GtkWidget *widget, gpointer user_data);
1233+
1234+#ifdef USE_GTK3
1235+static gboolean os_scrollbar_draw (GtkWidget *widget, cairo_t *cr);
1236+static void os_scrollbar_get_preferred_width (GtkWidget *widget, gint *minimal_width, gint *natural_width);
1237+static void os_scrollbar_get_preferred_height (GtkWidget *widget, gint *minimal_height, gint *natural_height);
1238+#else
1239 static gboolean os_scrollbar_expose_event (GtkWidget *widget, GdkEventExpose *event);
1240-
1241+#endif
1242 static void os_scrollbar_grab_notify (GtkWidget *widget, gboolean was_grabbed);
1243 static void os_scrollbar_hide (GtkWidget *widget);
1244 static void os_scrollbar_map (GtkWidget *widget);
1245@@ -889,7 +896,11 @@
1246
1247 gdk_flush ();
1248
1249+#ifdef USE_GTK3
1250+ gdk_error_trap_pop_ignored ();
1251+#else
1252 gdk_error_trap_pop ();
1253+#endif
1254 }
1255
1256 /* present a Gdk window */
1257@@ -1117,7 +1128,11 @@
1258
1259 gdk_flush ();
1260
1261+#ifdef USE_GTK3
1262+ gdk_error_trap_pop_ignored ();
1263+#else
1264 gdk_error_trap_pop ();
1265+#endif
1266 }
1267 }
1268
1269@@ -1441,6 +1456,257 @@
1270 }
1271
1272 /* filter function applied to the toplevel window */
1273+#ifdef USE_GTK3
1274+static GdkFilterReturn
1275+toplevel_filter_func (GdkXEvent *gdkxevent,
1276+ GdkEvent *event,
1277+ gpointer user_data)
1278+{
1279+ OsScrollbar *scrollbar;
1280+ OsScrollbarPrivate *priv;
1281+ XEvent *xev;
1282+
1283+ g_return_val_if_fail (OS_SCROLLBAR (user_data), GDK_FILTER_CONTINUE);
1284+
1285+ scrollbar = OS_SCROLLBAR (user_data);
1286+
1287+ priv = scrollbar->priv;
1288+ xev = gdkxevent;
1289+
1290+ g_return_val_if_fail (priv->pager != NULL, GDK_FILTER_CONTINUE);
1291+ g_return_val_if_fail (priv->thumb != NULL, GDK_FILTER_CONTINUE);
1292+
1293+ if (!priv->fullsize)
1294+ {
1295+ if (xev->type == GenericEvent)
1296+ {
1297+ XIDeviceEvent *xiev;
1298+
1299+ xiev = xev->xcookie.data;
1300+
1301+ if (xiev->evtype == XI_ButtonPress)
1302+ {
1303+ priv->toplevel_button_press = TRUE;
1304+ gtk_widget_hide (priv->thumb);
1305+ }
1306+
1307+ if (priv->toplevel_button_press && xiev->evtype == XI_ButtonRelease)
1308+ {
1309+ priv->toplevel_button_press = FALSE;
1310+
1311+ /* proximity area */
1312+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1313+ {
1314+ if ((priv->thumb_all.x - xiev->event_x <= PROXIMITY_WIDTH &&
1315+ priv->thumb_all.x - xiev->event_x >= 0) &&
1316+ (xiev->event_y >= priv->thumb_all.y + priv->overlay.y &&
1317+ xiev->event_y <= priv->thumb_all.y + priv->overlay.y + priv->overlay.height))
1318+ {
1319+ priv->can_hide = FALSE;
1320+
1321+ if (priv->lock_position)
1322+ return GDK_FILTER_CONTINUE;
1323+
1324+ if (priv->overlay.height > priv->slider.height)
1325+ {
1326+ gint x, y, x_pos, y_pos;
1327+
1328+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
1329+
1330+ x = priv->thumb_all.x;
1331+ y = CLAMP (xiev->event_y - priv->slider.height / 2,
1332+ priv->thumb_all.y + priv->overlay.y,
1333+ priv->thumb_all.y + priv->overlay.y + priv->overlay.height - priv->slider.height);
1334+
1335+ move_thumb (scrollbar, x_pos + x, y_pos + y);
1336+ }
1337+ else
1338+ {
1339+ move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1340+ }
1341+
1342+ gtk_widget_show (GTK_WIDGET (priv->thumb));
1343+ }
1344+ }
1345+ else
1346+ {
1347+ if ((priv->thumb_all.y - xiev->event_y <= PROXIMITY_WIDTH &&
1348+ priv->thumb_all.y - xiev->event_y >= 0) &&
1349+ (xiev->event_x >= priv->thumb_all.x + priv->overlay.x &&
1350+ xiev->event_x <= priv->thumb_all.x + priv->overlay.x + priv->overlay.width))
1351+ {
1352+ priv->can_hide = FALSE;
1353+
1354+ if (priv->lock_position)
1355+ return GDK_FILTER_CONTINUE;
1356+
1357+ if (priv->overlay.width > priv->slider.width)
1358+ {
1359+ gint x, y, x_pos, y_pos;
1360+
1361+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
1362+
1363+ x = CLAMP (xiev->event_x - priv->slider.width / 2,
1364+ priv->thumb_all.x + priv->overlay.x,
1365+ priv->thumb_all.x + priv->overlay.x + priv->overlay.width - priv->slider.width);
1366+ y = priv->thumb_all.y;
1367+
1368+ move_thumb (scrollbar, x_pos + x, y_pos + y);
1369+ }
1370+ else
1371+ {
1372+ move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1373+ }
1374+
1375+ gtk_widget_show (GTK_WIDGET (priv->thumb));
1376+ }
1377+ }
1378+ }
1379+
1380+ /* after a scroll-event, without motion,
1381+ * pager becomes inactive because the timeout in
1382+ * leave-notify-event starts,
1383+ * this call checks the pointer after the scroll-event,
1384+ * since it enters the window,
1385+ * then sets the state accordingly. */
1386+ if (!priv->active_window && xiev->evtype == XI_Enter)
1387+ {
1388+ XIEnterEvent *xiee = xev->xcookie.data;
1389+
1390+ pager_set_state_from_pointer (scrollbar, xiee->event_x, xiee->event_y);
1391+ }
1392+
1393+ if (xiev->evtype == XI_Leave)
1394+ {
1395+ /* never deactivate the pager in an active window. */
1396+ if (!priv->active_window)
1397+ {
1398+ priv->can_deactivate_pager = TRUE;
1399+
1400+ if (priv->source_deactivate_pager_id != 0)
1401+ g_source_remove (priv->source_deactivate_pager_id);
1402+
1403+ priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1404+ deactivate_pager_cb,
1405+ scrollbar);
1406+ }
1407+
1408+ priv->toplevel_button_press = FALSE;
1409+ priv->can_hide = TRUE;
1410+
1411+ if (priv->source_hide_thumb_id != 0)
1412+ g_source_remove (priv->source_hide_thumb_id);
1413+
1414+ priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1415+ hide_thumb_cb,
1416+ scrollbar);
1417+
1418+ if (priv->source_unlock_thumb_id != 0)
1419+ g_source_remove (priv->source_unlock_thumb_id);
1420+
1421+ priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1422+ unlock_thumb_cb,
1423+ scrollbar);
1424+ }
1425+
1426+ /* get the motion_notify_event trough XEvent */
1427+ if (!priv->toplevel_button_press && xiev->evtype == XI_Motion)
1428+ {
1429+ /* react to motion_notify_event
1430+ * and set the state accordingly. */
1431+ if (!priv->active_window)
1432+ pager_set_state_from_pointer (scrollbar, xiev->event_x, xiev->event_y);
1433+
1434+ /* proximity area */
1435+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1436+ {
1437+ if ((priv->thumb_all.x - xiev->event_x <= PROXIMITY_WIDTH &&
1438+ priv->thumb_all.x - xiev->event_x >= 0) &&
1439+ (xiev->event_y >= priv->thumb_all.y + priv->overlay.y &&
1440+ xiev->event_y <= priv->thumb_all.y + priv->overlay.y + priv->overlay.height))
1441+ {
1442+ priv->can_hide = FALSE;
1443+
1444+ if (priv->lock_position)
1445+ return GDK_FILTER_CONTINUE;
1446+
1447+ if (priv->overlay.height > priv->slider.height)
1448+ {
1449+ gint x, y, x_pos, y_pos;
1450+
1451+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
1452+
1453+ x = priv->thumb_all.x;
1454+ y = CLAMP (xiev->event_y - priv->slider.height / 2,
1455+ priv->thumb_all.y + priv->overlay.y,
1456+ priv->thumb_all.y + priv->overlay.y + priv->overlay.height - priv->slider.height);
1457+
1458+ move_thumb (scrollbar, x_pos + x, y_pos + y);
1459+ }
1460+ else
1461+ {
1462+ move_thumb (scrollbar, priv->win_x, priv->win_y + priv->slider.y);
1463+ }
1464+
1465+ os_pager_set_detached (OS_PAGER (priv->pager), FALSE);
1466+ os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
1467+ gtk_widget_show (GTK_WIDGET (priv->thumb));
1468+ }
1469+ else
1470+ {
1471+ priv->can_hide = TRUE;
1472+ priv->lock_position = FALSE;
1473+ hide_thumb (scrollbar);
1474+ }
1475+ }
1476+ else
1477+ {
1478+ if ((priv->thumb_all.y - xiev->event_y <= PROXIMITY_WIDTH &&
1479+ priv->thumb_all.y - xiev->event_y >= 0) &&
1480+ (xiev->event_x >= priv->thumb_all.x + priv->overlay.x &&
1481+ xiev->event_x <= priv->thumb_all.x + priv->overlay.x + priv->overlay.width))
1482+ {
1483+ priv->can_hide = FALSE;
1484+
1485+ if (priv->lock_position)
1486+ return GDK_FILTER_CONTINUE;
1487+
1488+ if (priv->overlay.width > priv->slider.width)
1489+ {
1490+ gint x, y, x_pos, y_pos;
1491+
1492+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
1493+
1494+ x = CLAMP (xiev->event_x - priv->slider.width / 2,
1495+ priv->thumb_all.x + priv->overlay.x,
1496+ priv->thumb_all.x + priv->overlay.x + priv->overlay.width - priv->slider.width);
1497+ y = priv->thumb_all.y;
1498+
1499+ move_thumb (scrollbar, x_pos + x, y_pos + y);
1500+ }
1501+ else
1502+ {
1503+ move_thumb (scrollbar, priv->win_x + priv->slider.x, priv->win_y);
1504+ }
1505+
1506+ os_pager_set_detached (OS_PAGER (priv->pager), FALSE);
1507+ os_thumb_set_detached (OS_THUMB (priv->thumb), FALSE);
1508+ gtk_widget_show (GTK_WIDGET (priv->thumb));
1509+ }
1510+ else
1511+ {
1512+ priv->can_hide = TRUE;
1513+ priv->lock_position = FALSE;
1514+ hide_thumb (scrollbar);
1515+ }
1516+ }
1517+ }
1518+ }
1519+ }
1520+
1521+ return GDK_FILTER_CONTINUE;
1522+}
1523+#else
1524 static GdkFilterReturn
1525 toplevel_filter_func (GdkXEvent *gdkxevent,
1526 GdkEvent *event,
1527@@ -1679,6 +1945,7 @@
1528
1529 return GDK_FILTER_CONTINUE;
1530 }
1531+#endif
1532
1533 G_DEFINE_TYPE (OsScrollbar, os_scrollbar, GTK_TYPE_SCROLLBAR);
1534
1535@@ -1691,16 +1958,24 @@
1536 gobject_class = G_OBJECT_CLASS (class);
1537 widget_class = GTK_WIDGET_CLASS (class);
1538
1539- widget_class->expose_event = os_scrollbar_expose_event;
1540- widget_class->grab_notify = os_scrollbar_grab_notify;
1541- widget_class->hide = os_scrollbar_hide;
1542- widget_class->map = os_scrollbar_map;
1543- widget_class->realize = os_scrollbar_realize;
1544- widget_class->show = os_scrollbar_show;
1545- widget_class->size_allocate = os_scrollbar_size_allocate;
1546- widget_class->size_request = os_scrollbar_size_request;
1547- widget_class->unmap = os_scrollbar_unmap;
1548- widget_class->unrealize = os_scrollbar_unrealize;
1549+#ifdef USE_GTK3
1550+ widget_class->draw = os_scrollbar_draw;
1551+ widget_class->get_preferred_width = os_scrollbar_get_preferred_width;
1552+ widget_class->get_preferred_height = os_scrollbar_get_preferred_height;
1553+#else
1554+ widget_class->expose_event = os_scrollbar_expose_event;
1555+#endif
1556+ widget_class->grab_notify = os_scrollbar_grab_notify;
1557+ widget_class->hide = os_scrollbar_hide;
1558+ widget_class->map = os_scrollbar_map;
1559+ widget_class->realize = os_scrollbar_realize;
1560+ widget_class->show = os_scrollbar_show;
1561+ widget_class->size_allocate = os_scrollbar_size_allocate;
1562+#ifndef USE_GTK3
1563+ widget_class->size_request = os_scrollbar_size_request;
1564+#endif
1565+ widget_class->unmap = os_scrollbar_unmap;
1566+ widget_class->unrealize = os_scrollbar_unrealize;
1567
1568 gobject_class->dispose = os_scrollbar_dispose;
1569 gobject_class->finalize = os_scrollbar_finalize;
1570@@ -1828,12 +2103,47 @@
1571 G_OBJECT_CLASS (os_scrollbar_parent_class)->finalize (object);
1572 }
1573
1574+#ifdef USE_GTK3
1575+static gboolean
1576+os_scrollbar_draw (GtkWidget *widget,
1577+ cairo_t *cr)
1578+{
1579+ return TRUE;
1580+}
1581+#else
1582 static gboolean
1583 os_scrollbar_expose_event (GtkWidget *widget,
1584 GdkEventExpose *event)
1585 {
1586 return TRUE;
1587 }
1588+#endif
1589+
1590+#if USE_GTK3
1591+static void
1592+os_scrollbar_get_preferred_width (GtkWidget *widget,
1593+ gint *minimal_width,
1594+ gint *natural_width)
1595+{
1596+ GtkRequisition requisition;
1597+
1598+ os_scrollbar_size_request (widget, &requisition);
1599+
1600+ *minimal_width = *natural_width = requisition.width;
1601+}
1602+
1603+static void
1604+os_scrollbar_get_preferred_height (GtkWidget *widget,
1605+ gint *minimal_height,
1606+ gint *natural_height)
1607+{
1608+ GtkRequisition requisition;
1609+
1610+ os_scrollbar_size_request (widget, &requisition);
1611+
1612+ *minimal_height = *natural_height = requisition.height;
1613+}
1614+#endif
1615
1616 static void
1617 os_scrollbar_grab_notify (GtkWidget *widget,
1618@@ -1981,7 +2291,7 @@
1619 {
1620 priv->slider.width = DEFAULT_THUMB_HEIGHT;
1621 priv->slider.height = DEFAULT_THUMB_WIDTH;
1622- priv->overlay_all.y = allocation->y - DEFAULT_PAGER_WIDTH ;
1623+ priv->overlay_all.y = allocation->y - DEFAULT_PAGER_WIDTH;
1624 priv->thumb_all.y = allocation->y + THUMB_ALLOCATION_SHIFT;
1625
1626 rect.x = priv->overlay_all.x;
1627@@ -2023,7 +2333,9 @@
1628 else
1629 requisition->height = 0;
1630
1631+#ifndef USE_GTK3
1632 widget->requisition = *requisition;
1633+#endif
1634 }
1635
1636 static void
1637
1638=== modified file 'os/os-thumb.c'
1639--- os/os-thumb.c 2011-05-19 13:19:14 +0000
1640+++ os/os-thumb.c 2011-06-08 15:38:03 +0000
1641@@ -66,7 +66,11 @@
1642 static gboolean os_thumb_button_press_event (GtkWidget *widget, GdkEventButton *event);
1643 static gboolean os_thumb_button_release_event (GtkWidget *widget, GdkEventButton *event);
1644 static void os_thumb_composited_changed (GtkWidget *widget);
1645+#ifdef USE_GTK3
1646+static gboolean os_thumb_draw (GtkWidget *widget, cairo_t *cr);
1647+#else
1648 static gboolean os_thumb_expose (GtkWidget *widget, GdkEventExpose *event);
1649+#endif
1650 static gboolean os_thumb_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event);
1651 static gboolean os_thumb_motion_notify_event (GtkWidget *widget, GdkEventMotion *event);
1652 static void os_thumb_map (GtkWidget *widget);
1653@@ -127,7 +131,11 @@
1654 widget_class->button_press_event = os_thumb_button_press_event;
1655 widget_class->button_release_event = os_thumb_button_release_event;
1656 widget_class->composited_changed = os_thumb_composited_changed;
1657+#if USE_GTK3
1658+ widget_class->draw = os_thumb_draw;
1659+#else
1660 widget_class->expose_event = os_thumb_expose;
1661+#endif
1662 widget_class->leave_notify_event = os_thumb_leave_notify_event;
1663 widget_class->map = os_thumb_map;
1664 widget_class->motion_notify_event = os_thumb_motion_notify_event;
1665@@ -343,16 +351,22 @@
1666 }
1667
1668 static gboolean
1669+#ifdef USE_GTK3
1670+os_thumb_draw (GtkWidget *widget,
1671+ cairo_t *cr)
1672+{
1673+#else
1674 os_thumb_expose (GtkWidget *widget,
1675 GdkEventExpose *event)
1676 {
1677 GtkAllocation allocation;
1678+ cairo_t *cr;
1679+#endif
1680 GtkStyle *style;
1681 OsThumb *thumb;
1682 OsThumbPrivate *priv;
1683 cairo_pattern_t *pat;
1684- cairo_t *cr;
1685- gint x, y, width, height;
1686+ gint width, height;
1687 gint radius;
1688
1689 style = gtk_widget_get_style (widget);
1690@@ -360,15 +374,19 @@
1691 thumb = OS_THUMB (widget);
1692 priv = thumb->priv;
1693
1694+ radius = priv->can_rgba ? THUMB_RADIUS : 0;
1695+
1696+#if USE_GTK3
1697+ width = gtk_widget_get_allocated_width (widget);
1698+ height = gtk_widget_get_allocated_height (widget);
1699+#else
1700 gtk_widget_get_allocation (widget, &allocation);
1701-
1702- x = 0;
1703- y = 0;
1704+
1705 width = allocation.width;
1706 height = allocation.height;
1707- radius = priv->can_rgba ? THUMB_RADIUS : 0;
1708
1709 cr = gdk_cairo_create (gtk_widget_get_window (widget));
1710+#endif
1711
1712 cairo_save (cr);
1713
1714@@ -384,12 +402,12 @@
1715 cairo_set_line_width (cr, 1);
1716 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1717
1718- draw_round_rect (cr, x, y, width, height, radius);
1719+ draw_round_rect (cr, 0, 0, width, height, radius);
1720
1721 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1722- pat = cairo_pattern_create_linear (x, y, width + x, y);
1723+ pat = cairo_pattern_create_linear (0, 0, width, 0);
1724 else
1725- pat = cairo_pattern_create_linear (x, y, x, height + y);
1726+ pat = cairo_pattern_create_linear (0, 0, 0, height);
1727
1728 cairo_pattern_add_color_stop_rgba (pat, 0.0, 0.95, 0.95, 0.95, 1.0);
1729 cairo_pattern_add_color_stop_rgba (pat, 1.0, 0.8, 0.8, 0.8, 1.0);
1730@@ -397,12 +415,12 @@
1731 cairo_pattern_destroy (pat);
1732 cairo_fill (cr);
1733
1734- draw_round_rect (cr, x, y, width, height, radius);
1735+ draw_round_rect (cr, 0, 0, width, height, radius);
1736
1737 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1738- pat = cairo_pattern_create_linear (x, y, x, height + y);
1739+ pat = cairo_pattern_create_linear (0, 0, 0, height);
1740 else
1741- pat = cairo_pattern_create_linear (x, y, width + x, y);
1742+ pat = cairo_pattern_create_linear (0, 0, width, 0);
1743
1744 if (priv->button_press_event && !priv->motion_notify_event)
1745 {
1746@@ -442,7 +460,7 @@
1747 cairo_fill (cr);
1748
1749 cairo_set_line_width (cr, 2.0);
1750- draw_round_rect (cr, x + 0.5, y + 0.5, width - 1, height - 1, radius - 1);
1751+ draw_round_rect (cr, 0.5, 0.5, width - 1, height - 1, radius - 1);
1752 if (!priv->detached)
1753 cairo_set_source_rgba (cr, style->bg[GTK_STATE_SELECTED].red/65535.0,
1754 style->bg[GTK_STATE_SELECTED].green/65535.0,
1755@@ -452,39 +470,39 @@
1756 cairo_stroke (cr);
1757
1758 cairo_set_line_width (cr, 1.0);
1759- draw_round_rect (cr, x + 1, y + 1, width - 2, height - 2, radius - 1);
1760+ draw_round_rect (cr, 1, 1, width - 2, height - 2, radius - 1);
1761 cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, 0.1);
1762 cairo_stroke (cr);
1763
1764- draw_round_rect (cr, x + 2, y + 2, width - 4, height - 4, radius - 3);
1765+ draw_round_rect (cr, 2, 2, width - 4, height - 4, radius - 3);
1766 cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, 0.5);
1767 cairo_stroke (cr);
1768
1769- draw_round_rect (cr, x + 3, y + 3, width - 6, height - 6, radius - 4);
1770+ draw_round_rect (cr, 3, 3, width - 6, height - 6, radius - 4);
1771 cairo_set_source_rgba (cr, 1, 1, 1, 0.2);
1772 cairo_stroke (cr);
1773
1774 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1775 {
1776- cairo_move_to (cr, x + 2.5, y - 1 + height / 2);
1777- cairo_line_to (cr, width - 2.5, y - 1 + height / 2);
1778+ cairo_move_to (cr, 2.5, - 1 + height / 2);
1779+ cairo_line_to (cr, width - 2.5, - 1 + height / 2);
1780 cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, 0.4);
1781 cairo_stroke (cr);
1782
1783- cairo_move_to (cr, x + 2.5, y + height / 2);
1784- cairo_line_to (cr, width - 2.5, y + height / 2);
1785+ cairo_move_to (cr, 2.5, height / 2);
1786+ cairo_line_to (cr, width - 2.5, height / 2);
1787 cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
1788 cairo_stroke (cr);
1789 }
1790 else
1791 {
1792- cairo_move_to (cr, x - 1 + width / 2, y + 2.5);
1793- cairo_line_to (cr, x - 1 + width / 2, height - 2.5);
1794+ cairo_move_to (cr, 1 + width / 2, 2.5);
1795+ cairo_line_to (cr, 1 + width / 2, height - 2.5);
1796 cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, 0.4);
1797 cairo_stroke (cr);
1798
1799- cairo_move_to (cr, x + width / 2, y + 2.5);
1800- cairo_line_to (cr, x + width / 2, height - 2.5);
1801+ cairo_move_to (cr, width / 2, 2.5);
1802+ cairo_line_to (cr, width / 2, height - 2.5);
1803 cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
1804 cairo_stroke (cr);
1805 }
1806@@ -526,7 +544,9 @@
1807
1808 cairo_restore (cr);
1809
1810+#ifndef USE_GTK3
1811 cairo_destroy (cr);
1812+#endif
1813
1814 return FALSE;
1815 }
1816@@ -635,10 +655,21 @@
1817 return FALSE;
1818 }
1819
1820+
1821 static void
1822 os_thumb_screen_changed (GtkWidget *widget,
1823 GdkScreen *old_screen)
1824 {
1825+#if USE_GTK3
1826+ GdkScreen *screen;
1827+ GdkVisual *visual;
1828+
1829+ screen = gtk_widget_get_screen (widget);
1830+ visual = gdk_screen_get_rgba_visual (screen);
1831+
1832+ if (visual)
1833+ gtk_widget_set_visual (widget, visual);
1834+#else
1835 GdkScreen *screen;
1836 GdkColormap *colormap;
1837
1838@@ -647,6 +678,7 @@
1839
1840 if (colormap)
1841 gtk_widget_set_colormap (widget, colormap);
1842+#endif
1843 }
1844
1845 static gboolean
1846
1847=== modified file 'pkgconfig/Makefile.am'
1848--- pkgconfig/Makefile.am 2011-03-01 02:39:50 +0000
1849+++ pkgconfig/Makefile.am 2011-06-08 15:38:03 +0000
1850@@ -1,13 +1,19 @@
1851-pcfiles = overlay-scrollbar-@OS_MAJORMINOR@.pc
1852+if USE_GTK3
1853+VER=3
1854+else
1855+VER=
1856+endif
1857+
1858+pcfiles = overlay-scrollbar$(VER)-@OS_MAJORMINOR@.pc
1859
1860 all-local: $(pcfiles)
1861
1862-%-@OS_MAJORMINOR@.pc: %.pc
1863+%$(VER)-@OS_MAJORMINOR@.pc: %.pc
1864 cp $< $@
1865
1866 pkgconfigdir = $(libdir)/pkgconfig
1867 pkgconfig_DATA = $(pcfiles)
1868
1869-EXTRA_DIST = overlay-scrollbar.pc.in
1870+EXTRA_DIST = overlay-scrollbar$(VER).pc.in
1871
1872 CLEANFILES = $(pcfiles)
1873
1874=== modified file 'tests/Makefile.am'
1875--- tests/Makefile.am 2011-03-02 16:15:54 +0000
1876+++ tests/Makefile.am 2011-06-08 15:38:03 +0000
1877@@ -1,3 +1,9 @@
1878+if USE_GTK3
1879+VER=3
1880+else
1881+VER=
1882+endif
1883+
1884 EXTRA_DIST = \
1885 test-os-pager.c \
1886 test-os-pixmap.c \
1887@@ -11,7 +17,7 @@
1888 -I$(top_srcdir) \
1889 $(OS_CFLAGS)
1890 test_os_LDFLAGS = \
1891- $(top_builddir)/os/liboverlay-scrollbar-@OS_MAJORMINOR@.la \
1892+ $(top_builddir)/os/liboverlay-scrollbar$(VER)-@OS_MAJORMINOR@.la \
1893 $(OS_LIBADD)
1894
1895 # FIXME(loicm): Figure out what tests must be compiled and add them here.

Subscribers

People subscribed via source and target branches