Merge lp:~laney/overlay-scrollbar/drop-gtk3 into lp:overlay-scrollbar
- drop-gtk3
- Merge into trunk
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 |
Related bugs: |
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-
Description of the change
We are going to use gtk 3.16's overlay scrollbars. Drop overlay-
PS Jenkins bot (ps-jenkins) wrote : | # |
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
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:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Lars Karlitski (larsu) wrote : | # |
Looks good to me now.
Thanks! This is awesome.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:404
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:405
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
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 | 37 | GLIB_GSETTINGS | 37 | GLIB_GSETTINGS |
8 | 38 | 38 | ||
9 | 39 | AC_SUBST(glib_req, 2.26.0) | 39 | AC_SUBST(glib_req, 2.26.0) |
12 | 40 | AC_SUBST(gtk_req, 2.22.0) | 40 | AC_SUBST(gtk_req, 2.24.26) |
11 | 41 | AC_SUBST(gtk3_req, 3.4.0) | ||
13 | 42 | AC_SUBST(cairo_req, 1.10) | 41 | AC_SUBST(cairo_req, 1.10) |
14 | 43 | 42 | ||
30 | 44 | AC_ARG_WITH([gtk], | 43 | PKG_CHECK_MODULES(DEPS, [glib-2.0 >= $glib_req gtk+-2.0 >= $gtk_req cairo >= $cairo_req gmodule-2.0 >= $glib_req x11], |
31 | 45 | [AS_HELP_STRING([--with-gtk], [Which version of gtk to use @<:@default=3@:>@])], | 44 | [AC_SUBST(DEPS_CFLAGS) |
32 | 46 | [], | 45 | AC_SUBST(DEPS_LIBS)]) |
18 | 47 | [with_gtk=3]) | ||
19 | 48 | AS_IF([test "x$with_gtk" = x3], | ||
20 | 49 | [PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-3.0 >= $gtk3_req cairo >= $cairo_req) | ||
21 | 50 | AC_SUBST(DEPS_CFLAGS) | ||
22 | 51 | AC_SUBST(DEPS_LIBS)], | ||
23 | 52 | [test "x$with_gtk" = x2], | ||
24 | 53 | [PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-2.0 >= $gtk_req cairo >= $cairo_req) | ||
25 | 54 | AC_SUBST(DEPS_CFLAGS) | ||
26 | 55 | AC_SUBST(DEPS_LIBS)], | ||
27 | 56 | [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])] | ||
28 | 57 | ) | ||
29 | 58 | AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3]) | ||
33 | 59 | 46 | ||
35 | 60 | GTK_MODULES_DIR="${libdir}/gtk-"$with_gtk".0/modules" | 47 | GTK_MODULES_DIR="${libdir}/gtk-2.0/modules" |
36 | 61 | AC_SUBST(GTK_MODULES_DIR) | 48 | AC_SUBST(GTK_MODULES_DIR) |
37 | 62 | 49 | ||
38 | 63 | # Check if build tests | 50 | # Check if build tests |
39 | @@ -146,7 +133,6 @@ | |||
40 | 146 | echo " overlay-scrollbar $PACKAGE_VERSION" | 133 | echo " overlay-scrollbar $PACKAGE_VERSION" |
41 | 147 | echo " =======================" | 134 | echo " =======================" |
42 | 148 | echo "" | 135 | echo "" |
43 | 149 | echo " Gtk+: ${with_gtk}" | ||
44 | 150 | echo " Tests: ${enable_tests}" | 136 | echo " Tests: ${enable_tests}" |
45 | 151 | echo " Debug: ${enable_debug}" | 137 | echo " Debug: ${enable_debug}" |
46 | 152 | echo " Prefix: ${prefix}" | 138 | echo " Prefix: ${prefix}" |
47 | 153 | 139 | ||
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 | 1 | # This file is sourced by Xsession(5), not executed. | 1 | # This file is sourced by Xsession(5), not executed. |
53 | 2 | 2 | ||
56 | 3 | if [ -z "$GTK_MODULES" ] ; then | 3 | if [ -z "$GTK2_MODULES" ] ; then |
57 | 4 | GTK_MODULES="overlay-scrollbar" | 4 | GTK2_MODULES="overlay-scrollbar" |
58 | 5 | else | 5 | else |
60 | 6 | GTK_MODULES="$GTK_MODULES:overlay-scrollbar" | 6 | GTK2_MODULES="$GTK2_MODULES:overlay-scrollbar" |
61 | 7 | fi | 7 | fi |
62 | 8 | 8 | ||
64 | 9 | export GTK_MODULES | 9 | export GTK2_MODULES |
65 | 10 | 10 | ||
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 | 1 | overlay-scrollbar (0.2.17.1+15.10.20150604-0ubuntu1) UNRELEASED; urgency=medium | ||
71 | 2 | |||
72 | 3 | * Drop overlay-scrollbar-gtk3 - this is no longer needed with GTK 3.16. | ||
73 | 4 | Force it to be removed, since loading it with GTK 3.16 causes visual | ||
74 | 5 | problems. | ||
75 | 6 | * Bump Standards-Verison to 3.9.6 | ||
76 | 7 | |||
77 | 8 | -- Iain Lane <iain.lane@canonical.com> Wed, 03 Jun 2015 12:52:13 +0100 | ||
78 | 9 | |||
79 | 1 | overlay-scrollbar (0.2.16+r359+15.04.20150319-0ubuntu1) vivid; urgency=medium | 10 | overlay-scrollbar (0.2.16+r359+15.04.20150319-0ubuntu1) vivid; urgency=medium |
80 | 2 | 11 | ||
81 | 3 | [ Lars Uebernickel ] | 12 | [ Lars Uebernickel ] |
82 | 4 | 13 | ||
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 | 6 | dh-autoreconf, | 6 | dh-autoreconf, |
88 | 7 | libcairo2-dev (>= 1.10), | 7 | libcairo2-dev (>= 1.10), |
89 | 8 | libglib2.0-dev (>= 2.26.0), | 8 | libglib2.0-dev (>= 2.26.0), |
93 | 9 | libgtk-3-dev, | 9 | libgtk2.0-dev (>= 2.24.26), |
94 | 10 | libgtk2.0-dev, | 10 | Standards-Version: 3.9.6 |
92 | 11 | Standards-Version: 3.9.3 | ||
95 | 12 | Section: libs | 11 | Section: libs |
96 | 13 | Homepage: http://launchpad.net/ayatana-scrollbar | 12 | Homepage: http://launchpad.net/ayatana-scrollbar |
97 | 14 | # If you aren't a member of ~ayatana-scrollbar-team but need to upload | 13 | # If you aren't a member of ~ayatana-scrollbar-team but need to upload |
98 | @@ -17,26 +16,11 @@ | |||
99 | 17 | Vcs-Bzr: https://code.launchpad.net/~ayatana-scrollbar-team/overlay-scrollbar/trunk | 16 | Vcs-Bzr: https://code.launchpad.net/~ayatana-scrollbar-team/overlay-scrollbar/trunk |
100 | 18 | Vcs-Browser: https://bazaar.launchpad.net/~ayatana-scrollbar-team/overlay-scrollbar/trunk/files | 17 | Vcs-Browser: https://bazaar.launchpad.net/~ayatana-scrollbar-team/overlay-scrollbar/trunk/files |
101 | 19 | 18 | ||
102 | 20 | Package: overlay-scrollbar-gtk3 | ||
103 | 21 | Section: libs | ||
104 | 22 | Architecture: any | ||
105 | 23 | Multi-Arch: same | ||
106 | 24 | Depends: overlay-scrollbar, | ||
107 | 25 | ${misc:Depends}, | ||
108 | 26 | ${shlibs:Depends}, | ||
109 | 27 | Replaces: liboverlay-scrollbar3-0.2-0 (<< 0.2.16+r348), | ||
110 | 28 | liboverlay-scrollbar3-0.2-dev (<< 0.2.16+r348), | ||
111 | 29 | Conflicts: liboverlay-scrollbar3-0.2-0 (<< 0.2.16+r348), | ||
112 | 30 | liboverlay-scrollbar3-0.2-dev (<< 0.2.16+r348), | ||
113 | 31 | Description: GTK 3 module for overlay scrollbars | ||
114 | 32 | Overlay scrollbar is a GtkModule enabling a dynamic overlay behavior. | ||
115 | 33 | |||
116 | 34 | Package: overlay-scrollbar-gtk2 | 19 | Package: overlay-scrollbar-gtk2 |
117 | 35 | Section: libs | 20 | Section: libs |
118 | 36 | Architecture: any | 21 | Architecture: any |
119 | 37 | Multi-Arch: same | 22 | Multi-Arch: same |
122 | 38 | Depends: overlay-scrollbar, | 23 | Depends: ${misc:Depends}, |
121 | 39 | ${misc:Depends}, | ||
123 | 40 | ${shlibs:Depends}, | 24 | ${shlibs:Depends}, |
124 | 41 | Replaces: liboverlay-scrollbar-0.2-0 (<< 0.2.16+r348), | 25 | Replaces: liboverlay-scrollbar-0.2-0 (<< 0.2.16+r348), |
125 | 42 | liboverlay-scrollbar-0.2-dev (<< 0.2.16+r348), | 26 | liboverlay-scrollbar-0.2-dev (<< 0.2.16+r348), |
126 | @@ -49,7 +33,8 @@ | |||
127 | 49 | Section: libs | 33 | Section: libs |
128 | 50 | Architecture: all | 34 | Architecture: all |
129 | 51 | Depends: overlay-scrollbar-gtk2, | 35 | Depends: overlay-scrollbar-gtk2, |
130 | 52 | overlay-scrollbar-gtk3, | ||
131 | 53 | ${misc:Depends}, | 36 | ${misc:Depends}, |
132 | 37 | Conflicts: overlay-scrollbar-gtk3 | ||
133 | 38 | Replaces: overlay-scrollbar-gtk3 | ||
134 | 54 | Description: Scrollbar overlay | 39 | Description: Scrollbar overlay |
135 | 55 | Overlay scrollbar is a GtkModule enabling a dynamic overlay behavior. | 40 | Overlay scrollbar is a GtkModule enabling a dynamic overlay behavior. |
136 | 56 | 41 | ||
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 @@ | |||
142 | 1 | debian/tmp/gtk2/usr/lib/* /usr/lib/ | 1 | usr/lib |
143 | 2 | 2 | ||
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 | 1 | debian/tmp/gtk3/usr/lib/* /usr/lib/ | ||
149 | 2 | 0 | ||
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 @@ | |||
156 | 1 | debian/tmp/gtk3/etc/X11 /etc/ | 1 | etc |
157 | 2 | debian/tmp/gtk3/usr/share/glib-2.0 /usr/share/ | 2 | usr/share |
158 | 3 | 3 | ||
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 | 1 | #!/usr/bin/make -f | 1 | #!/usr/bin/make -f |
164 | 2 | 2 | ||
170 | 3 | FLAVORS = gtk2 gtk3 | 3 | CONFIGURE_COMMON_FLAGS = --disable-static \ |
171 | 4 | 4 | --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ | |
172 | 5 | CONFIGURE_FLAGS_gtk2 = --with-gtk=2 | 5 | --disable-silent-rules |
168 | 6 | CONFIGURE_FLAGS_gtk3 = --with-gtk=3 | ||
169 | 7 | CONFIGURE_COMMON_FLAGS = --disable-static --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) | ||
173 | 8 | 6 | ||
174 | 9 | export DPKG_GENSYMBOLS_CHECK_LEVEL = 4 | 7 | export DPKG_GENSYMBOLS_CHECK_LEVEL = 4 |
175 | 10 | 8 | ||
176 | @@ -14,26 +12,11 @@ | |||
177 | 14 | override_dh_autoreconf: | 12 | override_dh_autoreconf: |
178 | 15 | NOCONFIGURE=1 dh_autoreconf ./autogen.sh | 13 | NOCONFIGURE=1 dh_autoreconf ./autogen.sh |
179 | 16 | 14 | ||
196 | 17 | override_dh_auto_configure: $(FLAVORS:%=doconfigure-%) | 15 | override_dh_auto_configure: |
197 | 18 | 16 | dh_auto_configure -- $(CONFIGURE_COMMON_FLAGS) | |
182 | 19 | doconfigure-%: | ||
183 | 20 | dh_auto_configure --builddirectory=build/$* -- \ | ||
184 | 21 | $(CONFIGURE_FLAGS_$*) \ | ||
185 | 22 | $(CONFIGURE_COMMON_FLAGS) | ||
186 | 23 | |||
187 | 24 | override_dh_auto_build: $(FLAVORS:%=dobuild-%) | ||
188 | 25 | |||
189 | 26 | dobuild-%: | ||
190 | 27 | dh_auto_build --builddirectory=build/$* | ||
191 | 28 | |||
192 | 29 | override_dh_auto_install: $(FLAVORS:%=doinstall-%) | ||
193 | 30 | |||
194 | 31 | doinstall-%: | ||
195 | 32 | dh_auto_install --sourcedir=build/$* --destdir=debian/tmp/$* | ||
198 | 33 | 17 | ||
199 | 34 | override_dh_install: | 18 | override_dh_install: |
200 | 35 | find debian/tmp -name \*.la -delete | ||
201 | 36 | rm -rf debian/tmp/gtk2/usr/share/glib-2.0/schemas | ||
202 | 37 | rm -f debian/tmp/gtk2/etc/X11/Xsession.d/81overlay-scrollbar | ||
203 | 38 | dh_install --fail-missing | 19 | dh_install --fail-missing |
204 | 20 | find debian/overlay-scrollbar-gtk2 -name \*.la -delete | ||
205 | 39 | 21 | ||
206 | 22 | override_dh_makeshlibs: | ||
207 | 40 | 23 | ||
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 | 1 | if USE_GTK3 | ||
213 | 2 | VER=3 | ||
214 | 3 | else | ||
215 | 4 | VER= | 1 | VER= |
216 | 5 | endif | ||
217 | 6 | 2 | ||
218 | 7 | source_h = \ | 3 | source_h = \ |
219 | 8 | $(srcdir)/os-private.h \ | 4 | $(srcdir)/os-private.h \ |
220 | @@ -21,12 +17,8 @@ | |||
221 | 21 | 17 | ||
222 | 22 | liboverlay_scrollbar_la_SOURCES = $(source_h) $(source_c) | 18 | liboverlay_scrollbar_la_SOURCES = $(source_h) $(source_c) |
223 | 23 | 19 | ||
224 | 24 | if USE_GTK3 | ||
225 | 25 | liboverlay_scrollbar_la_CFLAGS = $(OS_CFLAGS) -DUSE_GTK3 | ||
226 | 26 | else | ||
227 | 27 | liboverlay_scrollbar_la_CFLAGS = $(OS_CFLAGS) | 20 | liboverlay_scrollbar_la_CFLAGS = $(OS_CFLAGS) |
228 | 28 | endif | ||
229 | 29 | 21 | ||
231 | 30 | liboverlay_scrollbar_la_LIBADD = $(OS_LIBADD) | 22 | liboverlay_scrollbar_la_LIBADD = $(OS_LIBADD) -lm |
232 | 31 | 23 | ||
233 | 32 | liboverlay_scrollbar_la_LDFLAGS = $(OS_LDFLAGS) | 24 | liboverlay_scrollbar_la_LDFLAGS = $(OS_LDFLAGS) |
234 | 33 | 25 | ||
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 | 62 | static void | 62 | static void |
240 | 63 | draw_bar (OsBar *bar) | 63 | draw_bar (OsBar *bar) |
241 | 64 | { | 64 | { |
242 | 65 | #ifdef USE_GTK3 | ||
243 | 66 | GdkRGBA c1, c2, color; | ||
244 | 67 | GtkStyleContext *style_context; | ||
245 | 68 | #else | ||
246 | 69 | GdkColor color; | 65 | GdkColor color; |
247 | 70 | GtkStyle *style; | 66 | GtkStyle *style; |
248 | 71 | #endif | ||
249 | 72 | OsBarPrivate *priv; | 67 | OsBarPrivate *priv; |
250 | 73 | gfloat weight; | 68 | gfloat weight; |
251 | 74 | 69 | ||
252 | @@ -76,27 +71,6 @@ | |||
253 | 76 | 71 | ||
254 | 77 | weight = priv->weight; | 72 | weight = priv->weight; |
255 | 78 | 73 | ||
256 | 79 | #ifdef USE_GTK3 | ||
257 | 80 | style_context = gtk_widget_get_style_context (priv->parent); | ||
258 | 81 | |||
259 | 82 | if (priv->active == FALSE) | ||
260 | 83 | { | ||
261 | 84 | gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_INSENSITIVE, &c1); | ||
262 | 85 | gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_SELECTED, &c2); | ||
263 | 86 | } | ||
264 | 87 | else | ||
265 | 88 | { | ||
266 | 89 | gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_SELECTED, &c1); | ||
267 | 90 | gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_INSENSITIVE, &c2); | ||
268 | 91 | } | ||
269 | 92 | |||
270 | 93 | color.red = weight * c1.red + (1.0 - weight) * c2.red; | ||
271 | 94 | color.green = weight * c1.green + (1.0 - weight) * c2.green; | ||
272 | 95 | color.blue = weight * c1.blue + (1.0 - weight) * c2.blue; | ||
273 | 96 | color.alpha = 1.0; | ||
274 | 97 | |||
275 | 98 | gdk_window_set_background_rgba (priv->bar_window, &color); | ||
276 | 99 | #else | ||
277 | 100 | style = gtk_widget_get_style (priv->parent); | 74 | style = gtk_widget_get_style (priv->parent); |
278 | 101 | 75 | ||
279 | 102 | color = style->bg[GTK_STATE_SELECTED]; | 76 | color = style->bg[GTK_STATE_SELECTED]; |
280 | @@ -104,7 +78,6 @@ | |||
281 | 104 | gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->bar_window), &color, FALSE, TRUE); | 78 | gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->bar_window), &color, FALSE, TRUE); |
282 | 105 | 79 | ||
283 | 106 | gdk_window_set_background (priv->bar_window, &color); | 80 | gdk_window_set_background (priv->bar_window, &color); |
284 | 107 | #endif | ||
285 | 108 | 81 | ||
286 | 109 | gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE); | 82 | gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE); |
287 | 110 | } | 83 | } |
288 | @@ -113,26 +86,12 @@ | |||
289 | 113 | static void | 86 | static void |
290 | 114 | draw_tail (OsBar *bar) | 87 | draw_tail (OsBar *bar) |
291 | 115 | { | 88 | { |
292 | 116 | #ifdef USE_GTK3 | ||
293 | 117 | GdkRGBA color; | ||
294 | 118 | GtkStyleContext *style_context; | ||
295 | 119 | #else | ||
296 | 120 | GdkColor color; | 89 | GdkColor color; |
297 | 121 | GtkStyle *style; | 90 | GtkStyle *style; |
298 | 122 | #endif | ||
299 | 123 | OsBarPrivate *priv; | 91 | OsBarPrivate *priv; |
300 | 124 | 92 | ||
301 | 125 | priv = bar->priv; | 93 | priv = bar->priv; |
302 | 126 | 94 | ||
303 | 127 | #ifdef USE_GTK3 | ||
304 | 128 | style_context = gtk_widget_get_style_context (priv->parent); | ||
305 | 129 | |||
306 | 130 | gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_ACTIVE, &color); | ||
307 | 131 | |||
308 | 132 | color.alpha = 1.0; | ||
309 | 133 | |||
310 | 134 | gdk_window_set_background_rgba (priv->tail_window, &color); | ||
311 | 135 | #else | ||
312 | 136 | style = gtk_widget_get_style (priv->parent); | 95 | style = gtk_widget_get_style (priv->parent); |
313 | 137 | 96 | ||
314 | 138 | color = style->bg[GTK_STATE_ACTIVE]; | 97 | color = style->bg[GTK_STATE_ACTIVE]; |
315 | @@ -140,7 +99,6 @@ | |||
316 | 140 | gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->tail_window), &color, FALSE, TRUE); | 99 | gdk_colormap_alloc_color (gdk_drawable_get_colormap (priv->tail_window), &color, FALSE, TRUE); |
317 | 141 | 100 | ||
318 | 142 | gdk_window_set_background (priv->tail_window, &color); | 101 | gdk_window_set_background (priv->tail_window, &color); |
319 | 143 | #endif | ||
320 | 144 | 102 | ||
321 | 145 | gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE); | 103 | gdk_window_invalidate_rect (gtk_widget_get_window (priv->parent), &priv->allocation, TRUE); |
322 | 146 | } | 104 | } |
323 | @@ -222,19 +180,9 @@ | |||
324 | 222 | gint offset_x, | 180 | gint offset_x, |
325 | 223 | gint offset_y) | 181 | gint offset_y) |
326 | 224 | { | 182 | { |
327 | 225 | #ifdef USE_GTK3 | ||
328 | 226 | |||
329 | 227 | cairo_region_t * shape_region = cairo_region_create_rectangle (shape_rect); | ||
330 | 228 | gdk_window_shape_combine_region (window, shape_region, offset_x, offset_y); | ||
331 | 229 | cairo_region_destroy (shape_region); | ||
332 | 230 | |||
333 | 231 | #else | ||
334 | 232 | |||
335 | 233 | GdkRegion * shape_region = gdk_region_rectangle (shape_rect); | 183 | GdkRegion * shape_region = gdk_region_rectangle (shape_rect); |
336 | 234 | gdk_window_shape_combine_region (window, shape_region, offset_x, offset_y); | 184 | gdk_window_shape_combine_region (window, shape_region, offset_x, offset_y); |
337 | 235 | gdk_region_destroy (shape_region); | 185 | gdk_region_destroy (shape_region); |
338 | 236 | |||
339 | 237 | #endif | ||
340 | 238 | } | 186 | } |
341 | 239 | 187 | ||
342 | 240 | /* Callback called by the retract-tail animation. */ | 188 | /* Callback called by the retract-tail animation. */ |
343 | @@ -545,60 +493,6 @@ | |||
344 | 545 | } | 493 | } |
345 | 546 | 494 | ||
346 | 547 | /** | 495 | /** |
347 | 548 | * os_bar_set_active: | ||
348 | 549 | * @bar: a #OsBar | ||
349 | 550 | * @active: whether is active or not | ||
350 | 551 | * @animate: whether animate it or not | ||
351 | 552 | * | ||
352 | 553 | * Changes the activity state of @bar. | ||
353 | 554 | **/ | ||
354 | 555 | void | ||
355 | 556 | os_bar_set_active (OsBar *bar, | ||
356 | 557 | gboolean active, | ||
357 | 558 | gboolean animate) | ||
358 | 559 | { | ||
359 | 560 | #ifdef USE_GTK3 | ||
360 | 561 | OsBarPrivate *priv; | ||
361 | 562 | |||
362 | 563 | g_return_if_fail (OS_IS_BAR (bar)); | ||
363 | 564 | |||
364 | 565 | priv = bar->priv; | ||
365 | 566 | |||
366 | 567 | /* Set the state and draw even if there's a state_animation running, that is | ||
367 | 568 | * (!animate && os_animation_is_running (priv->state_animation)). */ | ||
368 | 569 | if ((priv->active != active) || | ||
369 | 570 | (!animate && os_animation_is_running (priv->state_animation))) | ||
370 | 571 | { | ||
371 | 572 | gboolean visible; | ||
372 | 573 | |||
373 | 574 | priv->active = active; | ||
374 | 575 | |||
375 | 576 | if (priv->parent == NULL) | ||
376 | 577 | return; | ||
377 | 578 | |||
378 | 579 | visible = gdk_window_is_visible (priv->bar_window); | ||
379 | 580 | |||
380 | 581 | if (visible) | ||
381 | 582 | os_animation_stop (priv->state_animation, NULL); | ||
382 | 583 | |||
383 | 584 | if (visible && animate) | ||
384 | 585 | { | ||
385 | 586 | os_animation_set_duration (priv->state_animation, priv->active ? DURATION_FADE_IN : | ||
386 | 587 | DURATION_FADE_OUT); | ||
387 | 588 | os_animation_start (priv->state_animation); | ||
388 | 589 | } | ||
389 | 590 | |||
390 | 591 | if (!visible || !animate) | ||
391 | 592 | { | ||
392 | 593 | priv->weight = 1.0f; | ||
393 | 594 | |||
394 | 595 | draw_bar (bar); | ||
395 | 596 | } | ||
396 | 597 | } | ||
397 | 598 | #endif | ||
398 | 599 | } | ||
399 | 600 | |||
400 | 601 | /** | ||
401 | 602 | * os_bar_set_detached: | 496 | * os_bar_set_detached: |
402 | 603 | * @bar: a #OsBar | 497 | * @bar: a #OsBar |
403 | 604 | * @detached: whether the bar is detached or not | 498 | * @detached: whether the bar is detached or not |
404 | @@ -702,23 +596,12 @@ | |||
405 | 702 | attributes.wclass = GDK_INPUT_OUTPUT; | 596 | attributes.wclass = GDK_INPUT_OUTPUT; |
406 | 703 | attributes.window_type = GDK_WINDOW_CHILD; | 597 | attributes.window_type = GDK_WINDOW_CHILD; |
407 | 704 | attributes.visual = gtk_widget_get_visual (priv->parent); | 598 | attributes.visual = gtk_widget_get_visual (priv->parent); |
408 | 705 | #ifndef USE_GTK3 | ||
409 | 706 | attributes.colormap = gtk_widget_get_colormap (priv->parent); | 599 | attributes.colormap = gtk_widget_get_colormap (priv->parent); |
410 | 707 | #endif | ||
411 | 708 | 600 | ||
412 | 709 | /* tail_window. */ | 601 | /* tail_window. */ |
413 | 710 | priv->tail_window = gdk_window_new (gtk_widget_get_window (priv->parent), | 602 | priv->tail_window = gdk_window_new (gtk_widget_get_window (priv->parent), |
414 | 711 | &attributes, | 603 | &attributes, |
415 | 712 | #ifdef USE_GTK3 | ||
416 | 713 | GDK_WA_VISUAL); | ||
417 | 714 | #else | ||
418 | 715 | GDK_WA_VISUAL | GDK_WA_COLORMAP); | 604 | GDK_WA_VISUAL | GDK_WA_COLORMAP); |
419 | 716 | #endif | ||
420 | 717 | |||
421 | 718 | #ifdef USE_GTK3 | ||
422 | 719 | gdk_window_ensure_native (priv->tail_window); | ||
423 | 720 | gtk_widget_register_window (priv->parent, priv->tail_window); | ||
424 | 721 | #endif | ||
425 | 722 | 605 | ||
426 | 723 | g_object_ref_sink (priv->tail_window); | 606 | g_object_ref_sink (priv->tail_window); |
427 | 724 | 607 | ||
428 | @@ -727,26 +610,13 @@ | |||
429 | 727 | 610 | ||
430 | 728 | /* FIXME(Cimi) maybe this is not required with 0 as event mask. */ | 611 | /* FIXME(Cimi) maybe this is not required with 0 as event mask. */ |
431 | 729 | gdk_window_input_shape_combine_region (priv->tail_window, | 612 | gdk_window_input_shape_combine_region (priv->tail_window, |
432 | 730 | #ifdef USE_GTK3 | ||
433 | 731 | cairo_region_create (), | ||
434 | 732 | #else | ||
435 | 733 | gdk_region_new (), | 613 | gdk_region_new (), |
436 | 734 | #endif | ||
437 | 735 | 0, 0); | 614 | 0, 0); |
438 | 736 | 615 | ||
439 | 737 | /* bar_window. */ | 616 | /* bar_window. */ |
440 | 738 | priv->bar_window = gdk_window_new (gtk_widget_get_window (priv->parent), | 617 | priv->bar_window = gdk_window_new (gtk_widget_get_window (priv->parent), |
441 | 739 | &attributes, | 618 | &attributes, |
442 | 740 | #ifdef USE_GTK3 | ||
443 | 741 | GDK_WA_VISUAL); | ||
444 | 742 | #else | ||
445 | 743 | GDK_WA_VISUAL | GDK_WA_COLORMAP); | 619 | GDK_WA_VISUAL | GDK_WA_COLORMAP); |
446 | 744 | #endif | ||
447 | 745 | |||
448 | 746 | #ifdef USE_GTK3 | ||
449 | 747 | gdk_window_ensure_native (priv->bar_window); | ||
450 | 748 | gtk_widget_register_window (priv->parent, priv->bar_window); | ||
451 | 749 | #endif | ||
452 | 750 | 620 | ||
453 | 751 | g_object_ref_sink (priv->bar_window); | 621 | g_object_ref_sink (priv->bar_window); |
454 | 752 | 622 | ||
455 | @@ -755,11 +625,7 @@ | |||
456 | 755 | 625 | ||
457 | 756 | /* FIXME(Cimi) maybe this is not required with 0 as event mask. */ | 626 | /* FIXME(Cimi) maybe this is not required with 0 as event mask. */ |
458 | 757 | gdk_window_input_shape_combine_region (priv->bar_window, | 627 | gdk_window_input_shape_combine_region (priv->bar_window, |
459 | 758 | #ifdef USE_GTK3 | ||
460 | 759 | cairo_region_create (), | ||
461 | 760 | #else | ||
462 | 761 | gdk_region_new (), | 628 | gdk_region_new (), |
463 | 762 | #endif | ||
464 | 763 | 0, 0); | 629 | 0, 0); |
465 | 764 | 630 | ||
466 | 765 | mask_tail (bar); | 631 | mask_tail (bar); |
467 | 766 | 632 | ||
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 | 196 | void os_bar_move_resize (OsBar *bar, | 196 | void os_bar_move_resize (OsBar *bar, |
473 | 197 | GdkRectangle mask); | 197 | GdkRectangle mask); |
474 | 198 | 198 | ||
475 | 199 | void os_bar_set_active (OsBar *bar, | ||
476 | 200 | gboolean active, | ||
477 | 201 | gboolean animate); | ||
478 | 202 | |||
479 | 203 | void os_bar_set_detached (OsBar *bar, | 199 | void os_bar_set_detached (OsBar *bar, |
480 | 204 | gboolean detached, | 200 | gboolean detached, |
481 | 205 | gboolean animate); | 201 | gboolean animate); |
482 | 206 | 202 | ||
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 | 126 | gboolean allow_resize; | 126 | gboolean allow_resize; |
488 | 127 | gboolean allow_resize_paned; | 127 | gboolean allow_resize_paned; |
489 | 128 | gboolean resizing_paned; | 128 | gboolean resizing_paned; |
490 | 129 | #ifdef USE_GTK3 | ||
491 | 130 | gboolean deactivable_bar; | ||
492 | 131 | #endif | ||
493 | 132 | gboolean hidable_thumb; | 129 | gboolean hidable_thumb; |
494 | 133 | gboolean window_button_press; /* FIXME(Cimi) to replace with X11 input events. */ | 130 | gboolean window_button_press; /* FIXME(Cimi) to replace with X11 input events. */ |
495 | 134 | gdouble value; | 131 | gdouble value; |
496 | @@ -142,11 +139,6 @@ | |||
497 | 142 | guint32 source_unlock_thumb_id; | 139 | guint32 source_unlock_thumb_id; |
498 | 143 | } OsScrollbarPrivate; | 140 | } OsScrollbarPrivate; |
499 | 144 | 141 | ||
500 | 145 | #ifdef USE_GTK3 | ||
501 | 146 | static GdkInputSource os_input_source = GDK_SOURCE_MOUSE; | ||
502 | 147 | static gint os_device_id = 0; | ||
503 | 148 | static GtkCssProvider *provider = NULL; | ||
504 | 149 | #endif | ||
505 | 150 | static Atom net_active_window_atom = None; | 142 | static Atom net_active_window_atom = None; |
506 | 151 | static Atom unity_net_workarea_region_atom = None; | 143 | static Atom unity_net_workarea_region_atom = None; |
507 | 152 | static GSList *os_root_list = NULL; | 144 | static GSList *os_root_list = NULL; |
508 | @@ -176,16 +168,9 @@ | |||
509 | 176 | static void thumb_unmap_cb (GtkWidget *widget, gpointer user_data); | 168 | static void thumb_unmap_cb (GtkWidget *widget, gpointer user_data); |
510 | 177 | 169 | ||
511 | 178 | /* GtkScrollbar vfunc pointers. */ | 170 | /* GtkScrollbar vfunc pointers. */ |
512 | 179 | #ifdef USE_GTK3 | ||
513 | 180 | static gboolean (* pre_hijacked_scrollbar_draw) (GtkWidget *widget, cairo_t *cr); | ||
514 | 181 | static void (* pre_hijacked_scrollbar_get_preferred_width) (GtkWidget *widget, gint *minimal_width, gint *natural_width); | ||
515 | 182 | static void (* pre_hijacked_scrollbar_get_preferred_height) (GtkWidget *widget, gint *minimal_height, gint *natural_height); | ||
516 | 183 | static void (* pre_hijacked_scrollbar_state_flags_changed) (GtkWidget *widget, GtkStateFlags flags); | ||
517 | 184 | #else | ||
518 | 185 | static gboolean (* pre_hijacked_scrollbar_expose_event) (GtkWidget *widget, GdkEventExpose *event); | 171 | static gboolean (* pre_hijacked_scrollbar_expose_event) (GtkWidget *widget, GdkEventExpose *event); |
519 | 186 | static void (* pre_hijacked_scrollbar_size_request) (GtkWidget *widget, GtkRequisition *requisition); | 172 | static void (* pre_hijacked_scrollbar_size_request) (GtkWidget *widget, GtkRequisition *requisition); |
520 | 187 | static void (* pre_hijacked_scrollbar_state_changed) (GtkWidget *widget, GtkStateType state); | 173 | static void (* pre_hijacked_scrollbar_state_changed) (GtkWidget *widget, GtkStateType state); |
521 | 188 | #endif | ||
522 | 189 | static void (* pre_hijacked_scrollbar_grab_notify) (GtkWidget *widget, gboolean was_grabbed); | 174 | static void (* pre_hijacked_scrollbar_grab_notify) (GtkWidget *widget, gboolean was_grabbed); |
523 | 190 | static void (* pre_hijacked_scrollbar_hide) (GtkWidget *widget); | 175 | static void (* pre_hijacked_scrollbar_hide) (GtkWidget *widget); |
524 | 191 | static void (* pre_hijacked_scrollbar_map) (GtkWidget *widget); | 176 | static void (* pre_hijacked_scrollbar_map) (GtkWidget *widget); |
525 | @@ -197,16 +182,9 @@ | |||
526 | 197 | static void (* pre_hijacked_scrollbar_dispose) (GObject *object); | 182 | static void (* pre_hijacked_scrollbar_dispose) (GObject *object); |
527 | 198 | 183 | ||
528 | 199 | /* Hijacked GtkScrollbar vfunc pointers. */ | 184 | /* Hijacked GtkScrollbar vfunc pointers. */ |
529 | 200 | #ifdef USE_GTK3 | ||
530 | 201 | static gboolean hijacked_scrollbar_draw (GtkWidget *widget, cairo_t *cr); | ||
531 | 202 | static void hijacked_scrollbar_get_preferred_width (GtkWidget *widget, gint *minimal_width, gint *natural_width); | ||
532 | 203 | static void hijacked_scrollbar_get_preferred_height (GtkWidget *widget, gint *minimal_height, gint *natural_height); | ||
533 | 204 | static void hijacked_scrollbar_state_flags_changed (GtkWidget *widget, GtkStateFlags flags); | ||
534 | 205 | #else | ||
535 | 206 | static gboolean hijacked_scrollbar_expose_event (GtkWidget *widget, GdkEventExpose *event); | 185 | static gboolean hijacked_scrollbar_expose_event (GtkWidget *widget, GdkEventExpose *event); |
536 | 207 | static void hijacked_scrollbar_size_request (GtkWidget *widget, GtkRequisition *requisition); | 186 | static void hijacked_scrollbar_size_request (GtkWidget *widget, GtkRequisition *requisition); |
537 | 208 | static void hijacked_scrollbar_state_changed (GtkWidget *widget, GtkStateType state); | 187 | static void hijacked_scrollbar_state_changed (GtkWidget *widget, GtkStateType state); |
538 | 209 | #endif | ||
539 | 210 | static void hijacked_scrollbar_grab_notify (GtkWidget *widget, gboolean was_grabbed); | 188 | static void hijacked_scrollbar_grab_notify (GtkWidget *widget, gboolean was_grabbed); |
540 | 211 | static void hijacked_scrollbar_hide (GtkWidget *widget); | 189 | static void hijacked_scrollbar_hide (GtkWidget *widget); |
541 | 212 | static void hijacked_scrollbar_map (GtkWidget *widget); | 190 | static void hijacked_scrollbar_map (GtkWidget *widget); |
542 | @@ -576,38 +554,6 @@ | |||
543 | 576 | return value; | 554 | return value; |
544 | 577 | } | 555 | } |
545 | 578 | 556 | ||
546 | 579 | #ifdef USE_GTK3 | ||
547 | 580 | /* Deactivate the bar if it's the case. */ | ||
548 | 581 | static void | ||
549 | 582 | deactivate_bar (GtkScrollbar *scrollbar) | ||
550 | 583 | { | ||
551 | 584 | OsScrollbarPrivate *priv; | ||
552 | 585 | |||
553 | 586 | priv = get_private (GTK_WIDGET (scrollbar)); | ||
554 | 587 | |||
555 | 588 | if (priv->bar != NULL && priv->deactivable_bar) | ||
556 | 589 | os_bar_set_active (priv->bar, FALSE, TRUE); | ||
557 | 590 | } | ||
558 | 591 | |||
559 | 592 | /* Timeout before deactivating the bar. */ | ||
560 | 593 | static gboolean | ||
561 | 594 | deactivate_bar_cb (gpointer user_data) | ||
562 | 595 | { | ||
563 | 596 | GtkScrollbar *scrollbar; | ||
564 | 597 | OsScrollbarPrivate *priv; | ||
565 | 598 | |||
566 | 599 | scrollbar = GTK_SCROLLBAR (user_data); | ||
567 | 600 | priv = get_private (GTK_WIDGET (scrollbar)); | ||
568 | 601 | |||
569 | 602 | OS_DCHECK (!priv->active_window); | ||
570 | 603 | |||
571 | 604 | deactivate_bar (scrollbar); | ||
572 | 605 | priv->source_deactivate_bar_id = 0; | ||
573 | 606 | |||
574 | 607 | return FALSE; | ||
575 | 608 | } | ||
576 | 609 | #endif | ||
577 | 610 | |||
578 | 611 | /* destroy the private struct */ | 557 | /* destroy the private struct */ |
579 | 612 | static void | 558 | static void |
580 | 613 | destroy_private (gpointer priv) | 559 | destroy_private (gpointer priv) |
581 | @@ -669,9 +615,6 @@ | |||
582 | 669 | 615 | ||
583 | 670 | /* Initialize struct variables. */ | 616 | /* Initialize struct variables. */ |
584 | 671 | qdata->side = OS_SIDE_RIGHT; | 617 | qdata->side = OS_SIDE_RIGHT; |
585 | 672 | #ifdef USE_GTK3 | ||
586 | 673 | qdata->deactivable_bar = TRUE; | ||
587 | 674 | #endif | ||
588 | 675 | qdata->hidable_thumb = TRUE; | 618 | qdata->hidable_thumb = TRUE; |
589 | 676 | qdata->fine_scroll_multiplier = 1.0; | 619 | qdata->fine_scroll_multiplier = 1.0; |
590 | 677 | qdata->bar = os_bar_new (); | 620 | qdata->bar = os_bar_new (); |
591 | @@ -733,11 +676,7 @@ | |||
592 | 733 | static gboolean | 676 | static gboolean |
593 | 734 | is_insensitive (GtkScrollbar *scrollbar) | 677 | is_insensitive (GtkScrollbar *scrollbar) |
594 | 735 | { | 678 | { |
595 | 736 | #ifdef USE_GTK3 | ||
596 | 737 | return (gtk_widget_get_state_flags (GTK_WIDGET (scrollbar)) & GTK_STATE_FLAG_INSENSITIVE) != 0; | ||
597 | 738 | #else | ||
598 | 739 | return gtk_widget_get_state (GTK_WIDGET (scrollbar)) == GTK_STATE_INSENSITIVE; | 679 | return gtk_widget_get_state (GTK_WIDGET (scrollbar)) == GTK_STATE_INSENSITIVE; |
599 | 740 | #endif | ||
600 | 741 | } | 680 | } |
601 | 742 | 681 | ||
602 | 743 | /* Move the bar. */ | 682 | /* Move the bar. */ |
603 | @@ -829,9 +768,7 @@ | |||
604 | 829 | gint x, | 768 | gint x, |
605 | 830 | gint y) | 769 | gint y) |
606 | 831 | { | 770 | { |
607 | 832 | #ifndef USE_GTK3 | ||
608 | 833 | GdkRectangle gdk_rect; | 771 | GdkRectangle gdk_rect; |
609 | 834 | #endif | ||
610 | 835 | GdkScreen *screen; | 772 | GdkScreen *screen; |
611 | 836 | OsScrollbarPrivate *priv; | 773 | OsScrollbarPrivate *priv; |
612 | 837 | cairo_rectangle_int_t rect; | 774 | cairo_rectangle_int_t rect; |
613 | @@ -845,16 +782,12 @@ | |||
614 | 845 | 782 | ||
615 | 846 | screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar)); | 783 | screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar)); |
616 | 847 | n_monitor = gdk_screen_get_monitor_at_point (screen, monitor_x, y); | 784 | n_monitor = gdk_screen_get_monitor_at_point (screen, monitor_x, y); |
617 | 848 | #ifdef USE_GTK3 | ||
618 | 849 | gdk_screen_get_monitor_geometry (screen, n_monitor, &rect); | ||
619 | 850 | #else | ||
620 | 851 | gdk_screen_get_monitor_geometry (screen, n_monitor, &gdk_rect); | 785 | gdk_screen_get_monitor_geometry (screen, n_monitor, &gdk_rect); |
621 | 852 | 786 | ||
622 | 853 | rect.x = gdk_rect.x; | 787 | rect.x = gdk_rect.x; |
623 | 854 | rect.y = gdk_rect.y; | 788 | rect.y = gdk_rect.y; |
624 | 855 | rect.width = gdk_rect.width; | 789 | rect.width = gdk_rect.width; |
625 | 856 | rect.height = gdk_rect.height; | 790 | rect.height = gdk_rect.height; |
626 | 857 | #endif | ||
627 | 858 | 791 | ||
628 | 859 | screen_x = rect.x; | 792 | screen_x = rect.x; |
629 | 860 | screen_width = rect.x + rect.width; | 793 | screen_width = rect.x + rect.width; |
630 | @@ -972,9 +905,7 @@ | |||
631 | 972 | gint x, | 905 | gint x, |
632 | 973 | gint y) | 906 | gint y) |
633 | 974 | { | 907 | { |
634 | 975 | #ifndef USE_GTK3 | ||
635 | 976 | GdkRectangle gdk_rect; | 908 | GdkRectangle gdk_rect; |
636 | 977 | #endif | ||
637 | 978 | GdkScreen *screen; | 909 | GdkScreen *screen; |
638 | 979 | OsScrollbarPrivate *priv; | 910 | OsScrollbarPrivate *priv; |
639 | 980 | cairo_rectangle_int_t rect; | 911 | cairo_rectangle_int_t rect; |
640 | @@ -988,16 +919,12 @@ | |||
641 | 988 | 919 | ||
642 | 989 | screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar)); | 920 | screen = gtk_widget_get_screen (GTK_WIDGET (scrollbar)); |
643 | 990 | n_monitor = gdk_screen_get_monitor_at_point (screen, x, monitor_y); | 921 | n_monitor = gdk_screen_get_monitor_at_point (screen, x, monitor_y); |
644 | 991 | #ifdef USE_GTK3 | ||
645 | 992 | gdk_screen_get_monitor_geometry (screen, n_monitor, &rect); | ||
646 | 993 | #else | ||
647 | 994 | gdk_screen_get_monitor_geometry (screen, n_monitor, &gdk_rect); | 922 | gdk_screen_get_monitor_geometry (screen, n_monitor, &gdk_rect); |
648 | 995 | 923 | ||
649 | 996 | rect.x = gdk_rect.x; | 924 | rect.x = gdk_rect.x; |
650 | 997 | rect.y = gdk_rect.y; | 925 | rect.y = gdk_rect.y; |
651 | 998 | rect.width = gdk_rect.width; | 926 | rect.width = gdk_rect.width; |
652 | 999 | rect.height = gdk_rect.height; | 927 | rect.height = gdk_rect.height; |
653 | 1000 | #endif | ||
654 | 1001 | 928 | ||
655 | 1002 | screen_y = rect.y; | 929 | screen_y = rect.y; |
656 | 1003 | screen_height = rect.y + rect.height; | 930 | screen_height = rect.y + rect.height; |
657 | @@ -1286,17 +1213,7 @@ | |||
658 | 1286 | gint *x, | 1213 | gint *x, |
659 | 1287 | gint *y) | 1214 | gint *y) |
660 | 1288 | { | 1215 | { |
661 | 1289 | #ifdef USE_GTK3 | ||
662 | 1290 | GdkDeviceManager *device_manager; | ||
663 | 1291 | GdkDevice *device; | ||
664 | 1292 | |||
665 | 1293 | device_manager = gdk_display_get_device_manager (gdk_window_get_display (window)); | ||
666 | 1294 | device = gdk_device_manager_get_client_pointer (device_manager); | ||
667 | 1295 | |||
668 | 1296 | return gdk_device_get_window_at_position (device, x, y); | ||
669 | 1297 | #else | ||
670 | 1298 | return gdk_window_at_pointer (x, y); | 1216 | return gdk_window_at_pointer (x, y); |
671 | 1299 | #endif | ||
672 | 1300 | } | 1217 | } |
673 | 1301 | 1218 | ||
674 | 1302 | /* Get the position of the pointer. */ | 1219 | /* Get the position of the pointer. */ |
675 | @@ -1306,17 +1223,7 @@ | |||
676 | 1306 | gint *y, | 1223 | gint *y, |
677 | 1307 | GdkModifierType *mask) | 1224 | GdkModifierType *mask) |
678 | 1308 | { | 1225 | { |
679 | 1309 | #ifdef USE_GTK3 | ||
680 | 1310 | GdkDeviceManager *device_manager; | ||
681 | 1311 | GdkDevice *device; | ||
682 | 1312 | |||
683 | 1313 | device_manager = gdk_display_get_device_manager (gdk_window_get_display (window)); | ||
684 | 1314 | device = gdk_device_manager_get_client_pointer (device_manager); | ||
685 | 1315 | |||
686 | 1316 | return gdk_window_get_device_position (window, device, x, y, mask); | ||
687 | 1317 | #else | ||
688 | 1318 | return gdk_window_get_pointer (window, x, y, mask); | 1226 | return gdk_window_get_pointer (window, x, y, mask); |
689 | 1319 | #endif | ||
690 | 1320 | } | 1227 | } |
691 | 1321 | 1228 | ||
692 | 1322 | /* Adjustment functions. */ | 1229 | /* Adjustment functions. */ |
693 | @@ -1506,38 +1413,6 @@ | |||
694 | 1506 | move_bar (scrollbar); | 1413 | move_bar (scrollbar); |
695 | 1507 | } | 1414 | } |
696 | 1508 | 1415 | ||
697 | 1509 | #ifdef USE_GTK3 | ||
698 | 1510 | /* Bar functions. */ | ||
699 | 1511 | |||
700 | 1512 | /* Set the state of the bar checking mouse position. */ | ||
701 | 1513 | static void | ||
702 | 1514 | bar_set_state_from_pointer (GtkScrollbar *scrollbar, | ||
703 | 1515 | gint x, | ||
704 | 1516 | gint y) | ||
705 | 1517 | { | ||
706 | 1518 | GtkAllocation allocation; | ||
707 | 1519 | OsScrollbarPrivate *priv; | ||
708 | 1520 | |||
709 | 1521 | priv = get_private (GTK_WIDGET (scrollbar)); | ||
710 | 1522 | |||
711 | 1523 | OS_DCHECK (!priv->active_window); | ||
712 | 1524 | |||
713 | 1525 | gtk_widget_get_allocation (gtk_widget_get_parent (GTK_WIDGET (scrollbar)), &allocation); | ||
714 | 1526 | |||
715 | 1527 | if ((x > allocation.x && x < allocation.x + allocation.width) && | ||
716 | 1528 | (y > allocation.y && y < allocation.y + allocation.height)) | ||
717 | 1529 | { | ||
718 | 1530 | priv->deactivable_bar = FALSE; | ||
719 | 1531 | os_bar_set_active (priv->bar, TRUE, TRUE); | ||
720 | 1532 | } | ||
721 | 1533 | else | ||
722 | 1534 | { | ||
723 | 1535 | priv->deactivable_bar = TRUE; | ||
724 | 1536 | os_bar_set_active (priv->bar, FALSE, TRUE); | ||
725 | 1537 | } | ||
726 | 1538 | } | ||
727 | 1539 | #endif | ||
728 | 1540 | |||
729 | 1541 | /* Root window functions. */ | 1416 | /* Root window functions. */ |
730 | 1542 | 1417 | ||
731 | 1543 | /* Filter function applied to the root window. */ | 1418 | /* Filter function applied to the root window. */ |
732 | @@ -1600,12 +1475,7 @@ | |||
733 | 1600 | &xev); | 1475 | &xev); |
734 | 1601 | 1476 | ||
735 | 1602 | gdk_flush (); | 1477 | gdk_flush (); |
736 | 1603 | |||
737 | 1604 | #ifdef USE_GTK3 | ||
738 | 1605 | gdk_error_trap_pop_ignored (); | ||
739 | 1606 | #else | ||
740 | 1607 | gdk_error_trap_pop (); | 1478 | gdk_error_trap_pop (); |
741 | 1608 | #endif | ||
742 | 1609 | } | 1479 | } |
743 | 1610 | 1480 | ||
744 | 1611 | /* Present a Gdk window. */ | 1481 | /* Present a Gdk window. */ |
745 | @@ -1858,9 +1728,6 @@ | |||
746 | 1858 | 1728 | ||
747 | 1859 | priv->event |= OS_EVENT_ENTER_NOTIFY; | 1729 | priv->event |= OS_EVENT_ENTER_NOTIFY; |
748 | 1860 | 1730 | ||
749 | 1861 | #ifdef USE_GTK3 | ||
750 | 1862 | priv->deactivable_bar = FALSE; | ||
751 | 1863 | #endif | ||
752 | 1864 | priv->hidable_thumb = FALSE; | 1731 | priv->hidable_thumb = FALSE; |
753 | 1865 | 1732 | ||
754 | 1866 | if (priv->state & OS_STATE_INTERNAL) | 1733 | if (priv->state & OS_STATE_INTERNAL) |
755 | @@ -1876,15 +1743,6 @@ | |||
756 | 1876 | 1743 | ||
757 | 1877 | scrollbar = GTK_SCROLLBAR (user_data); | 1744 | scrollbar = GTK_SCROLLBAR (user_data); |
758 | 1878 | 1745 | ||
759 | 1879 | #ifdef USE_GTK3 | ||
760 | 1880 | /* Gtk+ 3.3.18 emits more GdkEventCrossing | ||
761 | 1881 | * with touch devices, skip few events. */ | ||
762 | 1882 | if (event->mode == GDK_CROSSING_TOUCH_BEGIN || | ||
763 | 1883 | event->mode == GDK_CROSSING_TOUCH_END || | ||
764 | 1884 | event->mode == GDK_CROSSING_DEVICE_SWITCH) | ||
765 | 1885 | return FALSE; | ||
766 | 1886 | #endif | ||
767 | 1887 | |||
768 | 1888 | enter_event (scrollbar); | 1746 | enter_event (scrollbar); |
769 | 1889 | 1747 | ||
770 | 1890 | return FALSE; | 1748 | return FALSE; |
771 | @@ -1901,22 +1759,6 @@ | |||
772 | 1901 | scrollbar = GTK_SCROLLBAR (user_data); | 1759 | scrollbar = GTK_SCROLLBAR (user_data); |
773 | 1902 | priv = get_private (GTK_WIDGET (scrollbar)); | 1760 | priv = get_private (GTK_WIDGET (scrollbar)); |
774 | 1903 | 1761 | ||
775 | 1904 | #ifdef USE_GTK3 | ||
776 | 1905 | /* Gtk+ 3.3.18 emits more GdkEventCrossing | ||
777 | 1906 | * with touch devices, skip few events. | ||
778 | 1907 | * Last line skips the event if the pointer is still in the window: | ||
779 | 1908 | * this happens with touch devices because Gtk+ emits | ||
780 | 1909 | * GDK_CROSSING_UNGRAB to the touch device, thus calling leave-notify, | ||
781 | 1910 | * and we want to skip those events. | ||
782 | 1911 | * | ||
783 | 1912 | * FIXME the logic of this event should be rewritten. */ | ||
784 | 1913 | if (event->mode == GDK_CROSSING_TOUCH_BEGIN || | ||
785 | 1914 | event->mode == GDK_CROSSING_TOUCH_END || | ||
786 | 1915 | event->mode == GDK_CROSSING_DEVICE_SWITCH || | ||
787 | 1916 | window_at_pointer (event->window, NULL, NULL) == event->window) | ||
788 | 1917 | return FALSE; | ||
789 | 1918 | #endif | ||
790 | 1919 | |||
791 | 1920 | /* When exiting the thumb horizontally (or vertically), | 1762 | /* When exiting the thumb horizontally (or vertically), |
792 | 1921 | * in LOCKED state, remove the lock. */ | 1763 | * in LOCKED state, remove the lock. */ |
793 | 1922 | if ((priv->state & OS_STATE_LOCKED) && | 1764 | if ((priv->state & OS_STATE_LOCKED) && |
794 | @@ -1930,21 +1772,6 @@ | |||
795 | 1930 | * not interacting with the thumb. */ | 1772 | * not interacting with the thumb. */ |
796 | 1931 | if (!(priv->event & OS_EVENT_BUTTON_PRESS)) | 1773 | if (!(priv->event & OS_EVENT_BUTTON_PRESS)) |
797 | 1932 | { | 1774 | { |
798 | 1933 | #ifdef USE_GTK3 | ||
799 | 1934 | /* Never deactivate the bar in an active window. */ | ||
800 | 1935 | if (!priv->active_window) | ||
801 | 1936 | { | ||
802 | 1937 | priv->deactivable_bar = TRUE; | ||
803 | 1938 | |||
804 | 1939 | if (priv->source_deactivate_bar_id != 0) | ||
805 | 1940 | g_source_remove (priv->source_deactivate_bar_id); | ||
806 | 1941 | |||
807 | 1942 | priv->source_deactivate_bar_id = g_timeout_add (TIMEOUT_THUMB_HIDE, | ||
808 | 1943 | deactivate_bar_cb, | ||
809 | 1944 | scrollbar); | ||
810 | 1945 | } | ||
811 | 1946 | #endif | ||
812 | 1947 | |||
813 | 1948 | priv->event &= ~(OS_EVENT_ENTER_NOTIFY); | 1775 | priv->event &= ~(OS_EVENT_ENTER_NOTIFY); |
814 | 1949 | 1776 | ||
815 | 1950 | priv->hidable_thumb = TRUE; | 1777 | priv->hidable_thumb = TRUE; |
816 | @@ -1973,16 +1800,6 @@ | |||
817 | 1973 | 1800 | ||
818 | 1974 | scrollbar = GTK_SCROLLBAR (user_data); | 1801 | scrollbar = GTK_SCROLLBAR (user_data); |
819 | 1975 | 1802 | ||
820 | 1976 | #ifdef USE_GTK3 | ||
821 | 1977 | OsScrollbarPrivate *priv; | ||
822 | 1978 | |||
823 | 1979 | /* Immediately set the bar to be active. */ | ||
824 | 1980 | priv = get_private (GTK_WIDGET (scrollbar)); | ||
825 | 1981 | |||
826 | 1982 | priv->deactivable_bar = FALSE; | ||
827 | 1983 | os_bar_set_active (priv->bar, TRUE, FALSE); | ||
828 | 1984 | #endif | ||
829 | 1985 | |||
830 | 1986 | xid = GDK_WINDOW_XID (gtk_widget_get_window (widget)); | 1803 | xid = GDK_WINDOW_XID (gtk_widget_get_window (widget)); |
831 | 1987 | xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (gtk_widget_get_toplevel (GTK_WIDGET (scrollbar)))); | 1804 | xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (gtk_widget_get_toplevel (GTK_WIDGET (scrollbar)))); |
832 | 1988 | display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (GTK_WIDGET (scrollbar))); | 1805 | display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (GTK_WIDGET (scrollbar))); |
833 | @@ -2031,12 +1848,7 @@ | |||
834 | 2031 | &xev); | 1848 | &xev); |
835 | 2032 | 1849 | ||
836 | 2033 | gdk_flush (); | 1850 | gdk_flush (); |
837 | 2034 | |||
838 | 2035 | #ifdef USE_GTK3 | ||
839 | 2036 | gdk_error_trap_pop_ignored (); | ||
840 | 2037 | #else | ||
841 | 2038 | gdk_error_trap_pop (); | 1851 | gdk_error_trap_pop (); |
842 | 2039 | #endif | ||
843 | 2040 | } | 1852 | } |
844 | 2041 | } | 1853 | } |
845 | 2042 | 1854 | ||
846 | @@ -2117,17 +1929,6 @@ | |||
847 | 2117 | scrollbar = GTK_SCROLLBAR (user_data); | 1929 | scrollbar = GTK_SCROLLBAR (user_data); |
848 | 2118 | priv = get_private (GTK_WIDGET (scrollbar)); | 1930 | priv = get_private (GTK_WIDGET (scrollbar)); |
849 | 2119 | 1931 | ||
850 | 2120 | #ifdef USE_GTK3 | ||
851 | 2121 | /* On touch devices with XI2 and Gtk+ >= 3.3.18, | ||
852 | 2122 | * the event enter-notify is not emitted. | ||
853 | 2123 | * Deal with it in motion-notify. */ | ||
854 | 2124 | |||
855 | 2125 | /* Should be fixed with: | ||
856 | 2126 | * https://bugs.launchpad.net/ubuntu/+source/gtk+3.0/+bug/949414 */ | ||
857 | 2127 | // if (!(priv->event & OS_EVENT_ENTER_NOTIFY)) | ||
858 | 2128 | // enter_event (scrollbar); | ||
859 | 2129 | #endif | ||
860 | 2130 | |||
861 | 2131 | if (priv->event & OS_EVENT_BUTTON_PRESS) | 1932 | if (priv->event & OS_EVENT_BUTTON_PRESS) |
862 | 2132 | { | 1933 | { |
863 | 2133 | gint x, y; | 1934 | gint x, y; |
864 | @@ -2513,14 +2314,6 @@ | |||
865 | 2513 | OsScrollbarPrivate *priv; | 2314 | OsScrollbarPrivate *priv; |
866 | 2514 | gdouble delta; | 2315 | gdouble delta; |
867 | 2515 | 2316 | ||
868 | 2516 | #ifdef USE_GTK3 | ||
869 | 2517 | /* Gtk+ 3.3.18 adds a smooth scroll support, | ||
870 | 2518 | * but at the moment is not ready to be used without various issues. | ||
871 | 2519 | * Don't use it for thumb scrolling in overlay scrollbar. */ | ||
872 | 2520 | if (event->direction == GDK_SCROLL_SMOOTH) | ||
873 | 2521 | return FALSE; | ||
874 | 2522 | #endif | ||
875 | 2523 | |||
876 | 2524 | scrollbar = GTK_SCROLLBAR (user_data); | 2317 | scrollbar = GTK_SCROLLBAR (user_data); |
877 | 2525 | priv = get_private (GTK_WIDGET (scrollbar)); | 2318 | priv = get_private (GTK_WIDGET (scrollbar)); |
878 | 2526 | 2319 | ||
879 | @@ -2597,52 +2390,6 @@ | |||
880 | 2597 | const gint64 current_time = g_get_monotonic_time (); | 2390 | const gint64 current_time = g_get_monotonic_time (); |
881 | 2598 | const gint64 end_time = priv->present_time + TIMEOUT_PRESENT_WINDOW * 1000; | 2391 | const gint64 end_time = priv->present_time + TIMEOUT_PRESENT_WINDOW * 1000; |
882 | 2599 | 2392 | ||
883 | 2600 | #ifdef USE_GTK3 | ||
884 | 2601 | /* If the widget is mapped, is not insentitive | ||
885 | 2602 | * and the configure-event happens after | ||
886 | 2603 | * the PropertyNotify _NET_ACTIVE_WINDOW event, | ||
887 | 2604 | * see if the mouse pointer is over this window, if TRUE, | ||
888 | 2605 | * proceed with bar_set_state_from_pointer (). */ | ||
889 | 2606 | if (!is_insensitive (scrollbar) && | ||
890 | 2607 | (current_time > end_time) && | ||
891 | 2608 | gtk_widget_get_mapped (GTK_WIDGET (scrollbar))) | ||
892 | 2609 | { | ||
893 | 2610 | if (!priv->active_window) | ||
894 | 2611 | { | ||
895 | 2612 | GdkWindow *parent; | ||
896 | 2613 | |||
897 | 2614 | /* Loop through parent windows until it reaches | ||
898 | 2615 | * either an unknown GdkWindow (NULL), | ||
899 | 2616 | * or the toplevel window. */ | ||
900 | 2617 | parent = window_at_pointer (gtk_widget_get_window (GTK_WIDGET (scrollbar)), NULL, NULL); | ||
901 | 2618 | while (parent != NULL) | ||
902 | 2619 | { | ||
903 | 2620 | if (event->window == parent) | ||
904 | 2621 | break; | ||
905 | 2622 | |||
906 | 2623 | parent = gdk_window_get_parent (parent); | ||
907 | 2624 | } | ||
908 | 2625 | |||
909 | 2626 | if (parent != NULL) | ||
910 | 2627 | { | ||
911 | 2628 | gint x, y; | ||
912 | 2629 | |||
913 | 2630 | window_get_pointer (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x, &y, NULL); | ||
914 | 2631 | |||
915 | 2632 | /* When the window is resized (maximize/restore), | ||
916 | 2633 | * check the position of the pointer | ||
917 | 2634 | * and set the state accordingly. */ | ||
918 | 2635 | bar_set_state_from_pointer (scrollbar, x, y); | ||
919 | 2636 | } | ||
920 | 2637 | } | ||
921 | 2638 | else | ||
922 | 2639 | { | ||
923 | 2640 | priv->deactivable_bar = FALSE; | ||
924 | 2641 | os_bar_set_active (priv->bar, TRUE, TRUE); | ||
925 | 2642 | } | ||
926 | 2643 | } | ||
927 | 2644 | #endif | ||
928 | 2645 | |||
929 | 2646 | if (current_time > end_time) | 2393 | if (current_time > end_time) |
930 | 2647 | gtk_widget_hide (priv->thumb); | 2394 | gtk_widget_hide (priv->thumb); |
931 | 2648 | 2395 | ||
932 | @@ -2877,55 +2624,7 @@ | |||
933 | 2877 | is_touch_mode (GtkWidget *widget, | 2624 | is_touch_mode (GtkWidget *widget, |
934 | 2878 | gint device_id) | 2625 | gint device_id) |
935 | 2879 | { | 2626 | { |
936 | 2880 | #ifdef USE_GTK3 | ||
937 | 2881 | switch (scrollbar_mode) | ||
938 | 2882 | { | ||
939 | 2883 | case SCROLLBAR_MODE_OVERLAY_AUTO: | ||
940 | 2884 | default: | ||
941 | 2885 | /* Continue detecting source type. */ | ||
942 | 2886 | break; | ||
943 | 2887 | case SCROLLBAR_MODE_OVERLAY_POINTER: | ||
944 | 2888 | /* Touch mode always disabled. */ | ||
945 | 2889 | return FALSE; | ||
946 | 2890 | break; | ||
947 | 2891 | case SCROLLBAR_MODE_OVERLAY_TOUCH: | ||
948 | 2892 | /* Touch mode always enabled. */ | ||
949 | 2893 | return TRUE; | ||
950 | 2894 | break; | ||
951 | 2895 | } | ||
952 | 2896 | |||
953 | 2897 | /* Use some sort of cache for the device. | ||
954 | 2898 | * Update the input source only if the device_id | ||
955 | 2899 | * is different from the previous one. */ | ||
956 | 2900 | if (os_device_id != device_id) | ||
957 | 2901 | { | ||
958 | 2902 | GdkDeviceManager *device_manager; | ||
959 | 2903 | GdkDevice *device; | ||
960 | 2904 | GdkWindow *window; | ||
961 | 2905 | |||
962 | 2906 | /* Update the static os_device_id variable. */ | ||
963 | 2907 | os_device_id = device_id; | ||
964 | 2908 | |||
965 | 2909 | window = gtk_widget_get_window (widget); | ||
966 | 2910 | device_manager = gdk_display_get_device_manager (gdk_window_get_display (window)); | ||
967 | 2911 | device = gdk_x11_device_manager_lookup (device_manager, os_device_id); | ||
968 | 2912 | |||
969 | 2913 | /* Return FALSE if we don't recognize the device. */ | ||
970 | 2914 | if (!device) | ||
971 | 2915 | return FALSE; | ||
972 | 2916 | |||
973 | 2917 | /* Update the static os_input_source variable. */ | ||
974 | 2918 | os_input_source = gdk_device_get_source (device); | ||
975 | 2919 | } | ||
976 | 2920 | |||
977 | 2921 | /* Detect touch mode accordingly to the input source type. */ | ||
978 | 2922 | if (os_input_source == GDK_SOURCE_TOUCHSCREEN) | ||
979 | 2923 | return TRUE; | ||
980 | 2924 | else | ||
981 | 2925 | return FALSE; | ||
982 | 2926 | #else | ||
983 | 2927 | return scrollbar_mode == SCROLLBAR_MODE_OVERLAY_TOUCH; | 2627 | return scrollbar_mode == SCROLLBAR_MODE_OVERLAY_TOUCH; |
984 | 2928 | #endif | ||
985 | 2929 | } | 2628 | } |
986 | 2930 | 2629 | ||
987 | 2931 | /* Callback that shows the thumb if it's the case. */ | 2630 | /* Callback that shows the thumb if it's the case. */ |
988 | @@ -3028,192 +2727,134 @@ | |||
989 | 3028 | 2727 | ||
990 | 3029 | sourceid = 0; | 2728 | sourceid = 0; |
991 | 3030 | 2729 | ||
1097 | 3031 | #ifdef USE_GTK3 | 2730 | /* Deal with X core events, when apps (like rhythmbox), |
1098 | 3032 | if (xev->type == GenericEvent) | 2731 | * are using gdk_disable_miltidevice (). */ |
1099 | 3033 | { | 2732 | if (xev->type == ButtonPress) |
1100 | 3034 | /* Deal with XInput 2 events. */ | 2733 | os_xevent = OS_XEVENT_BUTTON_PRESS; |
1101 | 3035 | XIDeviceEvent *xiev; | 2734 | |
1102 | 3036 | 2735 | if (xev->type == ButtonRelease) | |
1103 | 3037 | xiev = xev->xcookie.data; | 2736 | { |
1104 | 3038 | 2737 | os_xevent = OS_XEVENT_BUTTON_RELEASE; | |
1105 | 3039 | sourceid = xiev->sourceid; | 2738 | event_x = xev->xbutton.x; |
1106 | 3040 | 2739 | event_y = xev->xbutton.y; | |
1107 | 3041 | if (xiev->evtype == XI_ButtonPress) | 2740 | } |
1108 | 3042 | os_xevent = OS_XEVENT_BUTTON_PRESS; | 2741 | |
1109 | 3043 | 2742 | if (xev->type == LeaveNotify) | |
1110 | 3044 | if (xiev->evtype == XI_ButtonRelease) | 2743 | os_xevent = OS_XEVENT_LEAVE; |
1111 | 3045 | { | 2744 | |
1112 | 3046 | os_xevent = OS_XEVENT_BUTTON_RELEASE; | 2745 | if (xev->type == MotionNotify) |
1113 | 3047 | event_x = xiev->event_x; | 2746 | { |
1114 | 3048 | event_y = xiev->event_y; | 2747 | os_xevent = OS_XEVENT_MOTION; |
1115 | 3049 | } | 2748 | event_x = xev->xmotion.x; |
1116 | 3050 | 2749 | event_y = xev->xmotion.y; | |
1117 | 3051 | if (xiev->evtype == XI_Leave) | 2750 | } |
1118 | 3052 | os_xevent = OS_XEVENT_LEAVE; | 2751 | |
1119 | 3053 | 2752 | if (os_xevent == OS_XEVENT_BUTTON_PRESS) | |
1120 | 3054 | if (xiev->evtype == XI_Motion) | 2753 | { |
1121 | 3055 | { | 2754 | priv->window_button_press = TRUE; |
1122 | 3056 | os_xevent = OS_XEVENT_MOTION; | 2755 | |
1123 | 3057 | event_x = xiev->event_x; | 2756 | if (priv->source_show_thumb_id != 0) |
1124 | 3058 | event_y = xiev->event_y; | 2757 | { |
1125 | 3059 | } | 2758 | g_source_remove (priv->source_show_thumb_id); |
1126 | 3060 | } | 2759 | priv->source_show_thumb_id = 0; |
1127 | 3061 | else | 2760 | } |
1128 | 3062 | { | 2761 | |
1129 | 3063 | #endif | 2762 | gtk_widget_hide (priv->thumb); |
1130 | 3064 | /* Deal with X core events, when apps (like rhythmbox), | 2763 | } |
1131 | 3065 | * are using gdk_disable_miltidevice (). */ | 2764 | |
1132 | 3066 | if (xev->type == ButtonPress) | 2765 | if (priv->window_button_press && os_xevent == OS_XEVENT_BUTTON_RELEASE) |
1133 | 3067 | os_xevent = OS_XEVENT_BUTTON_PRESS; | 2766 | { |
1134 | 3068 | 2767 | priv->window_button_press = FALSE; | |
1135 | 3069 | if (xev->type == ButtonRelease) | 2768 | |
1136 | 3070 | { | 2769 | /* Proximity area. */ |
1137 | 3071 | os_xevent = OS_XEVENT_BUTTON_RELEASE; | 2770 | if (check_proximity (scrollbar, event_x, event_y)) |
1138 | 3072 | event_x = xev->xbutton.x; | 2771 | { |
1139 | 3073 | event_y = xev->xbutton.y; | 2772 | priv->hidable_thumb = FALSE; |
1140 | 3074 | } | 2773 | |
1141 | 3075 | 2774 | adjust_thumb_position (scrollbar, event_x, event_y); | |
1142 | 3076 | if (xev->type == LeaveNotify) | 2775 | |
1143 | 3077 | os_xevent = OS_XEVENT_LEAVE; | 2776 | if (priv->state & OS_STATE_LOCKED) |
1144 | 3078 | 2777 | return GDK_FILTER_CONTINUE; | |
1145 | 3079 | if (xev->type == MotionNotify) | 2778 | |
1146 | 3080 | { | 2779 | if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned) |
1147 | 3081 | os_xevent = OS_XEVENT_MOTION; | 2780 | show_thumb (scrollbar); |
1148 | 3082 | event_x = xev->xmotion.x; | 2781 | } |
1149 | 3083 | event_y = xev->xmotion.y; | 2782 | } |
1150 | 3084 | } | 2783 | |
1151 | 3085 | #ifdef USE_GTK3 | 2784 | if (os_xevent == OS_XEVENT_LEAVE) |
1152 | 3086 | } | 2785 | { |
1153 | 3087 | #endif | 2786 | priv->window_button_press = FALSE; |
1154 | 3088 | 2787 | ||
1155 | 3089 | if (os_xevent == OS_XEVENT_BUTTON_PRESS) | 2788 | if (gtk_widget_get_mapped (priv->thumb) && |
1156 | 3090 | { | 2789 | !(priv->event & OS_EVENT_BUTTON_PRESS)) |
1157 | 3091 | priv->window_button_press = TRUE; | 2790 | { |
1158 | 3092 | 2791 | priv->hidable_thumb = TRUE; | |
1159 | 3093 | if (priv->source_show_thumb_id != 0) | 2792 | |
1160 | 3094 | { | 2793 | if (priv->source_hide_thumb_id != 0) |
1161 | 3095 | g_source_remove (priv->source_show_thumb_id); | 2794 | g_source_remove (priv->source_hide_thumb_id); |
1162 | 3096 | priv->source_show_thumb_id = 0; | 2795 | |
1163 | 3097 | } | 2796 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, |
1164 | 3098 | 2797 | hide_thumb_cb, | |
1165 | 3099 | gtk_widget_hide (priv->thumb); | 2798 | scrollbar); |
1166 | 3100 | } | 2799 | } |
1167 | 3101 | 2800 | ||
1168 | 3102 | if (priv->window_button_press && os_xevent == OS_XEVENT_BUTTON_RELEASE) | 2801 | if (priv->source_show_thumb_id != 0) |
1169 | 3103 | { | 2802 | { |
1170 | 3104 | priv->window_button_press = FALSE; | 2803 | g_source_remove (priv->source_show_thumb_id); |
1171 | 3105 | 2804 | priv->source_show_thumb_id = 0; | |
1172 | 3106 | /* Proximity area. */ | 2805 | } |
1173 | 3107 | if (check_proximity (scrollbar, event_x, event_y)) | 2806 | |
1174 | 3108 | { | 2807 | if (priv->source_unlock_thumb_id != 0) |
1175 | 3109 | priv->hidable_thumb = FALSE; | 2808 | g_source_remove (priv->source_unlock_thumb_id); |
1176 | 3110 | 2809 | ||
1177 | 3111 | adjust_thumb_position (scrollbar, event_x, event_y); | 2810 | priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, |
1178 | 3112 | 2811 | unlock_thumb_cb, | |
1179 | 3113 | if (priv->state & OS_STATE_LOCKED) | 2812 | scrollbar); |
1180 | 3114 | return GDK_FILTER_CONTINUE; | 2813 | } |
1181 | 3115 | 2814 | ||
1182 | 3116 | if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned) | 2815 | /* Get the motion_notify_event trough XEvent. */ |
1183 | 3117 | show_thumb (scrollbar); | 2816 | if (!priv->window_button_press && os_xevent == OS_XEVENT_MOTION) |
1184 | 3118 | } | 2817 | { |
1185 | 3119 | } | 2818 | /* Proximity area. */ |
1186 | 3120 | 2819 | if (check_proximity (scrollbar, event_x, event_y)) | |
1187 | 3121 | if (os_xevent == OS_XEVENT_LEAVE) | 2820 | { |
1188 | 3122 | { | 2821 | priv->hidable_thumb = FALSE; |
1189 | 3123 | priv->window_button_press = FALSE; | 2822 | |
1190 | 3124 | 2823 | if (priv->source_hide_thumb_id != 0) | |
1191 | 3125 | #ifdef USE_GTK3 | 2824 | { |
1192 | 3126 | /* Never deactivate the bar in an active window. */ | 2825 | g_source_remove (priv->source_hide_thumb_id); |
1193 | 3127 | if (!priv->active_window) | 2826 | priv->source_hide_thumb_id = 0; |
1194 | 3128 | { | 2827 | } |
1195 | 3129 | priv->deactivable_bar = TRUE; | 2828 | |
1196 | 3130 | 2829 | adjust_thumb_position (scrollbar, event_x, event_y); | |
1197 | 3131 | if (priv->source_deactivate_bar_id != 0) | 2830 | |
1198 | 3132 | g_source_remove (priv->source_deactivate_bar_id); | 2831 | if (priv->state & OS_STATE_LOCKED) |
1199 | 3133 | 2832 | return GDK_FILTER_CONTINUE; | |
1200 | 3134 | priv->source_deactivate_bar_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, | 2833 | |
1201 | 3135 | deactivate_bar_cb, | 2834 | if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned) |
1202 | 2835 | show_thumb (scrollbar); | ||
1203 | 2836 | } | ||
1204 | 2837 | else | ||
1205 | 2838 | { | ||
1206 | 2839 | priv->state &= ~(OS_STATE_LOCKED); | ||
1207 | 2840 | |||
1208 | 2841 | if (priv->source_show_thumb_id != 0) | ||
1209 | 2842 | { | ||
1210 | 2843 | g_source_remove (priv->source_show_thumb_id); | ||
1211 | 2844 | priv->source_show_thumb_id = 0; | ||
1212 | 2845 | } | ||
1213 | 2846 | |||
1214 | 2847 | if (gtk_widget_get_mapped (priv->thumb) && | ||
1215 | 2848 | !(priv->event & OS_EVENT_BUTTON_PRESS)) | ||
1216 | 2849 | { | ||
1217 | 2850 | priv->hidable_thumb = TRUE; | ||
1218 | 2851 | |||
1219 | 2852 | if (priv->source_hide_thumb_id == 0) | ||
1220 | 2853 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE, | ||
1221 | 2854 | hide_thumb_cb, | ||
1222 | 3136 | scrollbar); | 2855 | scrollbar); |
1303 | 3137 | } | 2856 | } |
1304 | 3138 | #endif | 2857 | } |
1225 | 3139 | |||
1226 | 3140 | if (gtk_widget_get_mapped (priv->thumb) && | ||
1227 | 3141 | !(priv->event & OS_EVENT_BUTTON_PRESS)) | ||
1228 | 3142 | { | ||
1229 | 3143 | priv->hidable_thumb = TRUE; | ||
1230 | 3144 | |||
1231 | 3145 | if (priv->source_hide_thumb_id != 0) | ||
1232 | 3146 | g_source_remove (priv->source_hide_thumb_id); | ||
1233 | 3147 | |||
1234 | 3148 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, | ||
1235 | 3149 | hide_thumb_cb, | ||
1236 | 3150 | scrollbar); | ||
1237 | 3151 | } | ||
1238 | 3152 | |||
1239 | 3153 | if (priv->source_show_thumb_id != 0) | ||
1240 | 3154 | { | ||
1241 | 3155 | g_source_remove (priv->source_show_thumb_id); | ||
1242 | 3156 | priv->source_show_thumb_id = 0; | ||
1243 | 3157 | } | ||
1244 | 3158 | |||
1245 | 3159 | if (priv->source_unlock_thumb_id != 0) | ||
1246 | 3160 | g_source_remove (priv->source_unlock_thumb_id); | ||
1247 | 3161 | |||
1248 | 3162 | priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, | ||
1249 | 3163 | unlock_thumb_cb, | ||
1250 | 3164 | scrollbar); | ||
1251 | 3165 | } | ||
1252 | 3166 | |||
1253 | 3167 | /* Get the motion_notify_event trough XEvent. */ | ||
1254 | 3168 | if (!priv->window_button_press && os_xevent == OS_XEVENT_MOTION) | ||
1255 | 3169 | { | ||
1256 | 3170 | #ifdef USE_GTK3 | ||
1257 | 3171 | /* React to motion_notify_event | ||
1258 | 3172 | * and set the state accordingly. */ | ||
1259 | 3173 | if (!is_insensitive (scrollbar) && !priv->active_window) | ||
1260 | 3174 | bar_set_state_from_pointer (scrollbar, event_x, event_y); | ||
1261 | 3175 | #endif | ||
1262 | 3176 | |||
1263 | 3177 | /* Proximity area. */ | ||
1264 | 3178 | if (check_proximity (scrollbar, event_x, event_y)) | ||
1265 | 3179 | { | ||
1266 | 3180 | priv->hidable_thumb = FALSE; | ||
1267 | 3181 | |||
1268 | 3182 | if (priv->source_hide_thumb_id != 0) | ||
1269 | 3183 | { | ||
1270 | 3184 | g_source_remove (priv->source_hide_thumb_id); | ||
1271 | 3185 | priv->source_hide_thumb_id = 0; | ||
1272 | 3186 | } | ||
1273 | 3187 | |||
1274 | 3188 | adjust_thumb_position (scrollbar, event_x, event_y); | ||
1275 | 3189 | |||
1276 | 3190 | if (priv->state & OS_STATE_LOCKED) | ||
1277 | 3191 | return GDK_FILTER_CONTINUE; | ||
1278 | 3192 | |||
1279 | 3193 | if (!is_touch_mode (GTK_WIDGET (scrollbar), sourceid) && !priv->resizing_paned) | ||
1280 | 3194 | show_thumb (scrollbar); | ||
1281 | 3195 | } | ||
1282 | 3196 | else | ||
1283 | 3197 | { | ||
1284 | 3198 | priv->state &= ~(OS_STATE_LOCKED); | ||
1285 | 3199 | |||
1286 | 3200 | if (priv->source_show_thumb_id != 0) | ||
1287 | 3201 | { | ||
1288 | 3202 | g_source_remove (priv->source_show_thumb_id); | ||
1289 | 3203 | priv->source_show_thumb_id = 0; | ||
1290 | 3204 | } | ||
1291 | 3205 | |||
1292 | 3206 | if (gtk_widget_get_mapped (priv->thumb) && | ||
1293 | 3207 | !(priv->event & OS_EVENT_BUTTON_PRESS)) | ||
1294 | 3208 | { | ||
1295 | 3209 | priv->hidable_thumb = TRUE; | ||
1296 | 3210 | |||
1297 | 3211 | if (priv->source_hide_thumb_id == 0) | ||
1298 | 3212 | priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_PROXIMITY_HIDE, | ||
1299 | 3213 | hide_thumb_cb, | ||
1300 | 3214 | scrollbar); | ||
1301 | 3215 | } | ||
1302 | 3216 | } | ||
1305 | 3217 | } | 2858 | } |
1306 | 3218 | } | 2859 | } |
1307 | 3219 | 2860 | ||
1308 | @@ -3261,11 +2902,7 @@ | |||
1309 | 3261 | static gboolean | 2902 | static gboolean |
1310 | 3262 | use_overlay_scrollbar (void) | 2903 | use_overlay_scrollbar (void) |
1311 | 3263 | { | 2904 | { |
1312 | 3264 | #ifdef USE_GTK3 | ||
1313 | 3265 | return scrollbar_mode != SCROLLBAR_MODE_NORMAL; | ||
1314 | 3266 | #else | ||
1315 | 3267 | return scrollbar_mode != SCROLLBAR_MODE_NORMAL && ubuntu_gtk_get_use_overlay_scrollbar (); | 2905 | return scrollbar_mode != SCROLLBAR_MODE_NORMAL && ubuntu_gtk_get_use_overlay_scrollbar (); |
1316 | 3268 | #endif | ||
1317 | 3269 | } | 2906 | } |
1318 | 3270 | 2907 | ||
1319 | 3271 | static void | 2908 | static void |
1320 | @@ -3345,17 +2982,6 @@ | |||
1321 | 3345 | (* pre_hijacked_scrollbar_dispose) (object); | 2982 | (* pre_hijacked_scrollbar_dispose) (object); |
1322 | 3346 | } | 2983 | } |
1323 | 3347 | 2984 | ||
1324 | 3348 | #ifdef USE_GTK3 | ||
1325 | 3349 | static gboolean | ||
1326 | 3350 | hijacked_scrollbar_draw (GtkWidget *widget, | ||
1327 | 3351 | cairo_t *cr) | ||
1328 | 3352 | { | ||
1329 | 3353 | if (use_overlay_scrollbar ()) | ||
1330 | 3354 | return TRUE; | ||
1331 | 3355 | |||
1332 | 3356 | return (* pre_hijacked_scrollbar_draw) (widget, cr); | ||
1333 | 3357 | } | ||
1334 | 3358 | #else | ||
1335 | 3359 | static gboolean | 2985 | static gboolean |
1336 | 3360 | hijacked_scrollbar_expose_event (GtkWidget *widget, | 2986 | hijacked_scrollbar_expose_event (GtkWidget *widget, |
1337 | 3361 | GdkEventExpose *event) | 2987 | GdkEventExpose *event) |
1338 | @@ -3365,59 +2991,6 @@ | |||
1339 | 3365 | 2991 | ||
1340 | 3366 | return (* pre_hijacked_scrollbar_expose_event) (widget, event); | 2992 | return (* pre_hijacked_scrollbar_expose_event) (widget, event); |
1341 | 3367 | } | 2993 | } |
1342 | 3368 | #endif | ||
1343 | 3369 | |||
1344 | 3370 | #ifdef USE_GTK3 | ||
1345 | 3371 | static void | ||
1346 | 3372 | hijacked_scrollbar_get_preferred_width (GtkWidget *widget, | ||
1347 | 3373 | gint *minimal_width, | ||
1348 | 3374 | gint *natural_width) | ||
1349 | 3375 | { | ||
1350 | 3376 | if (use_overlay_scrollbar ()) | ||
1351 | 3377 | { | ||
1352 | 3378 | OsScrollbarPrivate *priv; | ||
1353 | 3379 | |||
1354 | 3380 | priv = get_private (widget); | ||
1355 | 3381 | |||
1356 | 3382 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) | ||
1357 | 3383 | *minimal_width = *natural_width = 0; | ||
1358 | 3384 | else | ||
1359 | 3385 | { | ||
1360 | 3386 | *minimal_width = MIN_THUMB_HEIGHT; | ||
1361 | 3387 | *natural_width = THUMB_HEIGHT; | ||
1362 | 3388 | } | ||
1363 | 3389 | |||
1364 | 3390 | return; | ||
1365 | 3391 | } | ||
1366 | 3392 | |||
1367 | 3393 | (* pre_hijacked_scrollbar_get_preferred_width) (widget, minimal_width, natural_width); | ||
1368 | 3394 | } | ||
1369 | 3395 | |||
1370 | 3396 | static void | ||
1371 | 3397 | hijacked_scrollbar_get_preferred_height (GtkWidget *widget, | ||
1372 | 3398 | gint *minimal_height, | ||
1373 | 3399 | gint *natural_height) | ||
1374 | 3400 | { | ||
1375 | 3401 | if (use_overlay_scrollbar ()) | ||
1376 | 3402 | { | ||
1377 | 3403 | OsScrollbarPrivate *priv; | ||
1378 | 3404 | |||
1379 | 3405 | priv = get_private (widget); | ||
1380 | 3406 | |||
1381 | 3407 | if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) | ||
1382 | 3408 | *minimal_height = *natural_height = 0; | ||
1383 | 3409 | else | ||
1384 | 3410 | { | ||
1385 | 3411 | *minimal_height = MIN_THUMB_HEIGHT; | ||
1386 | 3412 | *natural_height = THUMB_HEIGHT; | ||
1387 | 3413 | } | ||
1388 | 3414 | |||
1389 | 3415 | return; | ||
1390 | 3416 | } | ||
1391 | 3417 | |||
1392 | 3418 | (* pre_hijacked_scrollbar_get_preferred_height) (widget, minimal_height, natural_height); | ||
1393 | 3419 | } | ||
1394 | 3420 | #endif | ||
1395 | 3421 | 2994 | ||
1396 | 3422 | static void | 2995 | static void |
1397 | 3423 | hijacked_scrollbar_grab_notify (GtkWidget *widget, | 2996 | hijacked_scrollbar_grab_notify (GtkWidget *widget, |
1398 | @@ -3442,15 +3015,6 @@ | |||
1399 | 3442 | (* pre_hijacked_scrollbar_hide) (widget); | 3015 | (* pre_hijacked_scrollbar_hide) (widget); |
1400 | 3443 | } | 3016 | } |
1401 | 3444 | 3017 | ||
1402 | 3445 | #ifdef USE_GTK3 | ||
1403 | 3446 | /* Return TRUE if the widget is in backdrop window. */ | ||
1404 | 3447 | static gboolean | ||
1405 | 3448 | is_backdrop_window (GtkWidget *widget) | ||
1406 | 3449 | { | ||
1407 | 3450 | return (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_BACKDROP) != 0; | ||
1408 | 3451 | } | ||
1409 | 3452 | #endif | ||
1410 | 3453 | |||
1411 | 3454 | static void | 3018 | static void |
1412 | 3455 | hijacked_scrollbar_map (GtkWidget *widget) | 3019 | hijacked_scrollbar_map (GtkWidget *widget) |
1413 | 3456 | { | 3020 | { |
1414 | @@ -3464,46 +3028,6 @@ | |||
1415 | 3464 | 3028 | ||
1416 | 3465 | (* widget_class_map) (widget); | 3029 | (* widget_class_map) (widget); |
1417 | 3466 | 3030 | ||
1418 | 3467 | #ifdef USE_GTK3 | ||
1419 | 3468 | /* On map, check for the active window. */ | ||
1420 | 3469 | if (!is_backdrop_window (GTK_WIDGET (scrollbar))) | ||
1421 | 3470 | { | ||
1422 | 3471 | /* Stops potential running timeout. */ | ||
1423 | 3472 | if (priv->source_deactivate_bar_id != 0) | ||
1424 | 3473 | { | ||
1425 | 3474 | g_source_remove (priv->source_deactivate_bar_id); | ||
1426 | 3475 | priv->source_deactivate_bar_id = 0; | ||
1427 | 3476 | } | ||
1428 | 3477 | |||
1429 | 3478 | priv->active_window = TRUE; | ||
1430 | 3479 | } | ||
1431 | 3480 | else | ||
1432 | 3481 | priv->active_window = FALSE; | ||
1433 | 3482 | |||
1434 | 3483 | if (!is_insensitive (scrollbar)) | ||
1435 | 3484 | { | ||
1436 | 3485 | if (!priv->active_window) | ||
1437 | 3486 | { | ||
1438 | 3487 | gint x, y; | ||
1439 | 3488 | |||
1440 | 3489 | window_get_pointer (gtk_widget_get_window (widget), &x, &y, NULL); | ||
1441 | 3490 | |||
1442 | 3491 | /* When the scrollbar appears on screen (mapped), | ||
1443 | 3492 | * for example when switching notebook page, | ||
1444 | 3493 | * check the position of the pointer | ||
1445 | 3494 | * and set the state accordingly. */ | ||
1446 | 3495 | bar_set_state_from_pointer (scrollbar, x, y); | ||
1447 | 3496 | } | ||
1448 | 3497 | else | ||
1449 | 3498 | { | ||
1450 | 3499 | /* On map-event of an active window, | ||
1451 | 3500 | * the bar should be active. */ | ||
1452 | 3501 | priv->deactivable_bar = FALSE; | ||
1453 | 3502 | os_bar_set_active (priv->bar, TRUE, FALSE); | ||
1454 | 3503 | } | ||
1455 | 3504 | } | ||
1456 | 3505 | #endif | ||
1457 | 3506 | |||
1458 | 3507 | if (!(priv->state & OS_STATE_FULLSIZE)) | 3031 | if (!(priv->state & OS_STATE_FULLSIZE)) |
1459 | 3508 | os_bar_show (priv->bar); | 3032 | os_bar_show (priv->bar); |
1460 | 3509 | 3033 | ||
1461 | @@ -3810,10 +3334,6 @@ | |||
1462 | 3810 | priv->filter.proximity = FALSE; | 3334 | priv->filter.proximity = FALSE; |
1463 | 3811 | remove_window_filter (scrollbar); | 3335 | remove_window_filter (scrollbar); |
1464 | 3812 | 3336 | ||
1465 | 3813 | #ifdef USE_GTK3 | ||
1466 | 3814 | os_bar_set_active (priv->bar, FALSE, FALSE); | ||
1467 | 3815 | #endif | ||
1468 | 3816 | |||
1469 | 3817 | gtk_widget_hide (priv->thumb); | 3337 | gtk_widget_hide (priv->thumb); |
1470 | 3818 | } | 3338 | } |
1471 | 3819 | 3339 | ||
1472 | @@ -3833,124 +3353,8 @@ | |||
1473 | 3833 | priv->filter.proximity = TRUE; | 3353 | priv->filter.proximity = TRUE; |
1474 | 3834 | add_window_filter (scrollbar); | 3354 | add_window_filter (scrollbar); |
1475 | 3835 | } | 3355 | } |
1594 | 3836 | 3356 | } | |
1595 | 3837 | #ifdef USE_GTK3 | 3357 | |
1478 | 3838 | if (priv->active_window) | ||
1479 | 3839 | os_bar_set_active (priv->bar, TRUE, FALSE); | ||
1480 | 3840 | else if (gtk_widget_get_realized (GTK_WIDGET (scrollbar))) | ||
1481 | 3841 | { | ||
1482 | 3842 | gint x, y; | ||
1483 | 3843 | |||
1484 | 3844 | window_get_pointer (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x, &y, NULL); | ||
1485 | 3845 | |||
1486 | 3846 | /* When the window is unfocused, | ||
1487 | 3847 | * check the position of the pointer | ||
1488 | 3848 | * and set the state accordingly. */ | ||
1489 | 3849 | bar_set_state_from_pointer (scrollbar, x, y); | ||
1490 | 3850 | } | ||
1491 | 3851 | #endif | ||
1492 | 3852 | } | ||
1493 | 3853 | |||
1494 | 3854 | #ifdef USE_GTK3 | ||
1495 | 3855 | /* React on active window changes. */ | ||
1496 | 3856 | static void | ||
1497 | 3857 | backdrop_state_flag_changed (GtkScrollbar *scrollbar) | ||
1498 | 3858 | { | ||
1499 | 3859 | OsScrollbarPrivate *priv; | ||
1500 | 3860 | |||
1501 | 3861 | priv = get_private (GTK_WIDGET (scrollbar)); | ||
1502 | 3862 | |||
1503 | 3863 | OS_DCHECK (scrollbar != NULL); | ||
1504 | 3864 | |||
1505 | 3865 | /* Return if the scrollbar is insensitive. */ | ||
1506 | 3866 | if (is_insensitive (scrollbar)) | ||
1507 | 3867 | return; | ||
1508 | 3868 | |||
1509 | 3869 | if (gtk_widget_get_mapped (GTK_WIDGET (scrollbar))) | ||
1510 | 3870 | { | ||
1511 | 3871 | if (!is_backdrop_window (GTK_WIDGET (scrollbar))) | ||
1512 | 3872 | { | ||
1513 | 3873 | /* Stops potential running timeout. */ | ||
1514 | 3874 | if (priv->source_deactivate_bar_id != 0) | ||
1515 | 3875 | { | ||
1516 | 3876 | g_source_remove (priv->source_deactivate_bar_id); | ||
1517 | 3877 | priv->source_deactivate_bar_id = 0; | ||
1518 | 3878 | } | ||
1519 | 3879 | |||
1520 | 3880 | priv->active_window = TRUE; | ||
1521 | 3881 | |||
1522 | 3882 | priv->deactivable_bar = FALSE; | ||
1523 | 3883 | os_bar_set_active (priv->bar, TRUE, TRUE); | ||
1524 | 3884 | } | ||
1525 | 3885 | else if (priv->active_window) | ||
1526 | 3886 | { | ||
1527 | 3887 | GdkWindow *parent; | ||
1528 | 3888 | GdkWindow *window; | ||
1529 | 3889 | const gint64 current_time = g_get_monotonic_time (); | ||
1530 | 3890 | const gint64 end_time = priv->present_time + TIMEOUT_PRESENT_WINDOW * 1000; | ||
1531 | 3891 | |||
1532 | 3892 | priv->active_window = FALSE; | ||
1533 | 3893 | |||
1534 | 3894 | /* Loop through parent windows until it reaches | ||
1535 | 3895 | * either an unknown GdkWindow (NULL), | ||
1536 | 3896 | * or the toplevel window. */ | ||
1537 | 3897 | window = gtk_widget_get_window (GTK_WIDGET (scrollbar)); | ||
1538 | 3898 | parent = window_at_pointer (window, NULL, NULL); | ||
1539 | 3899 | while (parent != NULL) | ||
1540 | 3900 | { | ||
1541 | 3901 | if (window == parent) | ||
1542 | 3902 | break; | ||
1543 | 3903 | |||
1544 | 3904 | parent = gdk_window_get_parent (parent); | ||
1545 | 3905 | } | ||
1546 | 3906 | |||
1547 | 3907 | if (parent != NULL) | ||
1548 | 3908 | { | ||
1549 | 3909 | gint x, y; | ||
1550 | 3910 | |||
1551 | 3911 | window_get_pointer (window, &x, &y, NULL); | ||
1552 | 3912 | |||
1553 | 3913 | /* When the window is unfocused, | ||
1554 | 3914 | * check the position of the pointer | ||
1555 | 3915 | * and set the state accordingly. */ | ||
1556 | 3916 | bar_set_state_from_pointer (scrollbar, x, y); | ||
1557 | 3917 | } | ||
1558 | 3918 | else | ||
1559 | 3919 | { | ||
1560 | 3920 | /* If the pointer is outside of the window, set it inactive. */ | ||
1561 | 3921 | priv->deactivable_bar = TRUE; | ||
1562 | 3922 | os_bar_set_active (priv->bar, FALSE, TRUE); | ||
1563 | 3923 | } | ||
1564 | 3924 | |||
1565 | 3925 | if ((current_time > end_time) && priv->thumb != NULL) | ||
1566 | 3926 | gtk_widget_hide (priv->thumb); | ||
1567 | 3927 | } | ||
1568 | 3928 | } | ||
1569 | 3929 | } | ||
1570 | 3930 | |||
1571 | 3931 | static void | ||
1572 | 3932 | hijacked_scrollbar_state_flags_changed (GtkWidget *widget, | ||
1573 | 3933 | GtkStateFlags flags) | ||
1574 | 3934 | { | ||
1575 | 3935 | GtkScrollbar *scrollbar; | ||
1576 | 3936 | |||
1577 | 3937 | scrollbar = GTK_SCROLLBAR (widget); | ||
1578 | 3938 | |||
1579 | 3939 | if ((flags & GTK_STATE_FLAG_BACKDROP) != | ||
1580 | 3940 | (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_BACKDROP)) | ||
1581 | 3941 | backdrop_state_flag_changed (scrollbar); | ||
1582 | 3942 | |||
1583 | 3943 | /* Only set the new state if the right bit changed. */ | ||
1584 | 3944 | if ((flags & GTK_STATE_FLAG_INSENSITIVE) != | ||
1585 | 3945 | (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE)) | ||
1586 | 3946 | { | ||
1587 | 3947 | if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE) != 0) | ||
1588 | 3948 | set_insensitive (scrollbar); | ||
1589 | 3949 | else | ||
1590 | 3950 | set_sensitive (scrollbar); | ||
1591 | 3951 | } | ||
1592 | 3952 | } | ||
1593 | 3953 | #else | ||
1596 | 3954 | static void | 3358 | static void |
1597 | 3955 | hijacked_scrollbar_size_request (GtkWidget *widget, | 3359 | hijacked_scrollbar_size_request (GtkWidget *widget, |
1598 | 3956 | GtkRequisition *requisition) | 3360 | GtkRequisition *requisition) |
1599 | @@ -3994,7 +3398,6 @@ | |||
1600 | 3994 | 3398 | ||
1601 | 3995 | (* pre_hijacked_scrollbar_state_changed) (widget, state); | 3399 | (* pre_hijacked_scrollbar_state_changed) (widget, state); |
1602 | 3996 | } | 3400 | } |
1603 | 3997 | #endif | ||
1604 | 3998 | 3401 | ||
1605 | 3999 | static void | 3402 | static void |
1606 | 4000 | hijacked_scrollbar_unmap (GtkWidget *widget) | 3403 | hijacked_scrollbar_unmap (GtkWidget *widget) |
1607 | @@ -4151,23 +3554,12 @@ | |||
1608 | 4151 | if (object_class->dispose == pre_hijacked_scrollbar_dispose) | 3554 | if (object_class->dispose == pre_hijacked_scrollbar_dispose) |
1609 | 4152 | object_class->dispose = hijacked_scrollbar_dispose; | 3555 | object_class->dispose = hijacked_scrollbar_dispose; |
1610 | 4153 | 3556 | ||
1611 | 4154 | #ifdef USE_GTK3 | ||
1612 | 4155 | if (widget_class->draw == pre_hijacked_scrollbar_draw) | ||
1613 | 4156 | widget_class->draw = hijacked_scrollbar_draw; | ||
1614 | 4157 | if (widget_class->get_preferred_width == pre_hijacked_scrollbar_get_preferred_width) | ||
1615 | 4158 | widget_class->get_preferred_width = hijacked_scrollbar_get_preferred_width; | ||
1616 | 4159 | if (widget_class->get_preferred_height == pre_hijacked_scrollbar_get_preferred_height) | ||
1617 | 4160 | widget_class->get_preferred_height = hijacked_scrollbar_get_preferred_height; | ||
1618 | 4161 | if (widget_class->state_flags_changed == pre_hijacked_scrollbar_state_flags_changed) | ||
1619 | 4162 | widget_class->state_flags_changed = hijacked_scrollbar_state_flags_changed; | ||
1620 | 4163 | #else | ||
1621 | 4164 | if (widget_class->expose_event == pre_hijacked_scrollbar_expose_event) | 3557 | if (widget_class->expose_event == pre_hijacked_scrollbar_expose_event) |
1622 | 4165 | widget_class->expose_event = hijacked_scrollbar_expose_event; | 3558 | widget_class->expose_event = hijacked_scrollbar_expose_event; |
1623 | 4166 | if (widget_class->size_request == pre_hijacked_scrollbar_size_request) | 3559 | if (widget_class->size_request == pre_hijacked_scrollbar_size_request) |
1624 | 4167 | widget_class->size_request = hijacked_scrollbar_size_request; | 3560 | widget_class->size_request = hijacked_scrollbar_size_request; |
1625 | 4168 | if (widget_class->state_changed == pre_hijacked_scrollbar_state_changed) | 3561 | if (widget_class->state_changed == pre_hijacked_scrollbar_state_changed) |
1626 | 4169 | widget_class->state_changed = hijacked_scrollbar_state_changed; | 3562 | widget_class->state_changed = hijacked_scrollbar_state_changed; |
1627 | 4170 | #endif | ||
1628 | 4171 | if (pre_hijacked_scrollbar_grab_notify && | 3563 | if (pre_hijacked_scrollbar_grab_notify && |
1629 | 4172 | widget_class->grab_notify == pre_hijacked_scrollbar_grab_notify) | 3564 | widget_class->grab_notify == pre_hijacked_scrollbar_grab_notify) |
1630 | 4173 | widget_class->grab_notify = hijacked_scrollbar_grab_notify; | 3565 | widget_class->grab_notify = hijacked_scrollbar_grab_notify; |
1631 | @@ -4197,29 +3589,13 @@ | |||
1632 | 4197 | static void | 3589 | static void |
1633 | 4198 | custom_style_load (void) | 3590 | custom_style_load (void) |
1634 | 4199 | { | 3591 | { |
1635 | 4200 | #ifdef USE_GTK3 | ||
1636 | 4201 | gtk_style_context_add_provider_for_screen (gdk_display_get_default_screen (gdk_display_get_default ()), | ||
1637 | 4202 | GTK_STYLE_PROVIDER (provider), | ||
1638 | 4203 | GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); | ||
1639 | 4204 | #else | ||
1640 | 4205 | gtk_rc_parse_string ("style \"overlay-scrollbar\" {\n" | 3592 | gtk_rc_parse_string ("style \"overlay-scrollbar\" {\n" |
1641 | 4206 | " GtkScrolledWindow::scrollbar-spacing = 0\n" | 3593 | " GtkScrolledWindow::scrollbar-spacing = 0\n" |
1642 | 4207 | " GtkScrolledWindow::scrollbars-within-bevel = 1\n" | 3594 | " GtkScrolledWindow::scrollbars-within-bevel = 1\n" |
1643 | 4208 | " }\n" | 3595 | " }\n" |
1644 | 4209 | "\n" | 3596 | "\n" |
1645 | 4210 | "class \"GtkScrolledWindow\" style \"overlay-scrollbar\""); | 3597 | "class \"GtkScrolledWindow\" style \"overlay-scrollbar\""); |
1658 | 4211 | #endif | 3598 | } |
1647 | 4212 | } | ||
1648 | 4213 | |||
1649 | 4214 | #ifdef USE_GTK3 | ||
1650 | 4215 | /* Unload custom style for overlay scrollbar. */ | ||
1651 | 4216 | static void | ||
1652 | 4217 | custom_style_unload (void) | ||
1653 | 4218 | { | ||
1654 | 4219 | gtk_style_context_remove_provider_for_screen (gdk_display_get_default_screen (gdk_display_get_default ()), | ||
1655 | 4220 | GTK_STYLE_PROVIDER (provider)); | ||
1656 | 4221 | } | ||
1657 | 4222 | #endif | ||
1659 | 4223 | 3599 | ||
1660 | 4224 | /* Unload all scrollbars. */ | 3600 | /* Unload all scrollbars. */ |
1661 | 4225 | static void | 3601 | static void |
1662 | @@ -4287,17 +3663,9 @@ | |||
1663 | 4287 | /* Update the scrollbar_mode variable. */ | 3663 | /* Update the scrollbar_mode variable. */ |
1664 | 4288 | scrollbar_mode = g_settings_get_enum (settings, "scrollbar-mode"); | 3664 | scrollbar_mode = g_settings_get_enum (settings, "scrollbar-mode"); |
1665 | 4289 | 3665 | ||
1666 | 4290 | #ifdef USE_GTK3 | ||
1667 | 4291 | /* Load or unload custom style for overlay scrollbar. */ | ||
1668 | 4292 | if (use_overlay_scrollbar ()) | ||
1669 | 4293 | custom_style_load (); | ||
1670 | 4294 | else | ||
1671 | 4295 | custom_style_unload (); | ||
1672 | 4296 | #else | ||
1673 | 4297 | /* Gtk+ 2.0 doesn't support dynamic loading of styles. | 3666 | /* Gtk+ 2.0 doesn't support dynamic loading of styles. |
1674 | 4298 | * Please contact me in case I'm wrong, | 3667 | * Please contact me in case I'm wrong, |
1675 | 4299 | * and I'll add the required bits here. */ | 3668 | * and I'll add the required bits here. */ |
1676 | 4300 | #endif | ||
1677 | 4301 | 3669 | ||
1678 | 4302 | /* Load all scrollbars, using new scrollbar_mode. */ | 3670 | /* Load all scrollbars, using new scrollbar_mode. */ |
1679 | 4303 | g_slist_foreach (tmp_list, scrollbar_mode_changed_load_gfunc, NULL); | 3671 | g_slist_foreach (tmp_list, scrollbar_mode_changed_load_gfunc, NULL); |
1680 | @@ -4323,12 +3691,6 @@ | |||
1681 | 4323 | if (app_is_blacklisted ()) | 3691 | if (app_is_blacklisted ()) |
1682 | 4324 | return; | 3692 | return; |
1683 | 4325 | 3693 | ||
1684 | 4326 | /* We only support X11 */ | ||
1685 | 4327 | #if GTK_MAJOR_VERSION == 3 | ||
1686 | 4328 | if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ())) | ||
1687 | 4329 | return; | ||
1688 | 4330 | #endif | ||
1689 | 4331 | |||
1690 | 4332 | /* Initialize static variables. */ | 3694 | /* Initialize static variables. */ |
1691 | 4333 | net_active_window_atom = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW"); | 3695 | net_active_window_atom = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW"); |
1692 | 4334 | unity_net_workarea_region_atom = gdk_x11_get_xatom_by_name ("_UNITY_NET_WORKAREA_REGION"); | 3696 | unity_net_workarea_region_atom = gdk_x11_get_xatom_by_name ("_UNITY_NET_WORKAREA_REGION"); |
1693 | @@ -4341,16 +3703,9 @@ | |||
1694 | 4341 | 3703 | ||
1695 | 4342 | pre_hijacked_scrollbar_dispose = object_class->dispose; | 3704 | pre_hijacked_scrollbar_dispose = object_class->dispose; |
1696 | 4343 | 3705 | ||
1697 | 4344 | #ifdef USE_GTK3 | ||
1698 | 4345 | pre_hijacked_scrollbar_draw = widget_class->draw; | ||
1699 | 4346 | pre_hijacked_scrollbar_get_preferred_width = widget_class->get_preferred_width; | ||
1700 | 4347 | pre_hijacked_scrollbar_get_preferred_height = widget_class->get_preferred_height; | ||
1701 | 4348 | pre_hijacked_scrollbar_state_flags_changed = widget_class->state_flags_changed; | ||
1702 | 4349 | #else | ||
1703 | 4350 | pre_hijacked_scrollbar_expose_event = widget_class->expose_event; | 3706 | pre_hijacked_scrollbar_expose_event = widget_class->expose_event; |
1704 | 4351 | pre_hijacked_scrollbar_size_request = widget_class->size_request; | 3707 | pre_hijacked_scrollbar_size_request = widget_class->size_request; |
1705 | 4352 | pre_hijacked_scrollbar_state_changed = widget_class->state_changed; | 3708 | pre_hijacked_scrollbar_state_changed = widget_class->state_changed; |
1706 | 4353 | #endif | ||
1707 | 4354 | pre_hijacked_scrollbar_grab_notify = widget_class->grab_notify; | 3709 | pre_hijacked_scrollbar_grab_notify = widget_class->grab_notify; |
1708 | 4355 | pre_hijacked_scrollbar_hide = widget_class->hide; | 3710 | pre_hijacked_scrollbar_hide = widget_class->hide; |
1709 | 4356 | pre_hijacked_scrollbar_map = widget_class->map; | 3711 | pre_hijacked_scrollbar_map = widget_class->map; |
1710 | @@ -4379,19 +3734,7 @@ | |||
1711 | 4379 | G_CALLBACK (scrollbar_mode_changed_cb), NULL); | 3734 | G_CALLBACK (scrollbar_mode_changed_cb), NULL); |
1712 | 4380 | scrollbar_mode = g_settings_get_enum (settings, "scrollbar-mode"); | 3735 | scrollbar_mode = g_settings_get_enum (settings, "scrollbar-mode"); |
1713 | 4381 | 3736 | ||
1714 | 4382 | #ifdef USE_GTK3 | ||
1715 | 4383 | /* Initialize styling bits. */ | ||
1716 | 4384 | provider = gtk_css_provider_new (); | ||
1717 | 4385 | gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), | ||
1718 | 4386 | "* {\n" | ||
1719 | 4387 | " -GtkScrolledWindow-scrollbar-spacing: 0;\n" | ||
1720 | 4388 | " -GtkScrolledWindow-scrollbars-within-bevel: 1;\n" | ||
1721 | 4389 | "}\n", -1, NULL); | ||
1722 | 4390 | #endif | ||
1723 | 4391 | |||
1724 | 4392 | #ifndef USE_GTK3 | ||
1725 | 4393 | ubuntu_gtk_set_use_overlay_scrollbar (TRUE); | 3737 | ubuntu_gtk_set_use_overlay_scrollbar (TRUE); |
1726 | 4394 | #endif | ||
1727 | 4395 | 3738 | ||
1728 | 4396 | /* Load custom overlay scrollbar style. */ | 3739 | /* Load custom overlay scrollbar style. */ |
1729 | 4397 | if (use_overlay_scrollbar ()) | 3740 | if (use_overlay_scrollbar ()) |
1730 | 4398 | 3741 | ||
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 | 40 | /* Number of tolerance pixels, before hiding the thumb. */ | 40 | /* Number of tolerance pixels, before hiding the thumb. */ |
1736 | 41 | #define TOLERANCE_FADE 3 | 41 | #define TOLERANCE_FADE 3 |
1737 | 42 | 42 | ||
1738 | 43 | #ifndef USE_GTK3 | ||
1739 | 44 | typedef struct { | 43 | typedef struct { |
1740 | 45 | gdouble red; | 44 | gdouble red; |
1741 | 46 | gdouble green; | 45 | gdouble green; |
1742 | 47 | gdouble blue; | 46 | gdouble blue; |
1743 | 48 | gdouble alpha; | 47 | gdouble alpha; |
1744 | 49 | } GdkRGBA; | 48 | } GdkRGBA; |
1745 | 50 | #endif | ||
1746 | 51 | 49 | ||
1747 | 52 | struct _OsThumbPrivate { | 50 | struct _OsThumbPrivate { |
1748 | 53 | GtkOrientation orientation; | 51 | GtkOrientation orientation; |
1749 | @@ -71,11 +69,7 @@ | |||
1750 | 71 | static gboolean os_thumb_button_press_event (GtkWidget *widget, GdkEventButton *event); | 69 | static gboolean os_thumb_button_press_event (GtkWidget *widget, GdkEventButton *event); |
1751 | 72 | static gboolean os_thumb_button_release_event (GtkWidget *widget, GdkEventButton *event); | 70 | static gboolean os_thumb_button_release_event (GtkWidget *widget, GdkEventButton *event); |
1752 | 73 | static void os_thumb_composited_changed (GtkWidget *widget); | 71 | static void os_thumb_composited_changed (GtkWidget *widget); |
1753 | 74 | #ifdef USE_GTK3 | ||
1754 | 75 | static gboolean os_thumb_draw (GtkWidget *widget, cairo_t *cr); | ||
1755 | 76 | #else | ||
1756 | 77 | static gboolean os_thumb_expose (GtkWidget *widget, GdkEventExpose *event); | 72 | static gboolean os_thumb_expose (GtkWidget *widget, GdkEventExpose *event); |
1757 | 78 | #endif | ||
1758 | 79 | static gboolean os_thumb_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event); | 73 | static gboolean os_thumb_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event); |
1759 | 80 | static gboolean os_thumb_motion_notify_event (GtkWidget *widget, GdkEventMotion *event); | 74 | static gboolean os_thumb_motion_notify_event (GtkWidget *widget, GdkEventMotion *event); |
1760 | 81 | static void os_thumb_map (GtkWidget *widget); | 75 | static void os_thumb_map (GtkWidget *widget); |
1761 | @@ -145,11 +139,7 @@ | |||
1762 | 145 | widget_class->button_press_event = os_thumb_button_press_event; | 139 | widget_class->button_press_event = os_thumb_button_press_event; |
1763 | 146 | widget_class->button_release_event = os_thumb_button_release_event; | 140 | widget_class->button_release_event = os_thumb_button_release_event; |
1764 | 147 | widget_class->composited_changed = os_thumb_composited_changed; | 141 | widget_class->composited_changed = os_thumb_composited_changed; |
1765 | 148 | #ifdef USE_GTK3 | ||
1766 | 149 | widget_class->draw = os_thumb_draw; | ||
1767 | 150 | #else | ||
1768 | 151 | widget_class->expose_event = os_thumb_expose; | 142 | widget_class->expose_event = os_thumb_expose; |
1769 | 152 | #endif | ||
1770 | 153 | widget_class->leave_notify_event = os_thumb_leave_notify_event; | 143 | widget_class->leave_notify_event = os_thumb_leave_notify_event; |
1771 | 154 | widget_class->map = os_thumb_map; | 144 | widget_class->map = os_thumb_map; |
1772 | 155 | widget_class->motion_notify_event = os_thumb_motion_notify_event; | 145 | widget_class->motion_notify_event = os_thumb_motion_notify_event; |
1773 | @@ -602,7 +592,6 @@ | |||
1774 | 602 | b->alpha = a->alpha; | 592 | b->alpha = a->alpha; |
1775 | 603 | } | 593 | } |
1776 | 604 | 594 | ||
1777 | 605 | #ifndef USE_GTK3 | ||
1778 | 606 | /* Convert a GdkColor to GdkRGBA. */ | 595 | /* Convert a GdkColor to GdkRGBA. */ |
1779 | 607 | static void | 596 | static void |
1780 | 608 | convert_gdk_color_to_gdk_rgba (GdkColor *color, | 597 | convert_gdk_color_to_gdk_rgba (GdkColor *color, |
1781 | @@ -614,7 +603,6 @@ | |||
1782 | 614 | 603 | ||
1783 | 615 | rgba->alpha = 1.0; | 604 | rgba->alpha = 1.0; |
1784 | 616 | } | 605 | } |
1785 | 617 | #endif | ||
1786 | 618 | 606 | ||
1787 | 619 | enum { | 607 | enum { |
1788 | 620 | ACTION_NORMAL, | 608 | ACTION_NORMAL, |
1789 | @@ -624,19 +612,12 @@ | |||
1790 | 624 | }; | 612 | }; |
1791 | 625 | 613 | ||
1792 | 626 | static gboolean | 614 | static gboolean |
1793 | 627 | #ifdef USE_GTK3 | ||
1794 | 628 | os_thumb_draw (GtkWidget *widget, | ||
1795 | 629 | cairo_t *cr) | ||
1796 | 630 | { | ||
1797 | 631 | GtkStyleContext *style_context; | ||
1798 | 632 | #else | ||
1799 | 633 | os_thumb_expose (GtkWidget *widget, | 615 | os_thumb_expose (GtkWidget *widget, |
1800 | 634 | GdkEventExpose *event) | 616 | GdkEventExpose *event) |
1801 | 635 | { | 617 | { |
1802 | 636 | GtkAllocation allocation; | 618 | GtkAllocation allocation; |
1803 | 637 | cairo_t *cr; | 619 | cairo_t *cr; |
1804 | 638 | GtkStyle *style; | 620 | GtkStyle *style; |
1805 | 639 | #endif | ||
1806 | 640 | GdkRGBA bg, bg_active, bg_selected; | 621 | GdkRGBA bg, bg_active, bg_selected; |
1807 | 641 | GdkRGBA bg_arrow_up, bg_arrow_down; | 622 | GdkRGBA bg_arrow_up, bg_arrow_down; |
1808 | 642 | GdkRGBA bg_shadow, bg_dark_line, bg_bright_line; | 623 | GdkRGBA bg_shadow, bg_dark_line, bg_bright_line; |
1809 | @@ -653,17 +634,6 @@ | |||
1810 | 653 | 634 | ||
1811 | 654 | radius = priv->rgba ? THUMB_RADIUS : 0; | 635 | radius = priv->rgba ? THUMB_RADIUS : 0; |
1812 | 655 | 636 | ||
1813 | 656 | #ifdef USE_GTK3 | ||
1814 | 657 | width = gtk_widget_get_allocated_width (widget); | ||
1815 | 658 | height = gtk_widget_get_allocated_height (widget); | ||
1816 | 659 | |||
1817 | 660 | style_context = gtk_widget_get_style_context (widget); | ||
1818 | 661 | |||
1819 | 662 | gtk_style_context_get_background_color (style_context, gtk_widget_get_state_flags (widget), &bg); | ||
1820 | 663 | gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_ACTIVE, &bg_active); | ||
1821 | 664 | gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_SELECTED, &bg_selected); | ||
1822 | 665 | gtk_style_context_get_color (style_context, gtk_widget_get_state_flags (widget), &arrow_color); | ||
1823 | 666 | #else | ||
1824 | 667 | gtk_widget_get_allocation (widget, &allocation); | 637 | gtk_widget_get_allocation (widget, &allocation); |
1825 | 668 | 638 | ||
1826 | 669 | width = allocation.width; | 639 | width = allocation.width; |
1827 | @@ -677,7 +647,6 @@ | |||
1828 | 677 | convert_gdk_color_to_gdk_rgba (&style->fg[gtk_widget_get_state (widget)], &arrow_color); | 647 | convert_gdk_color_to_gdk_rgba (&style->fg[gtk_widget_get_state (widget)], &arrow_color); |
1829 | 678 | 648 | ||
1830 | 679 | cr = gdk_cairo_create (gtk_widget_get_window (widget)); | 649 | cr = gdk_cairo_create (gtk_widget_get_window (widget)); |
1831 | 680 | #endif | ||
1832 | 681 | 650 | ||
1833 | 682 | cairo_save (cr); | 651 | cairo_save (cr); |
1834 | 683 | 652 | ||
1835 | @@ -912,12 +881,8 @@ | |||
1836 | 912 | } | 881 | } |
1837 | 913 | 882 | ||
1838 | 914 | cairo_restore (cr); | 883 | cairo_restore (cr); |
1839 | 915 | |||
1840 | 916 | cairo_restore (cr); | 884 | cairo_restore (cr); |
1841 | 917 | |||
1842 | 918 | #ifndef USE_GTK3 | ||
1843 | 919 | cairo_destroy (cr); | 885 | cairo_destroy (cr); |
1844 | 920 | #endif | ||
1845 | 921 | 886 | ||
1846 | 922 | return FALSE; | 887 | return FALSE; |
1847 | 923 | } | 888 | } |
1848 | @@ -1037,16 +1002,6 @@ | |||
1849 | 1037 | os_thumb_screen_changed (GtkWidget *widget, | 1002 | os_thumb_screen_changed (GtkWidget *widget, |
1850 | 1038 | GdkScreen *old_screen) | 1003 | GdkScreen *old_screen) |
1851 | 1039 | { | 1004 | { |
1852 | 1040 | #ifdef USE_GTK3 | ||
1853 | 1041 | GdkScreen *screen; | ||
1854 | 1042 | GdkVisual *visual; | ||
1855 | 1043 | |||
1856 | 1044 | screen = gtk_widget_get_screen (widget); | ||
1857 | 1045 | visual = gdk_screen_get_rgba_visual (screen); | ||
1858 | 1046 | |||
1859 | 1047 | if (visual) | ||
1860 | 1048 | gtk_widget_set_visual (widget, visual); | ||
1861 | 1049 | #else | ||
1862 | 1050 | GdkScreen *screen; | 1005 | GdkScreen *screen; |
1863 | 1051 | GdkColormap *colormap; | 1006 | GdkColormap *colormap; |
1864 | 1052 | 1007 | ||
1865 | @@ -1055,7 +1010,6 @@ | |||
1866 | 1055 | 1010 | ||
1867 | 1056 | if (colormap) | 1011 | if (colormap) |
1868 | 1057 | gtk_widget_set_colormap (widget, colormap); | 1012 | gtk_widget_set_colormap (widget, colormap); |
1869 | 1058 | #endif | ||
1870 | 1059 | } | 1013 | } |
1871 | 1060 | 1014 | ||
1872 | 1061 | static gboolean | 1015 | static gboolean |
1873 | 1062 | 1016 | ||
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 | 1 | if USE_GTK3 | ||
1879 | 2 | VER=3 | ||
1880 | 3 | else | ||
1881 | 4 | VER= | 1 | VER= |
1882 | 5 | endif | ||
1883 | 6 | 2 | ||
1884 | 7 | noinst_PROGRAMS = \ | 3 | noinst_PROGRAMS = \ |
1885 | 8 | test-os | 4 | test-os |
1886 | 9 | 5 | ||
1887 | 10 | if USE_GTK3 | ||
1888 | 11 | test_os_CFLAGS = -I$(top_srcdir) $(OS_CFLAGS) -DUSE_GTK3 | ||
1889 | 12 | else | ||
1890 | 13 | test_os_CFLAGS = -I$(top_srcdir) $(OS_CFLAGS) | 6 | test_os_CFLAGS = -I$(top_srcdir) $(OS_CFLAGS) |
1891 | 14 | endif | ||
1892 | 15 | 7 | ||
1893 | 16 | test_os_LDFLAGS = $(OS_LIBADD) | 8 | test_os_LDFLAGS = $(OS_LIBADD) |
1894 | 17 | 9 | ||
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 | 250 | gtk_window_set_title (GTK_WINDOW (window), "Vertical \"Overlay Scrollbar\" test"); | 250 | gtk_window_set_title (GTK_WINDOW (window), "Vertical \"Overlay Scrollbar\" test"); |
1900 | 251 | 251 | ||
1901 | 252 | /* vbox */ | 252 | /* vbox */ |
1902 | 253 | #ifdef USE_GTK3 | ||
1903 | 254 | vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); | ||
1904 | 255 | #else | ||
1905 | 256 | vbox = gtk_vbox_new (TRUE, 2); | 253 | vbox = gtk_vbox_new (TRUE, 2); |
1906 | 257 | #endif | ||
1907 | 258 | 254 | ||
1908 | 259 | /* hbox */ | 255 | /* hbox */ |
1909 | 260 | #ifdef USE_GTK3 | ||
1910 | 261 | hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); | ||
1911 | 262 | #else | ||
1912 | 263 | hbox = gtk_hbox_new (TRUE, 2); | 256 | hbox = gtk_hbox_new (TRUE, 2); |
1913 | 264 | #endif | ||
1914 | 265 | 257 | ||
1915 | 266 | /* scrolled_window_text0 */ | 258 | /* scrolled_window_text0 */ |
1916 | 267 | scrolled_window_text0 = gtk_scrolled_window_new (NULL, NULL); | 259 | scrolled_window_text0 = gtk_scrolled_window_new (NULL, NULL); |
FAILED: Continuous integration, rev:402 /code.launchpad .net/~laney/ overlay- scrollbar/ drop-gtk3/ +merge/ 260932/ +edit-commit- message
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:/
http:// jenkins. qa.ubuntu. com/job/ overlay- scrollbar- ci/20/ jenkins. qa.ubuntu. com/job/ overlay- scrollbar- wily-amd64- ci/1 jenkins. qa.ubuntu. com/job/ overlay- scrollbar- wily-armhf- ci/1 jenkins. qa.ubuntu. com/job/ overlay- scrollbar- wily-i386- ci/1
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/overlay- scrollbar- ci/20/rebuild
http://