Merge lp:~laney/overlay-scrollbar/drop-gtk3 into lp:overlay-scrollbar

Proposed by Iain Lane
Status: Merged
Merged at revision: 392
Proposed branch: lp:~laney/overlay-scrollbar/drop-gtk3
Merge into: lp:overlay-scrollbar
Diff against target: 1916 lines (+164/-1067)
15 files modified
configure.ac (+5/-19)
data/81overlay-scrollbar (+4/-4)
debian/changelog (+9/-0)
debian/control (+5/-20)
debian/overlay-scrollbar-gtk2.install (+1/-1)
debian/overlay-scrollbar-gtk3.install (+0/-1)
debian/overlay-scrollbar.install (+2/-2)
debian/rules (+7/-24)
os/Makefile.am (+1/-9)
os/os-bar.c (+0/-134)
os/os-private.h (+0/-4)
os/os-scrollbar.c (+130/-787)
os/os-thumb.c (+0/-46)
tests/Makefile.am (+0/-8)
tests/test-os.c (+0/-8)
To merge this branch: bzr merge lp:~laney/overlay-scrollbar/drop-gtk3
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Lars Karlitski Approve
Ayatana Scrollbar Team Pending
Review via email: mp+260932@code.launchpad.net

Commit message

Drop overlay-scrollbar-gtk3 - gtk 3.16 has a replacement

Description of the change

We are going to use gtk 3.16's overlay scrollbars. Drop overlay-scrollbar-gtk3.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:402
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~laney/overlay-scrollbar/drop-gtk3/+merge/260932/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-ci/20/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-wily-amd64-ci/1
    SUCCESS: http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-wily-armhf-ci/1
    SUCCESS: http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-wily-i386-ci/1

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/overlay-scrollbar-ci/20/rebuild

review: Needs Fixing (continuous-integration)
Lars Karlitski (larsu) wrote :

Coding style is changed in some areas and the wrong branch is removed on line 613 in the diff (all this switching between ifdef and ifndef is confusing).

I have commits for those in lp:~larsu/overlay-scrollbar/drop-gtk3

review: Needs Fixing
403. By Iain Lane on 2015-06-03

merge lp:~larsu/overlay-scrollbar/drop-gtk3

Iain Lane (laney) wrote :

On Wed, Jun 03, 2015 at 01:12:38PM -0000, Lars Uebernickel wrote:
> Review: Needs Fixing
>
> Coding style is changed in some areas and the wrong branch is removed on line 613 in the diff (all this switching between ifdef and ifndef is confusing).
>
> I have commits for those in lp:~larsu/overlay-scrollbar/drop-gtk3

Thanks, merged, please re-review.

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:403
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~laney/overlay-scrollbar/drop-gtk3/+merge/260932/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-ci/21/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-wily-amd64-ci/2
    SUCCESS: http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-wily-armhf-ci/2
    SUCCESS: http://jenkins.qa.ubuntu.com/job/overlay-scrollbar-wily-i386-ci/2

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/overlay-scrollbar-ci/21/rebuild

review: Needs Fixing (continuous-integration)
Lars Karlitski (larsu) wrote :

Looks good to me now.

Thanks! This is awesome.

review: Approve
404. By Iain Lane on 2015-06-04

C/R o-s-gtk3 so that it gets removed on upgrade

405. By Iain Lane on 2015-06-04

