Merge lp:~azzar1/bamf/bamf-export-actions-menu into lp:bamf
- bamf-export-actions-menu
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | 640 |
Merged at revision: | 632 |
Proposed branch: | lp:~azzar1/bamf/bamf-export-actions-menu |
Merge into: | lp:bamf |
Diff against target: |
517 lines (+215/-26) 12 files modified
configure.ac (+18/-4) debian/control (+1/-0) debian/rules (+2/-1) src/Makefile.am (+6/-0) src/bamf-legacy-window-test.c (+7/-0) src/bamf-legacy-window.c (+43/-2) src/bamf-legacy-window.h (+3/-0) src/bamf-window.c (+89/-12) src/bamf-window.h (+0/-2) src/bamf-xutils.c (+38/-5) src/bamf-xutils.h (+1/-0) tests/bamfdaemon/Makefile.am (+7/-0) |
To merge this branch: | bzr merge lp:~azzar1/bamf/bamf-export-actions-menu |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Review via email: mp+291242@code.launchpad.net |
Commit message
BamfWindow: Export window actions menu using dbusmenu
Description of the change
Export window actions menu using dbusmenu.
- 634. By Andrea Azzarone
-
Off by default.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 635. By Andrea Azzarone
-
Depends on libdbusmenu-
gtk3-dev.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:635
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
Click here to trigger a rebuild:
http://
- 636. By Andrea Azzarone
-
Add safe check for tests.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:636
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
Click here to trigger a rebuild:
http://
- 637. By Andrea Azzarone
-
g_return_if_fail makes tests fail.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:637
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
Click here to trigger a rebuild:
http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Looks good, but as per the changes I posted in hud review, we can get rid of _WNCK_ACTION_
Finally In order to get Super+Alt keybinding working as expected, you just need something like this: http://
PS: also merge these changes, some cleanup and fixes I've just dicovered: http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Actually, I've worked a little on this, and here's what I meant:
lp:~3v1n0/bamf/action-menu-tuning
However, this branch per se doesn't change the fact that we allocate all these menus even if not needed.
In order to do that, I've pushed a proposal in lp:~3v1n0/bamf/action-menu-unref-unactive.
Basically we export the menus for the active window and the previously-active window.
This is because the Hud take focus when shown (ouch!), but still this is nice as we reduce the computation when switching between two apps (which is kinda the most used scenario).
Honestly I think that this thing should be done also HUD side by default (to reduce its huge memory usage).
In case you prefer to avoid this, I'd just ensure that we only export these menus when a window is activated (just remove the g_clear_object around and you're all set). But as said, i can't think of negative effect of this.
- 638. By Andrea Azzarone
-
Merge with lp:~3v1n0/bamf/action-menu-tuning
- 639. By Andrea Azzarone
-
Merge with lp:~3v1n0/bamf/action-menu-unref-unactive
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:638
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:639
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
Click here to trigger a rebuild:
http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Cool, please merge also with lp:~3v1n0/bamf/action-menus-test-fix as there's a crash in tests due to missing implementation of the get_action_menu function in the mock window.
- 640. By Andrea Azzarone
-
Merge with lp:~3v1n0/bamf/action-menus-test-fix
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:640
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
Click here to trigger a rebuild:
http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
We're all set.
Preview Diff
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2016-02-29 15:32:52 +0000 |
3 | +++ configure.ac 2016-04-12 11:14:14 +0000 |
4 | @@ -72,6 +72,19 @@ |
5 | # |
6 | PKG_CHECK_MODULES(X, x11) |
7 | |
8 | +# |
9 | +# DbusMenu |
10 | +# |
11 | +AC_ARG_ENABLE([export-actions-menu], |
12 | + AS_HELP_STRING([--enable-export-actions-menu=@<:@no/yes@:>@],[export window actions menus (requires dbusmenu) @<:@default=no@:>@]),, |
13 | + [enable_export_actions_menu=no]) |
14 | + |
15 | +AM_CONDITIONAL([EXPORT_ACTIONS_MENU],[test "x$enable_export_actions_menu" != "xno"]) |
16 | + |
17 | +if test "x$enable_export_actions_menu" = "xyes"; then |
18 | + PKG_CHECK_MODULES(DBUSMENU, [dbusmenu-glib-0.4, dbusmenu-gtk3-0.4]) |
19 | +fi |
20 | + |
21 | ########################### |
22 | # GObject Introspection |
23 | ########################### |
24 | @@ -172,9 +185,10 @@ |
25 | ${PACKAGE}-${VERSION} |
26 | |
27 | Build Environment |
28 | - Install Prefix: ${prefix} |
29 | - Introspection: ${enable_introspection} |
30 | - Headless tests: ${enable_headless_tests} |
31 | - Coverage Reporting: ${use_gcov} |
32 | + Install Prefix: ${prefix} |
33 | + Introspection: ${enable_introspection} |
34 | + Headless tests: ${enable_headless_tests} |
35 | + Coverage Reporting: ${use_gcov} |
36 | + Export actions menus: ${enable_export_actions_menu} |
37 | |
38 | EOF |
39 | |
40 | === modified file 'debian/control' |
41 | --- debian/control 2015-10-28 16:41:10 +0000 |
42 | +++ debian/control 2016-04-12 11:14:14 +0000 |
43 | @@ -9,6 +9,7 @@ |
44 | gobject-introspection (>= 1.41.4-1~), |
45 | gtk-doc-tools, |
46 | hicolor-icon-theme, |
47 | + libdbusmenu-gtk3-dev, |
48 | libglib2.0-dev (>= 2.32.0), |
49 | libgtop2-dev, |
50 | libgtk-3-dev (>= 3.0.0), |
51 | |
52 | === modified file 'debian/rules' |
53 | --- debian/rules 2014-01-07 19:15:14 +0000 |
54 | +++ debian/rules 2016-04-12 11:14:14 +0000 |
55 | @@ -14,7 +14,8 @@ |
56 | dh_auto_configure -- --enable-introspection=yes \ |
57 | --enable-gtk-doc \ |
58 | --enable-headless-tests \ |
59 | - --disable-silent-rules |
60 | + --disable-silent-rules \ |
61 | + --enable-export-actions-menu=yes |
62 | |
63 | override_dh_auto_install: |
64 | dh_auto_install |
65 | |
66 | === modified file 'src/Makefile.am' |
67 | --- src/Makefile.am 2016-01-19 11:13:01 +0000 |
68 | +++ src/Makefile.am 2016-04-12 11:14:14 +0000 |
69 | @@ -67,6 +67,12 @@ |
70 | $(COVERAGE_CFLAGS) \ |
71 | $(NULL) |
72 | |
73 | +if EXPORT_ACTIONS_MENU |
74 | +bamfdaemon_LDADD += $(DBUSMENU_LIBS) |
75 | +bamfdaemon_CFLAGS += $(DBUSMENU_CFLAGS) |
76 | +bamfdaemon_CFLAGS += -DEXPORT_ACTIONS_MENU |
77 | +endif |
78 | + |
79 | bamfdaemon_LDFLAGS = \ |
80 | -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions \ |
81 | $(COVERAGE_LDFLAGS) \ |
82 | |
83 | === modified file 'src/bamf-legacy-window-test.c' |
84 | --- src/bamf-legacy-window-test.c 2014-02-14 01:21:59 +0000 |
85 | +++ src/bamf-legacy-window-test.c 2016-04-12 11:14:14 +0000 |
86 | @@ -436,6 +436,12 @@ |
87 | return g_strdup (BAMF_LEGACY_WINDOW_TEST (window)->icon); |
88 | } |
89 | |
90 | +GtkWidget * |
91 | +bamf_legacy_window_test_get_action_menu (BamfLegacyWindow *window) |
92 | +{ |
93 | + return NULL; |
94 | +} |
95 | + |
96 | void |
97 | bamf_legacy_window_test_show_action_menu (BamfLegacyWindow *window, guint32 time, guint button, gint x, gint y) |
98 | {} |
99 | @@ -492,6 +498,7 @@ |
100 | win_class->is_closed = bamf_legacy_window_test_is_closed; |
101 | win_class->get_hint = bamf_legacy_window_test_get_hint; |
102 | win_class->set_hint = bamf_legacy_window_test_set_hint; |
103 | + win_class->get_action_menu = bamf_legacy_window_test_get_action_menu; |
104 | win_class->show_action_menu = bamf_legacy_window_test_show_action_menu; |
105 | win_class->reopen = bamf_legacy_window_test_reopen; |
106 | } |
107 | |
108 | === modified file 'src/bamf-legacy-window.c' |
109 | --- src/bamf-legacy-window.c 2014-02-14 01:21:59 +0000 |
110 | +++ src/bamf-legacy-window.c 2016-04-12 11:14:14 +0000 |
111 | @@ -52,6 +52,7 @@ |
112 | struct _BamfLegacyWindowPrivate |
113 | { |
114 | WnckWindow * legacy_window; |
115 | + GtkWidget * action_menu; |
116 | GFile * mini_icon; |
117 | gchar * exec_string; |
118 | gchar * working_dir; |
119 | @@ -547,9 +548,35 @@ |
120 | *push = TRUE; |
121 | } |
122 | |
123 | +GtkWidget * |
124 | +bamf_legacy_window_get_action_menu (BamfLegacyWindow *self) |
125 | +{ |
126 | + BamfLegacyWindowPrivate *priv; |
127 | + |
128 | + g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL); |
129 | + |
130 | + if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_action_menu) |
131 | + return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_action_menu (self); |
132 | + |
133 | + priv = self->priv; |
134 | + g_return_val_if_fail (WNCK_IS_WINDOW (priv->legacy_window), NULL); |
135 | + |
136 | + if (!priv->action_menu) |
137 | + { |
138 | + priv->action_menu = wnck_action_menu_new (priv->legacy_window); |
139 | + g_object_add_weak_pointer (G_OBJECT (priv->action_menu), |
140 | + (gpointer *) &priv->action_menu); |
141 | + } |
142 | + |
143 | + return priv->action_menu; |
144 | +} |
145 | + |
146 | void bamf_legacy_window_show_action_menu (BamfLegacyWindow *self, guint32 time, |
147 | guint button, gint x, gint y) |
148 | { |
149 | + BamfLegacyWindowPrivate *priv; |
150 | + GtkWidget *menu; |
151 | + |
152 | g_return_if_fail (BAMF_IS_LEGACY_WINDOW (self)); |
153 | |
154 | if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->show_action_menu) |
155 | @@ -557,9 +584,16 @@ |
156 | |
157 | g_return_if_fail (WNCK_IS_WINDOW (self->priv->legacy_window)); |
158 | |
159 | - GtkWidget *menu = wnck_action_menu_new (self->priv->legacy_window); |
160 | - g_signal_connect (G_OBJECT (menu), "unmap", G_CALLBACK (g_object_unref), NULL); |
161 | + priv = self->priv; |
162 | + |
163 | + if (priv->action_menu && gtk_widget_is_visible (GTK_WIDGET (priv->action_menu))) |
164 | + return; |
165 | + |
166 | + menu = bamf_legacy_window_get_action_menu (self); |
167 | + |
168 | g_object_ref_sink (menu); |
169 | + g_signal_handlers_disconnect_by_func (menu, g_object_unref, self); |
170 | + g_signal_connect (G_OBJECT (menu), "unmap", G_CALLBACK (g_object_unref), self); |
171 | |
172 | gtk_menu_set_screen (GTK_MENU (menu), gdk_screen_get_default ()); |
173 | gtk_widget_show (menu); |
174 | @@ -650,6 +684,13 @@ |
175 | self->priv->legacy_window = NULL; |
176 | } |
177 | |
178 | + if (self->priv->action_menu) |
179 | + { |
180 | + g_signal_handlers_disconnect_by_data (self->priv->action_menu, self); |
181 | + g_object_remove_weak_pointer (G_OBJECT (self->priv->action_menu), |
182 | + (gpointer*) &self->priv->action_menu); |
183 | + } |
184 | + |
185 | G_OBJECT_CLASS (bamf_legacy_window_parent_class)->dispose (object); |
186 | } |
187 | |
188 | |
189 | === modified file 'src/bamf-legacy-window.h' |
190 | --- src/bamf-legacy-window.h 2014-02-14 01:21:59 +0000 |
191 | +++ src/bamf-legacy-window.h 2016-04-12 11:14:14 +0000 |
192 | @@ -99,6 +99,7 @@ |
193 | gint *x, gint *y, gint *w, gint *h); |
194 | void (*set_hint) (BamfLegacyWindow *legacy_window, |
195 | const gchar *name, const gchar *value); |
196 | + GtkWidget * (*get_action_menu) (BamfLegacyWindow *legacy_window); |
197 | void (*show_action_menu) (BamfLegacyWindow *legacy_window, |
198 | guint32 time, guint button, gint x, gint y); |
199 | void (*reopen) (BamfLegacyWindow *legacy_window); |
200 | @@ -171,6 +172,8 @@ |
201 | |
202 | gint bamf_legacy_window_get_stacking_position (BamfLegacyWindow *self); |
203 | |
204 | +GtkWidget * bamf_legacy_window_get_action_menu (BamfLegacyWindow *self); |
205 | + |
206 | void bamf_legacy_window_show_action_menu (BamfLegacyWindow *self, |
207 | guint32 time, guint button, |
208 | gint x, gint y); |
209 | |
210 | === modified file 'src/bamf-window.c' |
211 | --- src/bamf-window.c 2013-07-31 00:11:27 +0000 |
212 | +++ src/bamf-window.c 2016-04-12 11:14:14 +0000 |
213 | @@ -21,6 +21,13 @@ |
214 | #include "bamf-window.h" |
215 | #include "bamf-legacy-screen.h" |
216 | |
217 | +#ifdef EXPORT_ACTIONS_MENU |
218 | +#include <glib.h> |
219 | +#include <glib/gi18n.h> |
220 | +#include <libdbusmenu-glib/dbusmenu-glib.h> |
221 | +#include <libdbusmenu-gtk/parser.h> |
222 | +#endif |
223 | + |
224 | #define BAMF_WINDOW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \ |
225 | BAMF_TYPE_WINDOW, BamfWindowPrivate)) |
226 | |
227 | @@ -29,7 +36,7 @@ |
228 | G_IMPLEMENT_INTERFACE (BAMF_DBUS_ITEM_TYPE_WINDOW, |
229 | bamf_window_dbus_iface_init)); |
230 | |
231 | -static GList *bamf_windows; |
232 | +static GList *bamf_windows = NULL; |
233 | |
234 | enum |
235 | { |
236 | @@ -44,7 +51,12 @@ |
237 | BamfLegacyWindow *legacy_window; |
238 | BamfWindowMaximizationType maximized; |
239 | gint monitor; |
240 | - time_t opened; |
241 | + |
242 | +#ifdef EXPORT_ACTIONS_MENU |
243 | + DbusmenuServer *dbusmenu_server; |
244 | + GtkWidget *action_menu; |
245 | + gboolean was_active; |
246 | +#endif |
247 | }; |
248 | |
249 | BamfLegacyWindow * |
250 | @@ -129,14 +141,6 @@ |
251 | return (guint32) bamf_legacy_window_get_xid (window->priv->legacy_window); |
252 | } |
253 | |
254 | -time_t |
255 | -bamf_window_opened (BamfWindow *self) |
256 | -{ |
257 | - g_return_val_if_fail (BAMF_IS_WINDOW (self), 0); |
258 | - |
259 | - return self->priv->opened; |
260 | -} |
261 | - |
262 | static void |
263 | handle_window_closed (BamfLegacyWindow * window, gpointer data) |
264 | { |
265 | @@ -165,6 +169,10 @@ |
266 | { |
267 | g_return_if_fail (BAMF_IS_WINDOW (self)); |
268 | |
269 | +#ifdef EXPORT_ACTIONS_MENU |
270 | + self->priv->was_active = bamf_view_is_active (BAMF_VIEW (self)); |
271 | +#endif |
272 | + |
273 | bamf_view_set_active (BAMF_VIEW (self), bamf_legacy_window_is_active (self->priv->legacy_window)); |
274 | bamf_view_set_urgent (BAMF_VIEW (self), bamf_legacy_window_needs_attention (self->priv->legacy_window)); |
275 | bamf_view_set_user_visible (BAMF_VIEW (self), !bamf_legacy_window_is_skip_tasklist (self->priv->legacy_window)); |
276 | @@ -177,6 +185,15 @@ |
277 | self->priv->maximized = maximized; |
278 | g_signal_emit_by_name (self, "maximized-changed", old_state, maximized); |
279 | } |
280 | + |
281 | +#ifdef EXPORT_ACTIONS_MENU |
282 | + if (self->priv->dbusmenu_server && !self->priv->was_active && |
283 | + !bamf_view_is_active (BAMF_VIEW (self))) |
284 | + { |
285 | + g_clear_object (&self->priv->dbusmenu_server); |
286 | + g_clear_object (&self->priv->action_menu); |
287 | + } |
288 | +#endif |
289 | } |
290 | |
291 | static void |
292 | @@ -263,6 +280,60 @@ |
293 | bamf_window_ensure_flags (window); |
294 | } |
295 | |
296 | +#ifdef EXPORT_ACTIONS_MENU |
297 | +static gboolean |
298 | +bamf_window_active_changed (BamfView *view, gboolean active) |
299 | +{ |
300 | + BamfWindow *self = BAMF_WINDOW (view); |
301 | + BamfWindowPrivate *priv = self->priv; |
302 | + GtkWidget *window_menu; |
303 | + BamfWindowType win_type; |
304 | + const char *view_path; |
305 | + |
306 | + if (!active && !priv->was_active) |
307 | + { |
308 | + g_clear_object (&priv->dbusmenu_server); |
309 | + g_clear_object (&priv->action_menu); |
310 | + return FALSE; |
311 | + } |
312 | + |
313 | + if (priv->dbusmenu_server) |
314 | + return FALSE; |
315 | + |
316 | + win_type = bamf_window_get_window_type (self); |
317 | + |
318 | + if (win_type == BAMF_WINDOW_DOCK || |
319 | + win_type == BAMF_WINDOW_TOOLBAR || |
320 | + win_type == BAMF_WINDOW_MENU || |
321 | + win_type == BAMF_WINDOW_SPLASHSCREEN) |
322 | + { |
323 | + return FALSE; |
324 | + } |
325 | + |
326 | + window_menu = bamf_legacy_window_get_action_menu (priv->legacy_window); |
327 | + |
328 | + if (!GTK_IS_WIDGET (window_menu)) |
329 | + return FALSE; |
330 | + |
331 | + view_path = bamf_view_get_path (view); |
332 | + priv->dbusmenu_server = dbusmenu_server_new (view_path); |
333 | + |
334 | + priv->action_menu = gtk_menu_new (); |
335 | + g_object_ref_sink (priv->action_menu); |
336 | + |
337 | + GtkWidget *menuitem = gtk_menu_item_new_with_label (_("Window actions")); |
338 | + gtk_widget_show (menuitem); |
339 | + |
340 | + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), window_menu); |
341 | + gtk_menu_shell_append (GTK_MENU_SHELL (priv->action_menu), menuitem); |
342 | + |
343 | + dbusmenu_server_set_root (priv->dbusmenu_server, |
344 | + dbusmenu_gtk_parse_menu_structure (priv->action_menu)); |
345 | + |
346 | + return FALSE; |
347 | +} |
348 | +#endif |
349 | + |
350 | static gboolean |
351 | on_dbus_handle_get_pid (BamfDBusItemWindow *interface, |
352 | GDBusMethodInvocation *invocation, |
353 | @@ -414,8 +485,6 @@ |
354 | self = BAMF_WINDOW (object); |
355 | bamf_windows = g_list_prepend (bamf_windows, self); |
356 | |
357 | - self->priv->opened = time (NULL); |
358 | - |
359 | bamf_view_set_name (BAMF_VIEW (self), bamf_legacy_window_get_name (window)); |
360 | |
361 | g_signal_connect (G_OBJECT (window), "name-changed", |
362 | @@ -452,6 +521,11 @@ |
363 | self->priv->legacy_window = NULL; |
364 | } |
365 | |
366 | +#ifdef EXPORT_ACTIONS_MENU |
367 | + g_clear_object (&self->priv->dbusmenu_server); |
368 | + g_clear_object (&self->priv->action_menu); |
369 | +#endif |
370 | + |
371 | G_OBJECT_CLASS (bamf_window_parent_class)->dispose (object); |
372 | } |
373 | |
374 | @@ -528,6 +602,9 @@ |
375 | object_class->constructed = bamf_window_constructed; |
376 | view_class->view_type = bamf_window_get_view_type; |
377 | view_class->stable_bus_name = bamf_window_get_stable_bus_name; |
378 | +#ifdef EXPORT_ACTIONS_MENU |
379 | + view_class->active_changed = bamf_window_active_changed; |
380 | +#endif |
381 | |
382 | pspec = g_param_spec_object ("legacy-window", "legacy-window", "legacy-window", |
383 | BAMF_TYPE_LEGACY_WINDOW, |
384 | |
385 | === modified file 'src/bamf-window.h' |
386 | --- src/bamf-window.h 2013-06-08 13:54:06 +0000 |
387 | +++ src/bamf-window.h 2016-04-12 11:14:14 +0000 |
388 | @@ -69,8 +69,6 @@ |
389 | |
390 | guint32 bamf_window_get_pid (BamfWindow *window); |
391 | |
392 | -time_t bamf_window_opened (BamfWindow *window); |
393 | - |
394 | gint bamf_window_get_stack_position (BamfWindow *window); |
395 | |
396 | char * bamf_window_get_string_hint (BamfWindow *self, const char* prop); |
397 | |
398 | === modified file 'src/bamf-xutils.c' |
399 | --- src/bamf-xutils.c 2014-02-14 01:21:59 +0000 |
400 | +++ src/bamf-xutils.c 2016-04-12 11:14:14 +0000 |
401 | @@ -57,7 +57,7 @@ |
402 | XGetErrorText (dpy, error_code, tmp, sizeof (tmp) - 1); |
403 | tmp[sizeof (tmp) - 1] = '\0'; |
404 | |
405 | - g_warning("Got an X error: %s\n", tmp); |
406 | + g_warning ("Got an X error: %s\n", tmp); |
407 | |
408 | return TRUE; |
409 | } |
410 | @@ -103,17 +103,25 @@ |
411 | &type, &format, &numItems, |
412 | &bytesAfter, &buffer); |
413 | |
414 | + gboolean x_error = gdk_error_trap_pop_and_print (XDisplay); |
415 | + |
416 | if (close_display) |
417 | XCloseDisplay (XDisplay); |
418 | |
419 | - if (result == Success && numItems > 0 && !gdk_error_trap_pop_and_print (XDisplay)) |
420 | + if (x_error) |
421 | + { |
422 | + XFree (buffer); |
423 | + return; |
424 | + } |
425 | + |
426 | + if (result == Success && numItems > 0) |
427 | { |
428 | if (return_type) |
429 | *return_type = type; |
430 | |
431 | if (return_hint && buffer && buffer[0] != '\0') |
432 | { |
433 | - if (type == XA_STRING || type == gdk_x11_get_xatom_by_name("UTF8_STRING")) |
434 | + if (type == XA_STRING || type == gdk_x11_get_xatom_by_name ("UTF8_STRING")) |
435 | *return_hint = g_strdup ((char*) buffer); |
436 | } |
437 | |
438 | @@ -155,7 +163,7 @@ |
439 | { |
440 | type = XA_STRING; |
441 | } |
442 | - else if (type != XA_STRING && type != gdk_x11_get_xatom_by_name("UTF8_STRING")) |
443 | + else if (type != XA_STRING && type != gdk_x11_get_xatom_by_name ("UTF8_STRING")) |
444 | { |
445 | g_error ("Impossible to set the atom %s on Window %lu", atom_name, xid); |
446 | |
447 | @@ -177,6 +185,31 @@ |
448 | } |
449 | |
450 | void |
451 | +bamf_xutils_unset_window_hint (Window xid, const char *atom_name) |
452 | +{ |
453 | + Display *XDisplay; |
454 | + gboolean close_display = FALSE; |
455 | + |
456 | + g_return_if_fail (xid != 0); |
457 | + g_return_if_fail (atom_name); |
458 | + |
459 | + XDisplay = get_xdisplay (&close_display); |
460 | + |
461 | + if (!XDisplay) |
462 | + { |
463 | + g_warning ("%s: Unable to get a valid XDisplay", G_STRFUNC); |
464 | + return; |
465 | + } |
466 | + |
467 | + gdk_error_trap_push (); |
468 | + XDeleteProperty (XDisplay, xid, gdk_x11_get_xatom_by_name (atom_name)); |
469 | + gdk_error_trap_pop_and_print (XDisplay); |
470 | + |
471 | + if (close_display) |
472 | + XCloseDisplay (XDisplay); |
473 | +} |
474 | + |
475 | +void |
476 | bamf_xutils_get_window_class_hints (Window xid, char **class_instance_name, char **class_name) |
477 | { |
478 | Display *xdisplay; |
479 | @@ -196,7 +229,7 @@ |
480 | |
481 | gdk_error_trap_push (); |
482 | |
483 | - XGetClassHint(xdisplay, xid, &class_hint); |
484 | + XGetClassHint (xdisplay, xid, &class_hint); |
485 | |
486 | if (!gdk_error_trap_pop_and_print (xdisplay)) |
487 | { |
488 | |
489 | === modified file 'src/bamf-xutils.h' |
490 | --- src/bamf-xutils.h 2014-02-14 01:21:59 +0000 |
491 | +++ src/bamf-xutils.h 2016-04-12 11:14:14 +0000 |
492 | @@ -27,6 +27,7 @@ |
493 | |
494 | void bamf_xutils_set_string_window_hint (Window xid, const char *atom_name, const char *value); |
495 | char* bamf_xutils_get_string_window_hint (Window xid, const char *atom_name); |
496 | +void bamf_xutils_unset_window_hint (Window xid, const char *atom_name); |
497 | |
498 | void bamf_xutils_get_window_class_hints (Window xid, char **class_instance_name, char **class_name); |
499 | |
500 | |
501 | === modified file 'tests/bamfdaemon/Makefile.am' |
502 | --- tests/bamfdaemon/Makefile.am 2016-01-19 11:13:01 +0000 |
503 | +++ tests/bamfdaemon/Makefile.am 2016-04-12 11:14:14 +0000 |
504 | @@ -68,6 +68,13 @@ |
505 | $(X_LIBS) \ |
506 | $(NULL) |
507 | |
508 | +if EXPORT_ACTIONS_MENU |
509 | +test_bamf_LDADD += $(DBUSMENU_LIBS) |
510 | +test_bamf_CFLAGS += $(DBUSMENU_CFLAGS) |
511 | +test_bamf_CFLAGS += -DEXPORT_ACTIONS_MENU |
512 | +endif |
513 | + |
514 | + |
515 | test_bamf_LDFLAGS = \ |
516 | -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions \ |
517 | $(COVERAGE_LDFLAGS) \ |
FAILED: Continuous integration, rev:634 jenkins. qa.ubuntu. com/job/ bamf-ci/ 128/ jenkins. qa.ubuntu. com/job/ bamf-xenial- amd64-ci/ 9/console jenkins. qa.ubuntu. com/job/ bamf-xenial- armhf-ci/ 9/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/bamf- ci/128/ rebuild
http://