Bump version so we can drop the weird +r...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed symlink 'INSTALL'
2=== target was u'/usr/share/automake-1.11/INSTALL'
3=== modified file 'configure.ac'
4--- configure.ac 2012-08-09 13:56:26 +0000
5+++ configure.ac 2015-06-04 09:25:27 +0000
6@@ -37,27 +37,14 @@
7 GLIB_GSETTINGS
8
9 AC_SUBST(glib_req, 2.26.0)
10-AC_SUBST(gtk_req, 2.22.0)
11-AC_SUBST(gtk3_req, 3.4.0)
12+AC_SUBST(gtk_req, 2.24.26)
13 AC_SUBST(cairo_req, 1.10)
14
15-AC_ARG_WITH([gtk],
16- [AS_HELP_STRING([--with-gtk], [Which version of gtk to use @<:@default=3@:>@])],
17- [],
18- [with_gtk=3])
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- [test "x$with_gtk" = x2],
24- [PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-2.0 >= $gtk_req cairo >= $cairo_req)
25- AC_SUBST(DEPS_CFLAGS)
26- AC_SUBST(DEPS_LIBS)],
27- [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])]
28-)
29-AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3])
30+PKG_CHECK_MODULES(DEPS, [glib-2.0 >= $glib_req gtk+-2.0 >= $gtk_req cairo >= $cairo_req gmodule-2.0 >= $glib_req x11],
31+ [AC_SUBST(DEPS_CFLAGS)
32+ AC_SUBST(DEPS_LIBS)])
33
34-GTK_MODULES_DIR="${libdir}/gtk-"$with_gtk".0/modules"
35+GTK_MODULES_DIR="${libdir}/gtk-2.0/modules"
36 AC_SUBST(GTK_MODULES_DIR)
37
38 # Check if build tests
39@@ -146,7 +133,6 @@
40 echo " overlay-scrollbar $PACKAGE_VERSION"
41 echo " ======================="
42 echo ""
43-echo " Gtk+: ${with_gtk}"
44 echo " Tests: ${enable_tests}"
45 echo " Debug: ${enable_debug}"
46 echo " Prefix: ${prefix}"
47
48=== modified file 'data/81overlay-scrollbar'
49--- data/81overlay-scrollbar 2012-05-15 16:42:07 +0000
50+++ data/81overlay-scrollbar 2015-06-04 09:25:27 +0000
51@@ -1,9 +1,9 @@
52 # This file is sourced by Xsession(5), not executed.
53
54-if [ -z "$GTK_MODULES" ] ; then
55- GTK_MODULES="overlay-scrollbar"
56+if [ -z "$GTK2_MODULES" ] ; then
57+ GTK2_MODULES="overlay-scrollbar"
58 else
59- GTK_MODULES="$GTK_MODULES:overlay-scrollbar"
60+ GTK2_MODULES="$GTK2_MODULES:overlay-scrollbar"
61 fi
62
63-export GTK_MODULES
64+export GTK2_MODULES
65
66=== modified file 'debian/changelog'
67--- debian/changelog 2015-03-19 09:00:11 +0000
68+++ debian/changelog 2015-06-04 09:25:27 +0000
69@@ -1,3 +1,12 @@
70+overlay-scrollbar (0.2.17.1+15.10.20150604-0ubuntu1) UNRELEASED; urgency=medium
71+
72+ * Drop overlay-scrollbar-gtk3 - this is no longer needed with GTK 3.16.
73+ Force it to be removed, since loading it with GTK 3.16 causes visual
74+ problems.
75+ * Bump Standards-Verison to 3.9.6
76+
77+ -- Iain Lane <iain.lane@canonical.com> Wed, 03 Jun 2015 12:52:13 +0100
78+
79 overlay-scrollbar (0.2.16+r359+15.04.20150319-0ubuntu1) vivid; urgency=medium
80
81 [ Lars Uebernickel ]
82
83=== modified file 'debian/control'
84--- debian/control 2013-05-01 19:11:34 +0000
85+++ debian/control 2015-06-04 09:25:27 +0000
86@@ -6,9 +6,8 @@
87 dh-autoreconf,
88 libcairo2-dev (>= 1.10),
89 libglib2.0-dev (>= 2.26.0),
90- libgtk-3-dev,
91- libgtk2.0-dev,
92-Standards-Version: 3.9.3
93+ libgtk2.0-dev (>= 2.24.26),
94+Standards-Version: 3.9.6
95 Section: libs
96 Homepage: http://launchpad.net/ayatana-scrollbar
97 # If you aren't a member of ~ayatana-scrollbar-team but need to upload
98@@ -17,26 +16,11 @@
99 Vcs-Bzr: https://code.launchpad.net/~ayatana-scrollbar-team/overlay-scrollbar/trunk
100 Vcs-Browser: https://bazaar.launchpad.net/~ayatana-scrollbar-team/overlay-scrollbar/trunk/files
101
102-Package: overlay-scrollbar-gtk3
103-Section: libs
104-Architecture: any
105-Multi-Arch: same
106-Depends: overlay-scrollbar,
107- ${misc:Depends},
108- ${shlibs:Depends},
109-Replaces: liboverlay-scrollbar3-0.2-0 (<< 0.2.16+r348),
110- liboverlay-scrollbar3-0.2-dev (<< 0.2.16+r348),
111-Conflicts: liboverlay-scrollbar3-0.2-0 (<< 0.2.16+r348),
112- liboverlay-scrollbar3-0.2-dev (<< 0.2.16+r348),
113-Description: GTK 3 module for overlay scrollbars
114- Overlay scrollbar is a GtkModule enabling a dynamic overlay behavior.
115-
116 Package: overlay-scrollbar-gtk2
117 Section: libs
118 Architecture: any
119 Multi-Arch: same
120-Depends: overlay-scrollbar,
121- ${misc:Depends},
122+Depends: ${misc:Depends},
123 ${shlibs:Depends},
124 Replaces: liboverlay-scrollbar-0.2-0 (<< 0.2.16+r348),
125 liboverlay-scrollbar-0.2-dev (<< 0.2.16+r348),
126@@ -49,7 +33,8 @@
127 Section: libs
128 Architecture: all
129 Depends: overlay-scrollbar-gtk2,
130- overlay-scrollbar-gtk3,
131 ${misc:Depends},
132+Conflicts: overlay-scrollbar-gtk3
133+Replaces: overlay-scrollbar-gtk3
134 Description: Scrollbar overlay
135 Overlay scrollbar is a GtkModule enabling a dynamic overlay behavior.
136
137=== modified file 'debian/overlay-scrollbar-gtk2.install'
138--- debian/overlay-scrollbar-gtk2.install 2012-09-24 14:25:40 +0000
139+++ debian/overlay-scrollbar-gtk2.install 2015-06-04 09:25:27 +0000
140@@ -1,1 +1,1 @@
141-debian/tmp/gtk2/usr/lib/* /usr/lib/
142+usr/lib
143
144=== removed file 'debian/overlay-scrollbar-gtk3.install'
145--- debian/overlay-scrollbar-gtk3.install 2012-09-24 14:25:40 +0000
146+++ debian/overlay-scrollbar-gtk3.install 1970-01-01 00:00:00 +0000
147@@ -1,1 +0,0 @@
148-debian/tmp/gtk3/usr/lib/* /usr/lib/
149
150=== modified file 'debian/overlay-scrollbar.install'
151--- debian/overlay-scrollbar.install 2013-05-01 19:11:34 +0000
152+++ debian/overlay-scrollbar.install 2015-06-04 09:25:27 +0000
153@@ -1,2 +1,2 @@
154-debian/tmp/gtk3/etc/X11 /etc/
155-debian/tmp/gtk3/usr/share/glib-2.0 /usr/share/
156+etc
157+usr/share
158
159=== modified file 'debian/rules'
160--- debian/rules 2012-11-26 13:59:47 +0000
161+++ debian/rules 2015-06-04 09:25:27 +0000
162@@ -1,10 +1,8 @@
163 #!/usr/bin/make -f
164
165-FLAVORS = gtk2 gtk3
166-
167-CONFIGURE_FLAGS_gtk2 = --with-gtk=2
168-CONFIGURE_FLAGS_gtk3 = --with-gtk=3
169-CONFIGURE_COMMON_FLAGS = --disable-static --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
170+CONFIGURE_COMMON_FLAGS = --disable-static \
171+ --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
172+ --disable-silent-rules
173
174 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
175
176@@ -14,26 +12,11 @@
177 override_dh_autoreconf:
178 NOCONFIGURE=1 dh_autoreconf ./autogen.sh
179
180-override_dh_auto_configure: $(FLAVORS:%=doconfigure-%)
181-
182-doconfigure-%:
183- dh_auto_configure --builddirectory=build/$* -- \
184- $(CONFIGURE_FLAGS_$*) \
185- $(CONFIGURE_COMMON_FLAGS)
186-
187-override_dh_auto_build: $(FLAVORS:%=dobuild-%)
188-
189-dobuild-%:
190- dh_auto_build --builddirectory=build/$*
191-
192-override_dh_auto_install: $(FLAVORS:%=doinstall-%)
193-
194-doinstall-%:
195- dh_auto_install --sourcedir=build/$* --destdir=debian/tmp/$*
196+override_dh_auto_configure:
197+ dh_auto_configure -- $(CONFIGURE_COMMON_FLAGS)
198
199 override_dh_install:
200- find debian/tmp -name \*.la -delete
201- rm -rf debian/tmp/gtk2/usr/share/glib-2.0/schemas
202- rm -f debian/tmp/gtk2/etc/X11/Xsession.d/81overlay-scrollbar
203 dh_install --fail-missing
204+ find debian/overlay-scrollbar-gtk2 -name \*.la -delete
205
206+override_dh_makeshlibs:
207
208=== modified file 'os/Makefile.am'
209--- os/Makefile.am 2012-04-26 14:44:19 +0000
210+++ os/Makefile.am 2015-06-04 09:25:27 +0000
211@@ -1,8 +1,4 @@
212-if USE_GTK3
213-VER=3
214-else
215 VER=
216-endif
217
218 source_h = \
219 $(srcdir)/os-private.h \
220@@ -21,12 +17,8 @@
221
222 liboverlay_scrollbar_la_SOURCES = $(source_h) $(source_c)
223
224-if USE_GTK3
225-liboverlay_scrollbar_la_CFLAGS = $(OS_CFLAGS) -DUSE_GTK3
226-else
227 liboverlay_scrollbar_la_CFLAGS = $(OS_CFLAGS)
228-endif
229
230-liboverlay_scrollbar_la_LIBADD = $(OS_LIBADD)
231+liboverlay_scrollbar_la_LIBADD = $(OS_LIBADD) -lm
232
233 liboverlay_scrollbar_la_LDFLAGS = $(OS_LDFLAGS)
234
235=== modified file 'os/os-bar.c'
236--- os/os-bar.c 2013-11-29 13:45:59 +0000
237+++ os/os-bar.c 2015-06-04 09:25:27 +0000
238@@ -62,13 +62,8 @@
239 static void
240 draw_bar (OsBar *bar)
241 {
242-#ifdef USE_GTK3
243- GdkRGBA c1, c2, color;
244- GtkStyleContext *style_context;
245-#else
246 GdkColor color;
247 GtkStyle *style;
248-#endif
249 OsBarPrivate *priv;
250 gfloat weight;
251
252@@ -76,27 +71,6 @@
253
254 weight = priv->weight;
255
256-#ifdef USE_GTK3
257- style_context = gtk_widget_get_style_context (priv->parent);
258-
259- if (priv->active == FALSE)
260- {
261- gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_INSENSITIVE, &c1);
262- gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_SELECTED, &c2);
263- }
264- else
265- {
266- gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_SELECTED, &c1);
267- gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_INSENSITIVE, &c2);
268- }
269-
270- color.red = weight * c1.red + (1.0 - weight) * c2.red;
271- color.green = weight * c1.green + (1.0 - weight) * c2.green;
272- color.blue = weight * c1.blue + (1.0 - weight) * c2.blue;
273- color.alpha = 1.0;
274-
275- gdk_window_set_background_rgba (priv->bar_window, &color);
276-#else
277 style = gtk_widget_get_style (priv->parent);
278
279 color = style->bg[GTK_STATE_SELECTED];
280@@ -104,7 +78,6 @@
281 gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->bar_window), &color, FALSE, TRUE);
282
283 gdk_window_set_background (priv->bar_window, &color);
284-#endif
285
286 gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE);
287 }
288@@ -113,26 +86,12 @@
289 static void
290 draw_tail (OsBar *bar)
291 {
292-#ifdef USE_GTK3
293- GdkRGBA color;
294- GtkStyleContext *style_context;
295-#else
296 GdkColor color;
297 GtkStyle *style;
298-#endif
299 OsBarPrivate *priv;
300
301 priv = bar->priv;
302
303-#ifdef USE_GTK3
304- style_context = gtk_widget_get_style_context (priv->parent);
305-
306- gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_ACTIVE, &color);
307-
308- color.alpha = 1.0;
309-
310- gdk_window_set_background_rgba (priv->tail_window, &color);
311-#else
312 style = gtk_widget_get_style (priv->parent);
313
314 color = style->bg[GTK_STATE_ACTIVE];
315@@ -140,7 +99,6 @@
316 gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->tail_window), &color, FALSE, TRUE);
317
318 gdk_window_set_background (priv->tail_window, &color);
319-#endif
320
321 gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE);
322 }
323@@ -222,19 +180,9 @@
324 gint offset_x,
325 gint offset_y)
326 {
327-#ifdef USE_GTK3
328-
329- cairo_region_t * shape_region = cairo_region_create_rectangle (shape_rect);
330- gdk_window_shape_combine_region (window, shape_region, offset_x, offset_y);
331- cairo_region_destroy (shape_region);
332-
333-#else
334-
335 GdkRegion * shape_region = gdk_region_rectangle (shape_rect);
336 gdk_window_shape_combine_region (window, shape_region, offset_x, offset_y);
337 gdk_region_destroy (shape_region);
338-
339-#endif
340 }
341
342 /* Callback called by the retract-tail animation. */
343@@ -545,60 +493,6 @@
344 }
345
346 /**
347- * os_bar_set_active:
348- * @bar: a #OsBar
349- * @active: whether is active or not
350- * @animate: whether animate it or not
351- *
352- * Changes the activity state of @bar.
353- **/
354-void
355-os_bar_set_active (OsBar *bar,
356- gboolean active,
357- gboolean animate)
358-{
359-#ifdef USE_GTK3
360- OsBarPrivate *priv;
361-
362- g_return_if_fail (OS_IS_BAR (bar));
363-
364- priv = bar->priv;
365-
366- /* Set the state and draw even if there's a state_animation running, that is
367- * (!animate && os_animation_is_running (priv->state_animation)). */
368- if ((priv->active != active) ||
369- (!animate && os_animation_is_running (priv->state_animation)))
370- {
371- gboolean visible;
372-
373- priv->active = active;
374-
375- if (priv->parent == NULL)
376- return;
377-
378- visible = gdk_window_is_visible (priv->bar_window);
379-
380- if (visible)
381- os_animation_stop (priv->state_animation, NULL);
382-
383- if (visible && animate)
384- {
385- os_animation_set_duration (priv->state_animation, priv->active ? DURATION_FADE_IN :
386- DURATION_FADE_OUT);
387- os_animation_start (priv->state_animation);
388- }
389-
390- if (!visible || !animate)
391- {
392- priv->weight = 1.0f;
393-
394- draw_bar (bar);
395- }
396- }
397-#endif
398-}
399-
400-/**
401 * os_bar_set_detached:
402 * @bar: a #OsBar
403 * @detached: whether the bar is detached or not
404@@ -702,23 +596,12 @@
405 attributes.wclass = GDK_INPUT_OUTPUT;
406 attributes.window_type = GDK_WINDOW_CHILD;
407 attributes.visual = gtk_widget_get_visual (priv->parent);
408-#ifndef USE_GTK3
409 attributes.colormap = gtk_widget_get_colormap (priv->parent);
410-#endif
411
412 /* tail_window. */
413 priv->tail_window = gdk_window_new (gtk_widget_get_window (priv->parent),
414 &attributes,
415-#ifdef USE_GTK3
416- GDK_WA_VISUAL);
417-#else
418 GDK_WA_VISUAL | GDK_WA_COLORMAP);
419-#endif
420-
421-#ifdef USE_GTK3
422- gdk_window_ensure_native (priv->tail_window);
423- gtk_widget_register_window (priv->parent, priv->tail_window);
424-#endif
425
426 g_object_ref_sink (priv->tail_window);
427
428@@ -727,26 +610,13 @@
429
430 /* FIXME(Cimi) maybe this is not required with 0 as event mask. */
431 gdk_window_input_shape_combine_region (priv->tail_window,
432-#ifdef USE_GTK3
433- cairo_region_create (),
434-#else
435 gdk_region_new (),
436-#endif
437 0, 0);
438
439 /* bar_window. */
440 priv->bar_window = gdk_window_new (gtk_widget_get_window (priv->parent),
441 &attributes,
442-#ifdef USE_GTK3
443- GDK_WA_VISUAL);
444-#else
445 GDK_WA_VISUAL | GDK_WA_COLORMAP);
446-#endif
447-
448-#ifdef USE_GTK3
449- gdk_window_ensure_native (priv->bar_window);
450- gtk_widget_register_window (priv->parent, priv->bar_window);
451-#endif
452
453 g_object_ref_sink (priv->bar_window);
454
455@@ -755,11 +625,7 @@
456
457 /* FIXME(Cimi) maybe this is not required with 0 as event mask. */
458 gdk_window_input_shape_combine_region (priv->bar_window,
459-#ifdef USE_GTK3
460- cairo_region_create (),
461-#else
462 gdk_region_new (),
463-#endif
464 0, 0);
465
466 mask_tail (bar);
467
468=== modified file 'os/os-private.h'
469--- os/os-private.h 2012-11-26 14:35:24 +0000
470+++ os/os-private.h 2015-06-04 09:25:27 +0000
471@@ -196,10 +196,6 @@
472 void os_bar_move_resize (OsBar *bar,
473 GdkRectangle mask);
474
475-void os_bar_set_active (OsBar *bar,
476- gboolean active,
477- gboolean animate);
478-
479 void os_bar_set_detached (OsBar *bar,
480 gboolean detached,
481 gboolean animate);
482
483=== modified file 'os/os-scrollbar.c'
484--- os/os-scrollbar.c 2015-03-03 08:57:49 +0000
485+++ os/os-scrollbar.c 2015-06-04 09:25:27 +0000
486@@ -126,9 +126,6 @@
487 gboolean allow_resize;
488 gboolean allow_resize_paned;
489 gboolean resizing_paned;
490-#ifdef USE_GTK3
491- gboolean deactivable_bar;
492-#endif
493 gboolean hidable_thumb;
494 gboolean window_button_press; /* FIXME(Cimi) to replace with X11 input events. */
495 gdouble value;
496@@ -142,11 +139,6 @@
497 guint32 source_unlock_thumb_id;
498 } OsScrollbarPrivate;
499
500-#ifdef USE_GTK3
501-static GdkInputSource os_input_source = GDK_SOURCE_MOUSE;
502-static gint os_device_id = 0;
503-static GtkCssProvider *provider = NULL;
504-#endif
505 static Atom net_active_window_atom = None;
506 static Atom unity_net_workarea_region_atom = None;
507 static GSList *os_root_list = NULL;
508@@ -176,16 +168,9 @@
509 static void thumb_unmap_cb (GtkWidget *widget, gpointer user_data);
510
511 /* GtkScrollbar vfunc pointers. */
512-#ifdef USE_GTK3
513-static gboolean (* pre_hijacked_scrollbar_draw) (GtkWidget *widget, cairo_t *cr);
514-static void (* pre_hijacked_scrollbar_get_preferred_width) (GtkWidget *widget, gint *minimal_width, gint *natural_width);
515-static void (* pre_hijacked_scrollbar_get_preferred_height) (GtkWidget *widget, gint *minimal_height, gint *natural_height);
516-static void (* pre_hijacked_scrollbar_state_flags_changed) (GtkWidget *widget, GtkStateFlags flags);
517-#else
518 static gboolean (* pre_hijacked_scrollbar_expose_event) (GtkWidget *widget, GdkEventExpose *event);
519 static void (* pre_hijacked_scrollbar_size_request) (GtkWidget *widget, GtkRequisition *requisition);
520 static void (* pre_hijacked_scrollbar_state_changed) (GtkWidget *widget, GtkStateType state);
521-#endif
522 static void (* pre_hijacked_scrollbar_grab_notify) (GtkWidget *widget, gboolean was_grabbed);
523 static void (* pre_hijacked_scrollbar_hide) (GtkWidget *widget);
524 static void (* pre_hijacked_scrollbar_map) (GtkWidget *widget);
525@@ -197,16 +182,9 @@
526 static void (* pre_hijacked_scrollbar_dispose) (GObject *object);
527
528 /* Hijacked GtkScrollbar vfunc pointers. */
529-#ifdef USE_GTK3
530-static gboolean hijacked_scrollbar_draw (GtkWidget *widget, cairo_t *cr);
531-static void hijacked_scrollbar_get_preferred_width (GtkWidget *widget, gint *minimal_width, gint *natural_width);
532-static void hijacked_scrollbar_get_preferred_height (GtkWidget *widget, gint *minimal_height, gint *natural_height);
533-static void hijacked_scrollbar_state_flags_changed (GtkWidget *widget, GtkStateFlags flags);
534-#else
535 static gboolean hijacked_scrollbar_expose_event (GtkWidget *widget, GdkEventExpose *event);
536 static void hijacked_scrollbar_size_request (GtkWidget *widget, GtkRequisition *requisition);
537 static void hijacked_scrollbar_state_changed (GtkWidget *widget, GtkStateType state);
538-#endif
539 static void hijacked_scrollbar_grab_notify (GtkWidget *widget, gboolean was_grabbed);
540 static void hijacked_scrollbar_hide (GtkWidget *widget);
541 static void hijacked_scrollbar_map (GtkWidget *widget);
542@@ -576,38 +554,6 @@
543 return value;
544 }
545
546-#ifdef USE_GTK3
547-/* Deactivate the bar if it's the case. */
548-static void
549-deactivate_bar (GtkScrollbar *scrollbar)
550-{
551- OsScrollbarPrivate *priv;
552-
553- priv = get_private (GTK_WIDGET (scrollbar));
554-
555- if (priv->bar != NULL && priv->deactivable_bar)
556- os_bar_set_active (priv->bar, FALSE, TRUE);
557-}
558-
559-/* Timeout before deactivating the bar. */
560-static gboolean
561-deactivate_bar_cb (gpointer user_data)
562-{
563- GtkScrollbar *scrollbar;
564- OsScrollbarPrivate *priv;
565-
566- scrollbar = GTK_SCROLLBAR (user_data);
567- priv = get_private (GTK_WIDGET (scrollbar));
568-
569- OS_DCHECK (!priv->active_window);
570-
571- deactivate_bar (scrollbar);
572- priv->source_deactivate_bar_id = 0;
573-
574- return FALSE;
575-}
576-#endif
577-
578 /* destroy the private struct */
579 static void
580 destroy_private (gpointer priv)
581@@ -669,9 +615,6 @@
582
583 /* Initialize struct variables. */
584 qdata->side = OS_SIDE_RIGHT;
585-#ifdef USE_GTK3
586- qdata->deactivable_bar = TRUE;
587-#endif
588 qdata->hidable_thumb = TRUE;
589 qdata->fine_scroll_multiplier = 1.0;
590 qdata->bar = os_bar_new ();
591@@ -733,11 +676,7 @@
592 static gboolean
593 is_insensitive (GtkScrollbar *scrollbar)
594 {
595-#ifdef USE_GTK3
596- return (gtk_widget_get_state_flags (GTK_WIDGET (scrollbar)) & GTK_STATE_FLAG_INSENSITIVE) != 0;
597-#else
598 return gtk_widget_get_state (GTK_WIDGET (scrollbar)) == GTK_STATE_INSENSITIVE;
599-#endif
600 }
601
602 /* Move the bar. */
603@@ -829,9 +768,7 @@
604 gint x,
605 gint y)
606 {
607-#ifndef USE_GTK3
608 GdkRectangle gdk_rect;
609-#endif
610 GdkScreen *screen;
611 OsScrollbarPrivate *priv;
612 cairo_rectangle_int_t rect;
613@@ -845,16 +782,12 @@
614
615 screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar));
616 n_monitor = gdk_screen_get_monitor_at_point (screen, monitor_x, y);
617-#ifdef USE_GTK3
618- gdk_screen_get_monitor_geometry (screen, n_monitor, &rect);
619-#else
620 gdk_screen_get_monitor_geometry (screen, n_monitor, &gdk_rect);
621
622 rect.x = gdk_rect.x;
623 rect.y = gdk_rect.y;
624 rect.width = gdk_rect.width;
625 rect.height = gdk_rect.height;
626-#endif
627
628 screen_x = rect.x;
629 screen_width = rect.x + rect.width;
630@@ -972,9 +905,7 @@
631 gint x,
632 gint y)
633 {
634-#ifndef USE_GTK3
635 GdkRectangle gdk_rect;
636-#endif
637 GdkScreen *screen;
638 OsScrollbarPrivate *priv;
639 cairo_rectangle_int_t rect;
640@@ -988,16 +919,12 @@
641
642 screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar));
643 n_monitor = gdk_screen_get_monitor_at_point (screen, x, monitor_y);
644-#ifdef USE_GTK3
645- gdk_screen_get_monitor_geometry (screen, n_monitor, &rect);
646-#else
647 gdk_screen_get_monitor_geometry (screen, n_monitor, &gdk_rect);
648
649 rect.x = gdk_rect.x;
650 rect.y = gdk_rect.y;
651 rect.width = gdk_rect.width;
652 rect.height = gdk_rect.height;
653-#endif
654
655 screen_y = rect.y;
656 screen_height = rect.y + rect.height;
657@@ -1286,17 +1213,7 @@
658 gint *x,
659 gint *y)
660 {
661-#ifdef USE_GTK3
662- GdkDeviceManager *device_manager;
663- GdkDevice *device;
664-
665- device_manager = gdk_display_get_device_manager (gdk_window_get_display (window));
666- device = gdk_device_manager_get_client_pointer (device_manager);
667-
668- return gdk_device_get_window_at_position (device, x, y);
669-#else
670 return gdk_window_at_pointer (x, y);
671-#endif
672 }
673
674 /* Get the position of the pointer. */
675@@ -1306,17 +1223,7 @@
676 gint *y,
677 GdkModifierType *mask)
678 {
679-#ifdef USE_GTK3
680- GdkDeviceManager *device_manager;
681- GdkDevice *device;
682-
683- device_manager = gdk_display_get_device_manager (gdk_window_get_display (window));
684- device = gdk_device_manager_get_client_pointer (device_manager);
685-
686- return gdk_window_get_device_position (window, device, x, y, mask);
687-#else
688 return gdk_window_get_pointer (window, x, y, mask);
689-#endif
690 }
691
692 /* Adjustment functions. */
693@@ -1506,38 +1413,6 @@
694 move_bar (scrollbar);
695 }
696
697-#ifdef USE_GTK3
698-/* Bar functions. */
699-
700-/* Set the state of the bar checking mouse position. */
701-static void
702-bar_set_state_from_pointer (GtkScrollbar *scrollbar,
703- gint x,
704- gint y)
705-{
706- GtkAllocation allocation;
707- OsScrollbarPrivate *priv;
708-
709- priv = get_private (GTK_WIDGET (scrollbar));
710-
711- OS_DCHECK (!priv->active_window);
712-
713- gtk_widget_get_allocation (gtk_widget_get_parent (GTK_WIDGET (scrollbar)), &allocation);
714-
715- if ((x > allocation.x && x < allocation.x + allocation.width) &&
716- (y > allocation.y && y < allocation.y + allocation.height))
717- {
718- priv->deactivable_bar = FALSE;
719- os_bar_set_active (priv->bar, TRUE, TRUE);
720- }
721- else
722- {
723- priv->deactivable_bar = TRUE;
724- os_bar_set_active (priv->bar, FALSE, TRUE);
725- }
726-}
727-#endif
728-
729 /* Root window functions. */
730
731 /* Filter function applied to the root window. */
732@@ -1600,12 +1475,7 @@
733 &xev);
734
735 gdk_flush ();
736-
737-#ifdef USE_GTK3
738- gdk_error_trap_pop_ignored ();
739-#else
740 gdk_error_trap_pop ();
741-#endif
742 }
743
744 /* Present a Gdk window. */
745@@ -1858,9 +1728,6 @@
746
747 priv->event |= OS_EVENT_ENTER_NOTIFY;
748
749-#ifdef USE_GTK3
750- priv->deactivable_bar = FALSE;
751-#endif
752 priv->hidable_thumb = FALSE;
753
754 if (priv->state & OS_STATE_INTERNAL)
755@@ -1876,15 +1743,6 @@
756
757 scrollbar = GTK_SCROLLBAR (user_data);
758
759-#ifdef USE_GTK3
760- /* Gtk+ 3.3.18 emits more GdkEventCrossing
761- * with touch devices, skip few events. */
762- if (event->mode == GDK_CROSSING_TOUCH_BEGIN ||
763- event->mode == GDK_CROSSING_TOUCH_END ||
764- event->mode == GDK_CROSSING_DEVICE_SWITCH)
765- return FALSE;
766-#endif
767-
768 enter_event (scrollbar);
769
770 return FALSE;
771@@ -1901,22 +1759,6 @@
772 scrollbar = GTK_SCROLLBAR (user_data);
773 priv = get_private (GTK_WIDGET (scrollbar));
774
775-#ifdef USE_GTK3
776- /* Gtk+ 3.3.18 emits more GdkEventCrossing
777- * with touch devices, skip few events.
778- * Last line skips the event if the pointer is still in the window:
779- * this happens with touch devices because Gtk+ emits
780- * GDK_CROSSING_UNGRAB to the touch device, thus calling leave-notify,
781- * and we want to skip those events.
782- *
783- * FIXME the logic of this event should be rewritten. */
784- if (event->mode == GDK_CROSSING_TOUCH_BEGIN ||
785- event->mode == GDK_CROSSING_TOUCH_END ||
786- event->mode == GDK_CROSSING_DEVICE_SWITCH ||
787- window_at_pointer (event->window, NULL, NULL) == event->window)
788- return FALSE;
789-#endif
790-
791 /* When exiting the thumb horizontally (or vertically),
792 * in LOCKED state, remove the lock. */
793 if ((priv->state & OS_STATE_LOCKED) &&
794@@ -1930,21 +1772,6 @@
795 * not interacting with the thumb. */
796 if (!(priv->event & OS_EVENT_BUTTON_PRESS))
797 {
798-#ifdef USE_GTK3
799- /* Never deactivate the bar in an active window. */
800- if (!priv->active_window)
801- {
802- priv->deactivable_bar = TRUE;
803-
804- if (priv->source_deactivate_bar_id != 0)
805- g_source_remove (priv->source_deactivate_bar_id);
806-
807- priv->source_deactivate_bar_id = g_timeout_add (TIMEOUT_THUMB_HIDE,
808- deactivate_bar_cb,
809- scrollbar);
810- }
811-#endif
812-
813 priv->event &= ~(OS_EVENT_ENTER_NOTIFY);
814
815 priv->hidable_thumb = TRUE;
816@@ -1973,16 +1800,6 @@
817
818 scrollbar = GTK_SCROLLBAR (user_data);
819
820-#ifdef USE_GTK3
821- OsScrollbarPrivate *priv;
822-
823- /* Immediately set the bar to be active. */
824- priv = get_private (GTK_WIDGET (scrollbar));
825-
826- priv->deactivable_bar = FALSE;
827- os_bar_set_active (priv->bar, TRUE, FALSE);
828-#endif
829-
830 xid = GDK_WINDOW_XID (gtk_widget_get_window (widget));
831 xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (gtk_widget_get_toplevel (GTK_WIDGET (scrollbar))));
832 display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (GTK_WIDGET (scrollbar)));
833@@ -2031,12 +1848,7 @@
834 &xev);
835
836 gdk_flush ();
837-
838-#ifdef USE_GTK3
839- gdk_error_trap_pop_ignored ();
840-#else
841 gdk_error_trap_pop ();
842-#endif
843 }
844 }
845
846@@ -2117,17 +1929,6 @@
847 scrollbar = GTK_SCROLLBAR (user_data);
848 priv = get_private (GTK_WIDGET (scrollbar));
849
850-#ifdef USE_GTK3
851- /* On touch devices with XI2 and Gtk+ >= 3.3.18,
852- * the event enter-notify is not emitted.
853- * Deal with it in motion-notify. */
854-
855- /* Should be fixed with:
856- * https://bugs.launchpad.net/ubuntu/+source/gtk+3.0/+bug/949414 */
857- // if (!(priv->event & OS_EVENT_ENTER_NOTIFY))
858- // enter_event (scrollbar);
859-#endif
860-
861 if (priv->event & OS_EVENT_BUTTON_PRESS)
862 {
863 gint x, y;
864@@ -2513,14 +2314,6 @@
865 OsScrollbarPrivate *priv;
866 gdouble delta;
867
868-#ifdef USE_GTK3
869- /* Gtk+ 3.3.18 adds a smooth scroll support,
870- * but at the moment is not ready to be used without various issues.
871- * Don't use it for thumb scrolling in overlay scrollbar. */
872- if (event->direction == GDK_SCROLL_SMOOTH)
873- return FALSE;
874-#endif
875-
876 scrollbar = GTK_SCROLLBAR (user_data);
877 priv = get_private (GTK_WIDGET (scrollbar));
878
879@@ -2597,52 +2390,6 @@
880 const gint64 current_time = g_get_monotonic_time ();
881 const gint64 end_time = priv->present_time + TIMEOUT_PRESENT_WINDOW * 1000;
882
883-#ifdef USE_GTK3
884- /* If the widget is mapped, is not insentitive
885- * and the configure-event happens after
886- * the PropertyNotify _NET_ACTIVE_WINDOW event,
887- * see if the mouse pointer is over this window, if TRUE,
888- * proceed with bar_set_state_from_pointer (). */
889- if (!is_insensitive (scrollbar) &&
890- (current_time > end_time) &&
891- gtk_widget_get_mapped (GTK_WIDGET (scrollbar)))
892- {
893- if (!priv->active_window)
894- {
895- GdkWindow *parent;
896-
897- /* Loop through parent windows until it reaches
898- * either an unknown GdkWindow (NULL),
899- * or the toplevel window. */
900- parent = window_at_pointer (gtk_widget_get_window (GTK_WIDGET (scrollbar)), NULL, NULL);
901- while (parent != NULL)
902- {
903- if (event->window == parent)
904- break;
905-
906- parent = gdk_window_get_parent (parent);
907- }
908-
909- if (parent != NULL)
910- {
911- gint x, y;
912-
913- window_get_pointer (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x, &y, NULL);
914-
915- /* When the window is resized (maximize/restore),
916- * check the position of the pointer
917- * and set the state accordingly. */
918- bar_set_state_from_pointer (scrollbar, x, y);
919- }
920- }
921- else
922- {
923- priv->deactivable_bar = FALSE;
924- os_bar_set_active (priv->bar, TRUE, TRUE);
925- }
926- }
927-#endif
928-
929 if (current_time > end_time)
930 gtk_widget_hide (priv->thumb);
931
932@@ -2877,55 +2624,7 @@
933 is_touch_mode (GtkWidget *widget,
934 gint device_id)
935 {
936-#ifdef USE_GTK3
937- switch (scrollbar_mode)
938- {
939- case SCROLLBAR_MODE_OVERLAY_AUTO:
940- default:
941- /* Continue detecting source type. */
942- break;
943- case SCROLLBAR_MODE_OVERLAY_POINTER:
944- /* Touch mode always disabled. */
945- return FALSE;
946- break;
947- case SCROLLBAR_MODE_OVERLAY_TOUCH:
948- /* Touch mode always enabled. */
949- return TRUE;
950- break;
951- }
952-
953- /* Use some sort of cache for the device.
954- * Update the input source only if the device_id
955- * is different from the previous one. */
956- if (os_device_id != device_id)
957- {
958- GdkDeviceManager *device_manager;
959- GdkDevice *device;
960- GdkWindow *window;
961-
962- /* Update the static os_device_id variable. */
963- os_device_id = device_id;
964-
965- window = gtk_widget_get_window (widget);
966- device_manager = gdk_display_get_device_manager (gdk_window_get_display (window));
967- device = gdk_x11_device_manager_lookup (device_manager, os_device_id);
968-
969- /* Return FALSE if we don't recognize the device. */
970- if (!device)
971- return FALSE;
972-
973- /* Update the static os_input_source variable. */
974- os_input_source = gdk_device_get_source (device);
975- }
976-
977- /* Detect touch mode accordingly to the input source type. */
978- if (os_input_source == GDK_SOURCE_TOUCHSCREEN)
979- return TRUE;
980- else
981- return FALSE;
982-#else
983 return scrollbar_mode == SCROLLBAR_MODE_OVERLAY_TOUCH;
984-#endif
985 }
986
987 /* Callback that shows the thumb if it's the case. */
988@@ -3028,192 +2727,134 @@
989
990 sourceid = 0;
991
992-#ifdef USE_GTK3
993- if (xev->type == GenericEvent)
994- {
995- /* Deal with XInput 2 events. */
996- XIDeviceEvent *xiev;
997-
998- xiev = xev->xcookie.data;
999-
1000- sourceid = xiev->sourceid;
1001-
1002- if (xiev->evtype == XI_ButtonPress)
1003- os_xevent = OS_XEVENT_BUTTON_PRESS;
1004-
1005- if (xiev->evtype == XI_ButtonRelease)
1006- {
1007- os_xevent = OS_XEVENT_BUTTON_RELEASE;
1008- event_x = xiev->event_x;
1009- event_y = xiev->event_y;
1010- }
1011-
1012- if (xiev->evtype == XI_Leave)
1013- os_xevent = OS_XEVENT_LEAVE;
1014-
1015- if (xiev->evtype == XI_Motion)
1016- {
1017- os_xevent = OS_XEVENT_MOTION;
1018- event_x = xiev->event_x;
1019- event_y = xiev->event_y;
1020- }
1021- }
1022- else
1023- {
1024-#endif
1025- /* Deal with X core events, when apps (like rhythmbox),
1026- * are using gdk_disable_miltidevice (). */
1027- if (xev->type == ButtonPress)
1028- os_xevent = OS_XEVENT_BUTTON_PRESS;
1029-
1030- if (xev->type == ButtonRelease)
1031- {
1032- os_xevent = OS_XEVENT_BUTTON_RELEASE;
1033- event_x = xev->xbutton.x;
1034- event_y = xev->xbutton.y;
1035- }
1036-
1037- if (xev->type == LeaveNotify)
1038- os_xevent = OS_XEVENT_LEAVE;
1039-
1040- if (xev->type == MotionNotify)
1041- {
1042- os_xevent = OS_XEVENT_MOTION;
1043- event_x = xev->xmotion.x;
1044- event_y = xev->xmotion.y;
1045- }
1046-#ifdef USE_GTK3
1047- }
1048-#endif
1049-
1050- if (os_xevent == OS_XEVENT_BUTTON_PRESS)
1051- {
1052- priv->window_button_press = TRUE;
1053-
1054- if (priv->source_show_thumb_id != 0)
1055- {
1056- g_source_remove (priv->source_show_thumb_id);
1057- priv->source_show_thumb_id = 0;
1058- }
1059-
1060- gtk_widget_hide (priv->thumb);
1061- }
1062-
1063- if (priv->window_button_press && os_xevent == OS_XEVENT_BUTTON_RELEASE)
1064- {
1065- priv->window_button_press = FALSE;
1066-
1067- /* Proximity area. */
1068- if (check_proximity (scrollbar, event_x, event_y))
1069- {
1070- priv->hidable_thumb = FALSE;
1071-
1072- adjust_thumb_position (scrollbar, event_x, event_y);
1073-
1074- if (priv->state & OS_STATE_LOCKED)
1075- return GDK_FILTER_CONTINUE;
1076-
1077- if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned)
1078- show_thumb (scrollbar);
1079- }
1080- }
1081-
1082- if (os_xevent == OS_XEVENT_LEAVE)
1083- {
1084- priv->window_button_press = FALSE;
1085-
1086-#ifdef USE_GTK3
1087- /* Never deactivate the bar in an active window. */
1088- if (!priv->active_window)
1089- {
1090- priv->deactivable_bar = TRUE;
1091-
1092- if (priv->source_deactivate_bar_id != 0)
1093- g_source_remove (priv->source_deactivate_bar_id);
1094-
1095- priv->source_deactivate_bar_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1096- deactivate_bar_cb,
1097+ /* Deal with X core events, when apps (like rhythmbox),
1098+ * are using gdk_disable_miltidevice (). */
1099+ if (xev->type == ButtonPress)
1100+ os_xevent = OS_XEVENT_BUTTON_PRESS;
1101+
1102+ if (xev->type == ButtonRelease)
1103+ {
1104+ os_xevent = OS_XEVENT_BUTTON_RELEASE;
1105+ event_x = xev->xbutton.x;
1106+ event_y = xev->xbutton.y;
1107+ }
1108+
1109+ if (xev->type == LeaveNotify)
1110+ os_xevent = OS_XEVENT_LEAVE;
1111+
1112+ if (xev->type == MotionNotify)
1113+ {
1114+ os_xevent = OS_XEVENT_MOTION;
1115+ event_x = xev->xmotion.x;
1116+ event_y = xev->xmotion.y;
1117+ }
1118+
1119+ if (os_xevent == OS_XEVENT_BUTTON_PRESS)
1120+ {
1121+ priv->window_button_press = TRUE;
1122+
1123+ if (priv->source_show_thumb_id != 0)
1124+ {
1125+ g_source_remove (priv->source_show_thumb_id);
1126+ priv->source_show_thumb_id = 0;
1127+ }
1128+
1129+ gtk_widget_hide (priv->thumb);
1130+ }
1131+
1132+ if (priv->window_button_press && os_xevent == OS_XEVENT_BUTTON_RELEASE)
1133+ {
1134+ priv->window_button_press = FALSE;
1135+
1136+ /* Proximity area. */
1137+ if (check_proximity (scrollbar, event_x, event_y))
1138+ {
1139+ priv->hidable_thumb = FALSE;
1140+
1141+ adjust_thumb_position (scrollbar, event_x, event_y);
1142+
1143+ if (priv->state & OS_STATE_LOCKED)
1144+ return GDK_FILTER_CONTINUE;
1145+
1146+ if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned)
1147+ show_thumb (scrollbar);
1148+ }
1149+ }
1150+
1151+ if (os_xevent == OS_XEVENT_LEAVE)
1152+ {
1153+ priv->window_button_press = FALSE;
1154+
1155+ if (gtk_widget_get_mapped (priv->thumb) &&
1156+ !(priv->event & OS_EVENT_BUTTON_PRESS))
1157+ {
1158+ priv->hidable_thumb = TRUE;
1159+
1160+ if (priv->source_hide_thumb_id != 0)
1161+ g_source_remove (priv->source_hide_thumb_id);
1162+
1163+ priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1164+ hide_thumb_cb,
1165+ scrollbar);
1166+ }
1167+
1168+ if (priv->source_show_thumb_id != 0)
1169+ {
1170+ g_source_remove (priv->source_show_thumb_id);
1171+ priv->source_show_thumb_id = 0;
1172+ }
1173+
1174+ if (priv->source_unlock_thumb_id != 0)
1175+ g_source_remove (priv->source_unlock_thumb_id);
1176+
1177+ priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1178+ unlock_thumb_cb,
1179+ scrollbar);
1180+ }
1181+
1182+ /* Get the motion_notify_event trough XEvent. */
1183+ if (!priv->window_button_press && os_xevent == OS_XEVENT_MOTION)
1184+ {
1185+ /* Proximity area. */
1186+ if (check_proximity (scrollbar, event_x, event_y))
1187+ {
1188+ priv->hidable_thumb = FALSE;
1189+
1190+ if (priv->source_hide_thumb_id != 0)
1191+ {
1192+ g_source_remove (priv->source_hide_thumb_id);
1193+ priv->source_hide_thumb_id = 0;
1194+ }
1195+
1196+ adjust_thumb_position (scrollbar, event_x, event_y);
1197+
1198+ if (priv->state & OS_STATE_LOCKED)
1199+ return GDK_FILTER_CONTINUE;
1200+
1201+ if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned)
1202+ show_thumb (scrollbar);
1203+ }
1204+ else
1205+ {
1206+ priv->state &= ~(OS_STATE_LOCKED);
1207+
1208+ if (priv->source_show_thumb_id != 0)
1209+ {
1210+ g_source_remove (priv->source_show_thumb_id);
1211+ priv->source_show_thumb_id = 0;
1212+ }
1213+
1214+ if (gtk_widget_get_mapped (priv->thumb) &&
1215+ !(priv->event & OS_EVENT_BUTTON_PRESS))
1216+ {
1217+ priv->hidable_thumb = TRUE;
1218+
1219+ if (priv->source_hide_thumb_id == 0)
1220+ priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE,
1221+ hide_thumb_cb,
1222 scrollbar);
1223- }
1224-#endif
1225-
1226- if (gtk_widget_get_mapped (priv->thumb) &&
1227- !(priv->event & OS_EVENT_BUTTON_PRESS))
1228- {
1229- priv->hidable_thumb = TRUE;
1230-
1231- if (priv->source_hide_thumb_id != 0)
1232- g_source_remove (priv->source_hide_thumb_id);
1233-
1234- priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1235- hide_thumb_cb,
1236- scrollbar);
1237- }
1238-
1239- if (priv->source_show_thumb_id != 0)
1240- {
1241- g_source_remove (priv->source_show_thumb_id);
1242- priv->source_show_thumb_id = 0;
1243- }
1244-
1245- if (priv->source_unlock_thumb_id != 0)
1246- g_source_remove (priv->source_unlock_thumb_id);
1247-
1248- priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1249- unlock_thumb_cb,
1250- scrollbar);
1251- }
1252-
1253- /* Get the motion_notify_event trough XEvent. */
1254- if (!priv->window_button_press && os_xevent == OS_XEVENT_MOTION)
1255- {
1256-#ifdef USE_GTK3
1257- /* React to motion_notify_event
1258- * and set the state accordingly. */
1259- if (!is_insensitive (scrollbar) && !priv->active_window)
1260- bar_set_state_from_pointer (scrollbar, event_x, event_y);
1261-#endif
1262-
1263- /* Proximity area. */
1264- if (check_proximity (scrollbar, event_x, event_y))
1265- {
1266- priv->hidable_thumb = FALSE;
1267-
1268- if (priv->source_hide_thumb_id != 0)
1269- {
1270- g_source_remove (priv->source_hide_thumb_id);
1271- priv->source_hide_thumb_id = 0;
1272- }
1273-
1274- adjust_thumb_position (scrollbar, event_x, event_y);
1275-
1276- if (priv->state & OS_STATE_LOCKED)
1277- return GDK_FILTER_CONTINUE;
1278-
1279- if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned)
1280- show_thumb (scrollbar);
1281- }
1282- else
1283- {
1284- priv->state &= ~(OS_STATE_LOCKED);
1285-
1286- if (priv->source_show_thumb_id != 0)
1287- {
1288- g_source_remove (priv->source_show_thumb_id);
1289- priv->source_show_thumb_id = 0;
1290- }
1291-
1292- if (gtk_widget_get_mapped (priv->thumb) &&
1293- !(priv->event & OS_EVENT_BUTTON_PRESS))
1294- {
1295- priv->hidable_thumb = TRUE;
1296-
1297- if (priv->source_hide_thumb_id == 0)
1298- priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE,
1299- hide_thumb_cb,
1300- scrollbar);
1301- }
1302- }
1303+ }
1304+ }
1305 }
1306 }
1307
1308@@ -3261,11 +2902,7 @@
1309 static gboolean
1310 use_overlay_scrollbar (void)
1311 {
1312-#ifdef USE_GTK3
1313- return scrollbar_mode != SCROLLBAR_MODE_NORMAL;
1314-#else
1315 return scrollbar_mode != SCROLLBAR_MODE_NORMAL && ubuntu_gtk_get_use_overlay_scrollbar ();
1316-#endif
1317 }
1318
1319 static void
1320@@ -3345,17 +2982,6 @@
1321 (* pre_hijacked_scrollbar_dispose) (object);
1322 }
1323
1324-#ifdef USE_GTK3
1325-static gboolean
1326-hijacked_scrollbar_draw (GtkWidget *widget,
1327- cairo_t *cr)
1328-{
1329- if (use_overlay_scrollbar ())
1330- return TRUE;
1331-
1332- return (* pre_hijacked_scrollbar_draw) (widget, cr);
1333-}
1334-#else
1335 static gboolean
1336 hijacked_scrollbar_expose_event (GtkWidget *widget,
1337 GdkEventExpose *event)
1338@@ -3365,59 +2991,6 @@
1339
1340 return (* pre_hijacked_scrollbar_expose_event) (widget, event);
1341 }
1342-#endif
1343-
1344-#ifdef USE_GTK3
1345-static void
1346-hijacked_scrollbar_get_preferred_width (GtkWidget *widget,
1347- gint *minimal_width,
1348- gint *natural_width)
1349-{
1350- if (use_overlay_scrollbar ())
1351- {
1352- OsScrollbarPrivate *priv;
1353-
1354- priv = get_private (widget);
1355-
1356- if (priv->orientation == GTK_ORIENTATION_VERTICAL)
1357- *minimal_width = *natural_width = 0;
1358- else
1359- {
1360- *minimal_width = MIN_THUMB_HEIGHT;
1361- *natural_width = THUMB_HEIGHT;
1362- }
1363-
1364- return;
1365- }
1366-
1367- (* pre_hijacked_scrollbar_get_preferred_width) (widget, minimal_width, natural_width);
1368-}
1369-
1370-static void
1371-hijacked_scrollbar_get_preferred_height (GtkWidget *widget,
1372- gint *minimal_height,
1373- gint *natural_height)
1374-{
1375- if (use_overlay_scrollbar ())
1376- {
1377- OsScrollbarPrivate *priv;
1378-
1379- priv = get_private (widget);
1380-
1381- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
1382- *minimal_height = *natural_height = 0;
1383- else
1384- {
1385- *minimal_height = MIN_THUMB_HEIGHT;
1386- *natural_height = THUMB_HEIGHT;
1387- }
1388-
1389- return;
1390- }
1391-
1392- (* pre_hijacked_scrollbar_get_preferred_height) (widget, minimal_height, natural_height);
1393-}
1394-#endif
1395
1396 static void
1397 hijacked_scrollbar_grab_notify (GtkWidget *widget,
1398@@ -3442,15 +3015,6 @@
1399 (* pre_hijacked_scrollbar_hide) (widget);
1400 }
1401
1402-#ifdef USE_GTK3
1403-/* Return TRUE if the widget is in backdrop window. */
1404-static gboolean
1405-is_backdrop_window (GtkWidget *widget)
1406-{
1407- return (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_BACKDROP) != 0;
1408-}
1409-#endif
1410-
1411 static void
1412 hijacked_scrollbar_map (GtkWidget *widget)
1413 {
1414@@ -3464,46 +3028,6 @@
1415
1416 (* widget_class_map) (widget);
1417
1418-#ifdef USE_GTK3
1419- /* On map, check for the active window. */
1420- if (!is_backdrop_window (GTK_WIDGET (scrollbar)))
1421- {
1422- /* Stops potential running timeout. */
1423- if (priv->source_deactivate_bar_id != 0)
1424- {
1425- g_source_remove (priv->source_deactivate_bar_id);
1426- priv->source_deactivate_bar_id = 0;
1427- }
1428-
1429- priv->active_window = TRUE;
1430- }
1431- else
1432- priv->active_window = FALSE;
1433-
1434- if (!is_insensitive (scrollbar))
1435- {
1436- if (!priv->active_window)
1437- {
1438- gint x, y;
1439-
1440- window_get_pointer (gtk_widget_get_window (widget), &x, &y, NULL);
1441-
1442- /* When the scrollbar appears on screen (mapped),
1443- * for example when switching notebook page,
1444- * check the position of the pointer
1445- * and set the state accordingly. */
1446- bar_set_state_from_pointer (scrollbar, x, y);
1447- }
1448- else
1449- {
1450- /* On map-event of an active window,
1451- * the bar should be active. */
1452- priv->deactivable_bar = FALSE;
1453- os_bar_set_active (priv->bar, TRUE, FALSE);
1454- }
1455- }
1456-#endif
1457-
1458 if (!(priv->state & OS_STATE_FULLSIZE))
1459 os_bar_show (priv->bar);
1460
1461@@ -3810,10 +3334,6 @@
1462 priv->filter.proximity = FALSE;
1463 remove_window_filter (scrollbar);
1464
1465-#ifdef USE_GTK3
1466- os_bar_set_active (priv->bar, FALSE, FALSE);
1467-#endif
1468-
1469 gtk_widget_hide (priv->thumb);
1470 }
1471
1472@@ -3833,124 +3353,8 @@
1473 priv->filter.proximity = TRUE;
1474 add_window_filter (scrollbar);
1475 }
1476-
1477-#ifdef USE_GTK3
1478- if (priv->active_window)
1479- os_bar_set_active (priv->bar, TRUE, FALSE);
1480- else if (gtk_widget_get_realized (GTK_WIDGET (scrollbar)))
1481- {
1482- gint x, y;
1483-
1484- window_get_pointer (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x, &y, NULL);
1485-
1486- /* When the window is unfocused,
1487- * check the position of the pointer
1488- * and set the state accordingly. */
1489- bar_set_state_from_pointer (scrollbar, x, y);
1490- }
1491-#endif
1492-}
1493-
1494-#ifdef USE_GTK3
1495-/* React on active window changes. */
1496-static void
1497-backdrop_state_flag_changed (GtkScrollbar *scrollbar)
1498-{
1499- OsScrollbarPrivate *priv;
1500-
1501- priv = get_private (GTK_WIDGET (scrollbar));
1502-
1503- OS_DCHECK (scrollbar != NULL);
1504-
1505- /* Return if the scrollbar is insensitive. */
1506- if (is_insensitive (scrollbar))
1507- return;
1508-
1509- if (gtk_widget_get_mapped (GTK_WIDGET (scrollbar)))
1510- {
1511- if (!is_backdrop_window (GTK_WIDGET (scrollbar)))
1512- {
1513- /* Stops potential running timeout. */
1514- if (priv->source_deactivate_bar_id != 0)
1515- {
1516- g_source_remove (priv->source_deactivate_bar_id);
1517- priv->source_deactivate_bar_id = 0;
1518- }
1519-
1520- priv->active_window = TRUE;
1521-
1522- priv->deactivable_bar = FALSE;
1523- os_bar_set_active (priv->bar, TRUE, TRUE);
1524- }
1525- else if (priv->active_window)
1526- {
1527- GdkWindow *parent;
1528- GdkWindow *window;
1529- const gint64 current_time = g_get_monotonic_time ();
1530- const gint64 end_time = priv->present_time + TIMEOUT_PRESENT_WINDOW * 1000;
1531-
1532- priv->active_window = FALSE;
1533-
1534- /* Loop through parent windows until it reaches
1535- * either an unknown GdkWindow (NULL),
1536- * or the toplevel window. */
1537- window = gtk_widget_get_window (GTK_WIDGET (scrollbar));
1538- parent = window_at_pointer (window, NULL, NULL);
1539- while (parent != NULL)
1540- {
1541- if (window == parent)
1542- break;
1543-
1544- parent = gdk_window_get_parent (parent);
1545- }
1546-
1547- if (parent != NULL)
1548- {
1549- gint x, y;
1550-
1551- window_get_pointer (window, &x, &y, NULL);
1552-
1553- /* When the window is unfocused,
1554- * check the position of the pointer
1555- * and set the state accordingly. */
1556- bar_set_state_from_pointer (scrollbar, x, y);
1557- }
1558- else
1559- {
1560- /* If the pointer is outside of the window, set it inactive. */
1561- priv->deactivable_bar = TRUE;
1562- os_bar_set_active (priv->bar, FALSE, TRUE);
1563- }
1564-
1565- if ((current_time > end_time) && priv->thumb != NULL)
1566- gtk_widget_hide (priv->thumb);
1567- }
1568- }
1569-}
1570-
1571-static void
1572-hijacked_scrollbar_state_flags_changed (GtkWidget *widget,
1573- GtkStateFlags flags)
1574-{
1575- GtkScrollbar *scrollbar;
1576-
1577- scrollbar = GTK_SCROLLBAR (widget);
1578-
1579- if ((flags & GTK_STATE_FLAG_BACKDROP) !=
1580- (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_BACKDROP))
1581- backdrop_state_flag_changed (scrollbar);
1582-
1583- /* Only set the new state if the right bit changed. */
1584- if ((flags & GTK_STATE_FLAG_INSENSITIVE) !=
1585- (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE))
1586- {
1587- if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE) != 0)
1588- set_insensitive (scrollbar);
1589- else
1590- set_sensitive (scrollbar);
1591- }
1592-}
1593-#else
1594+}
1595+
1596 static void
1597 hijacked_scrollbar_size_request (GtkWidget *widget,
1598 GtkRequisition *requisition)
1599@@ -3994,7 +3398,6 @@
1600
1601 (* pre_hijacked_scrollbar_state_changed) (widget, state);
1602 }
1603-#endif
1604
1605 static void
1606 hijacked_scrollbar_unmap (GtkWidget *widget)
1607@@ -4151,23 +3554,12 @@
1608 if (object_class->dispose == pre_hijacked_scrollbar_dispose)
1609 object_class->dispose = hijacked_scrollbar_dispose;
1610
1611-#ifdef USE_GTK3
1612- if (widget_class->draw == pre_hijacked_scrollbar_draw)
1613- widget_class->draw = hijacked_scrollbar_draw;
1614- if (widget_class->get_preferred_width == pre_hijacked_scrollbar_get_preferred_width)
1615- widget_class->get_preferred_width = hijacked_scrollbar_get_preferred_width;
1616- if (widget_class->get_preferred_height == pre_hijacked_scrollbar_get_preferred_height)
1617- widget_class->get_preferred_height = hijacked_scrollbar_get_preferred_height;
1618- if (widget_class->state_flags_changed == pre_hijacked_scrollbar_state_flags_changed)
1619- widget_class->state_flags_changed = hijacked_scrollbar_state_flags_changed;
1620-#else
1621 if (widget_class->expose_event == pre_hijacked_scrollbar_expose_event)
1622 widget_class->expose_event = hijacked_scrollbar_expose_event;
1623 if (widget_class->size_request == pre_hijacked_scrollbar_size_request)
1624 widget_class->size_request = hijacked_scrollbar_size_request;
1625 if (widget_class->state_changed == pre_hijacked_scrollbar_state_changed)
1626 widget_class->state_changed = hijacked_scrollbar_state_changed;
1627-#endif
1628 if (pre_hijacked_scrollbar_grab_notify &&
1629 widget_class->grab_notify == pre_hijacked_scrollbar_grab_notify)
1630 widget_class->grab_notify = hijacked_scrollbar_grab_notify;
1631@@ -4197,29 +3589,13 @@
1632 static void
1633 custom_style_load (void)
1634 {
1635-#ifdef USE_GTK3
1636- gtk_style_context_add_provider_for_screen (gdk_display_get_default_screen (gdk_display_get_default ()),
1637- GTK_STYLE_PROVIDER (provider),
1638- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
1639-#else
1640 gtk_rc_parse_string ("style \"overlay-scrollbar\" {\n"
1641 " GtkScrolledWindow::scrollbar-spacing = 0\n"
1642 " GtkScrolledWindow::scrollbars-within-bevel = 1\n"
1643 " }\n"
1644 "\n"
1645 "class \"GtkScrolledWindow\" style \"overlay-scrollbar\"");
1646-#endif
1647-}
1648-
1649-#ifdef USE_GTK3
1650-/* Unload custom style for overlay scrollbar. */
1651-static void
1652-custom_style_unload (void)
1653-{
1654- gtk_style_context_remove_provider_for_screen (gdk_display_get_default_screen (gdk_display_get_default ()),
1655- GTK_STYLE_PROVIDER (provider));
1656-}
1657-#endif
1658+}
1659
1660 /* Unload all scrollbars. */
1661 static void
1662@@ -4287,17 +3663,9 @@
1663 /* Update the scrollbar_mode variable. */
1664 scrollbar_mode = g_settings_get_enum (settings, "scrollbar-mode");
1665
1666-#ifdef USE_GTK3
1667- /* Load or unload custom style for overlay scrollbar. */
1668- if (use_overlay_scrollbar ())
1669- custom_style_load ();
1670- else
1671- custom_style_unload ();
1672-#else
1673 /* Gtk+ 2.0 doesn't support dynamic loading of styles.
1674 * Please contact me in case I'm wrong,
1675 * and I'll add the required bits here. */
1676-#endif
1677
1678 /* Load all scrollbars, using new scrollbar_mode. */
1679 g_slist_foreach (tmp_list, scrollbar_mode_changed_load_gfunc, NULL);
1680@@ -4323,12 +3691,6 @@
1681 if (app_is_blacklisted ())
1682 return;
1683
1684- /* We only support X11 */
1685-#if GTK_MAJOR_VERSION == 3
1686- if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
1687- return;
1688-#endif
1689-
1690 /* Initialize static variables. */
1691 net_active_window_atom = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW");
1692 unity_net_workarea_region_atom = gdk_x11_get_xatom_by_name ("_UNITY_NET_WORKAREA_REGION");
1693@@ -4341,16 +3703,9 @@
1694
1695 pre_hijacked_scrollbar_dispose = object_class->dispose;
1696
1697-#ifdef USE_GTK3
1698- pre_hijacked_scrollbar_draw = widget_class->draw;
1699- pre_hijacked_scrollbar_get_preferred_width = widget_class->get_preferred_width;
1700- pre_hijacked_scrollbar_get_preferred_height = widget_class->get_preferred_height;
1701- pre_hijacked_scrollbar_state_flags_changed = widget_class->state_flags_changed;
1702-#else
1703 pre_hijacked_scrollbar_expose_event = widget_class->expose_event;
1704 pre_hijacked_scrollbar_size_request = widget_class->size_request;
1705 pre_hijacked_scrollbar_state_changed = widget_class->state_changed;
1706-#endif
1707 pre_hijacked_scrollbar_grab_notify = widget_class->grab_notify;
1708 pre_hijacked_scrollbar_hide = widget_class->hide;
1709 pre_hijacked_scrollbar_map = widget_class->map;
1710@@ -4379,19 +3734,7 @@
1711 G_CALLBACK (scrollbar_mode_changed_cb), NULL);
1712 scrollbar_mode = g_settings_get_enum (settings, "scrollbar-mode");
1713
1714-#ifdef USE_GTK3
1715- /* Initialize styling bits. */
1716- provider = gtk_css_provider_new ();
1717- gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
1718- "* {\n"
1719- " -GtkScrolledWindow-scrollbar-spacing: 0;\n"
1720- " -GtkScrolledWindow-scrollbars-within-bevel: 1;\n"
1721- "}\n", -1, NULL);
1722-#endif
1723-
1724-#ifndef USE_GTK3
1725 ubuntu_gtk_set_use_overlay_scrollbar (TRUE);
1726-#endif
1727
1728 /* Load custom overlay scrollbar style. */
1729 if (use_overlay_scrollbar ())
1730
1731=== modified file 'os/os-thumb.c'
1732--- os/os-thumb.c 2013-02-02 00:46:51 +0000
1733+++ os/os-thumb.c 2015-06-04 09:25:27 +0000
1734@@ -40,14 +40,12 @@
1735 /* Number of tolerance pixels, before hiding the thumb. */
1736 #define TOLERANCE_FADE 3
1737
1738-#ifndef USE_GTK3
1739 typedef struct {
1740 gdouble red;
1741 gdouble green;
1742 gdouble blue;
1743 gdouble alpha;
1744 } GdkRGBA;
1745-#endif
1746
1747 struct _OsThumbPrivate {
1748 GtkOrientation orientation;
1749@@ -71,11 +69,7 @@
1750 static gboolean os_thumb_button_press_event (GtkWidget *widget, GdkEventButton *event);
1751 static gboolean os_thumb_button_release_event (GtkWidget *widget, GdkEventButton *event);
1752 static void os_thumb_composited_changed (GtkWidget *widget);
1753-#ifdef USE_GTK3
1754-static gboolean os_thumb_draw (GtkWidget *widget, cairo_t *cr);
1755-#else
1756 static gboolean os_thumb_expose (GtkWidget *widget, GdkEventExpose *event);
1757-#endif
1758 static gboolean os_thumb_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event);
1759 static gboolean os_thumb_motion_notify_event (GtkWidget *widget, GdkEventMotion *event);
1760 static void os_thumb_map (GtkWidget *widget);
1761@@ -145,11 +139,7 @@
1762 widget_class->button_press_event = os_thumb_button_press_event;
1763 widget_class->button_release_event = os_thumb_button_release_event;
1764 widget_class->composited_changed = os_thumb_composited_changed;
1765-#ifdef USE_GTK3
1766- widget_class->draw = os_thumb_draw;
1767-#else
1768 widget_class->expose_event = os_thumb_expose;
1769-#endif
1770 widget_class->leave_notify_event = os_thumb_leave_notify_event;
1771 widget_class->map = os_thumb_map;
1772 widget_class->motion_notify_event = os_thumb_motion_notify_event;
1773@@ -602,7 +592,6 @@
1774 b->alpha = a->alpha;
1775 }
1776
1777-#ifndef USE_GTK3
1778 /* Convert a GdkColor to GdkRGBA. */
1779 static void
1780 convert_gdk_color_to_gdk_rgba (GdkColor *color,
1781@@ -614,7 +603,6 @@
1782
1783 rgba->alpha = 1.0;
1784 }
1785-#endif
1786
1787 enum {
1788 ACTION_NORMAL,
1789@@ -624,19 +612,12 @@
1790 };
1791
1792 static gboolean
1793-#ifdef USE_GTK3
1794-os_thumb_draw (GtkWidget *widget,
1795- cairo_t *cr)
1796-{
1797- GtkStyleContext *style_context;
1798-#else
1799 os_thumb_expose (GtkWidget *widget,
1800 GdkEventExpose *event)
1801 {
1802 GtkAllocation allocation;
1803 cairo_t *cr;
1804 GtkStyle *style;
1805-#endif
1806 GdkRGBA bg, bg_active, bg_selected;
1807 GdkRGBA bg_arrow_up, bg_arrow_down;
1808 GdkRGBA bg_shadow, bg_dark_line, bg_bright_line;
1809@@ -653,17 +634,6 @@
1810
1811 radius = priv->rgba ? THUMB_RADIUS : 0;
1812
1813-#ifdef USE_GTK3
1814- width = gtk_widget_get_allocated_width (widget);
1815- height = gtk_widget_get_allocated_height (widget);
1816-
1817- style_context = gtk_widget_get_style_context (widget);
1818-
1819- gtk_style_context_get_background_color (style_context, gtk_widget_get_state_flags (widget), &bg);
1820- gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_ACTIVE, &bg_active);
1821- gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_SELECTED, &bg_selected);
1822- gtk_style_context_get_color (style_context, gtk_widget_get_state_flags (widget), &arrow_color);
1823-#else
1824 gtk_widget_get_allocation (widget, &allocation);
1825
1826 width = allocation.width;
1827@@ -677,7 +647,6 @@
1828 convert_gdk_color_to_gdk_rgba (&style->fg[gtk_widget_get_state (widget)], &arrow_color);
1829
1830 cr = gdk_cairo_create (gtk_widget_get_window (widget));
1831-#endif
1832
1833 cairo_save (cr);
1834
1835@@ -912,12 +881,8 @@
1836 }
1837
1838 cairo_restore (cr);
1839-
1840 cairo_restore (cr);
1841-
1842-#ifndef USE_GTK3
1843 cairo_destroy (cr);
1844-#endif
1845
1846 return FALSE;
1847 }
1848@@ -1037,16 +1002,6 @@
1849 os_thumb_screen_changed (GtkWidget *widget,
1850 GdkScreen *old_screen)
1851 {
1852-#ifdef USE_GTK3
1853- GdkScreen *screen;
1854- GdkVisual *visual;
1855-
1856- screen = gtk_widget_get_screen (widget);
1857- visual = gdk_screen_get_rgba_visual (screen);
1858-
1859- if (visual)
1860- gtk_widget_set_visual (widget, visual);
1861-#else
1862 GdkScreen *screen;
1863 GdkColormap *colormap;
1864
1865@@ -1055,7 +1010,6 @@
1866
1867 if (colormap)
1868 gtk_widget_set_colormap (widget, colormap);
1869-#endif
1870 }
1871
1872 static gboolean
1873
1874=== modified file 'tests/Makefile.am'
1875--- tests/Makefile.am 2012-04-26 14:02:33 +0000
1876+++ tests/Makefile.am 2015-06-04 09:25:27 +0000
1877@@ -1,16 +1,8 @@
1878-if USE_GTK3
1879-VER=3
1880-else
1881 VER=
1882-endif
1883
1884 noinst_PROGRAMS = \
1885 test-os
1886
1887-if USE_GTK3
1888-test_os_CFLAGS = -I$(top_srcdir) $(OS_CFLAGS) -DUSE_GTK3
1889-else
1890 test_os_CFLAGS = -I$(top_srcdir) $(OS_CFLAGS)
1891-endif
1892
1893 test_os_LDFLAGS = $(OS_LIBADD)
1894
1895=== modified file 'tests/test-os.c'
1896--- tests/test-os.c 2012-11-26 14:35:24 +0000
1897+++ tests/test-os.c 2015-06-04 09:25:27 +0000
1898@@ -250,18 +250,10 @@
1899 gtk_window_set_title (GTK_WINDOW (window), "Vertical \"Overlay Scrollbar\" test");
1900
1901 /* vbox */
1902-#ifdef USE_GTK3
1903- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
1904-#else
1905 vbox = gtk_vbox_new (TRUE, 2);
1906-#endif
1907
1908 /* hbox */
1909-#ifdef USE_GTK3
1910- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
1911-#else
1912 hbox = gtk_hbox_new (TRUE, 2);
1913-#endif
1914
1915 /* scrolled_window_text0 */
1916 scrolled_window_text0 = gtk_scrolled_window_new (NULL, NULL);

Subscribers

People subscribed via source and target branches