Merge lp:~khurshid-alam/indicator-appmenu/ignore-desktop into lp:indicator-appmenu

Proposed by Khurshid Alam on 2019-05-06
Status: Needs review
Proposed branch: lp:~khurshid-alam/indicator-appmenu/ignore-desktop
Merge into: lp:indicator-appmenu
Prerequisite: lp:~khurshid-alam/indicator-appmenu/fix-build-disco
Diff against target: 125 lines (+11/-17)
5 files modified
src/gdk-get-func.c (+3/-3)
src/indicator-appmenu.c (+4/-4)
src/window-menu-dbusmenu.c (+2/-4)
src/window-menu-model.c (+2/-4)
src/window-menu.c (+0/-2)
To merge this branch: bzr merge lp:~khurshid-alam/indicator-appmenu/ignore-desktop
Reviewer Review Type Date Requested Status
Marco Trevisan (TreviƱo) 2019-05-06 Pending
Review via email: mp+366990@code.launchpad.net

Commit message

* Don't use the deprecated g_type_class_add_private

* Use X11 specific error trap functions

* Do not to track menus for desktop_windows. Fixes LP:#1827411

Description of the change

Bamf somehow not considering desktop window as valid bamf window (see https://paste.ubuntu.com/p/wz32KF7Kqx/). As a result when indicator-appmenu tries to track menu it fails. For now we are ignoring tracking desktop windows in indicator-appmenu.

To post a comment you must log in.
285. By Khurshid Alam on 2019-05-13

Do not to track menus for desktop_windows. Fixes LP:#1827411

Khurshid Alam (khurshid-alam) wrote :

I figured out what is happening. Before nautilus & nautilus-desktop was the same binary (same for nemo), bamf used to track nautilus for desktop menu. But after the split, the code was never adapted in bamf. But for now, this works.

Unmerged revisions

285. By Khurshid Alam on 2019-05-13

Do not to track menus for desktop_windows. Fixes LP:#1827411

284. By Khurshid Alam on 2019-05-06

Use X11 specific error trap functions

283. By Khurshid Alam on 2019-05-06

don't use the deprecated g_type_class_add_private

282. By Khurshid Alam on 2019-01-06

src/window-menu-*.c: Type cast assignments from g_object_ref().

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/gdk-get-func.c'
2--- src/gdk-get-func.c 2010-10-06 18:43:21 +0000
3+++ src/gdk-get-func.c 2019-05-13 16:49:22 +0000
4@@ -93,13 +93,13 @@
5
6 hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS);
7
8- gdk_error_trap_push ();
9+ gdk_x11_display_error_trap_push (display);
10 XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), window,
11 hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
12 False, AnyPropertyType, &type, &format, &nitems,
13 &bytes_after, &data);
14- gdk_flush ();
15- if ((ret = gdk_error_trap_pop ()))
16+ gdk_display_flush (display);
17+ if ((ret = gdk_x11_display_error_trap_pop (display)))
18 {
19 g_warning ("%s: Unable to get hints for %u: Error Code: %d", G_STRFUNC, (guint32)window, ret);
20 return NULL;
21
22=== modified file 'src/indicator-appmenu.c'
23--- src/indicator-appmenu.c 2015-10-28 15:34:43 +0000
24+++ src/indicator-appmenu.c 2019-05-13 16:49:22 +0000
25@@ -484,14 +484,14 @@
26 xev.xclient.data.l[3] = 0;
27 xev.xclient.data.l[4] = 0;
28
29- gdk_error_trap_push ();
30+ gdk_x11_display_error_trap_push (gdk_display_get_default ());
31 XSendEvent (gdk_x11_get_default_xdisplay (),
32 gdk_x11_get_default_root_xwindow (),
33 False,
34 SubstructureRedirectMask | SubstructureNotifyMask,
35 &xev);
36- gdk_flush ();
37- gdk_error_trap_pop_ignored ();
38+ gdk_display_flush (gdk_display_get_default ());
39+ gdk_x11_display_error_trap_pop_ignored (gdk_display_get_default ());
40
41 return;
42 }
43@@ -1067,7 +1067,7 @@
44 if (menus == NULL) {
45 gchar * uniquename = bamf_window_get_utf8_prop (window, "_GTK_UNIQUE_BUS_NAME");
46
47- if (uniquename != NULL) {
48+ if (uniquename != NULL && bamf_window_get_window_type (window) != BAMF_WINDOW_DESKTOP) {
49 BamfApplication * app = bamf_matcher_get_application_for_window(iapp->matcher, window);
50
51 menus = WINDOW_MENU(window_menu_model_new(app, window));
52
53=== modified file 'src/window-menu-dbusmenu.c'
54--- src/window-menu-dbusmenu.c 2019-05-13 16:49:22 +0000
55+++ src/window-menu-dbusmenu.c 2019-05-13 16:49:22 +0000
56@@ -57,7 +57,7 @@
57 };
58
59 #define WINDOW_MENU_DBUSMENU_GET_PRIVATE(o) \
60-(G_TYPE_INSTANCE_GET_PRIVATE ((o), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenuPrivate))
61+(window_menu_dbusmenu_get_instance_private (WINDOW_MENU_DBUSMENU(o)))
62
63 /* Prototypes */
64
65@@ -81,7 +81,7 @@
66 static void entry_restore (WindowMenu * wm, IndicatorObjectEntry * entry);
67 static void entry_activate (WindowMenu * wm, IndicatorObjectEntry * entry, guint timestamp);
68
69-G_DEFINE_TYPE (WindowMenuDbusmenu, window_menu_dbusmenu, WINDOW_MENU_TYPE);
70+G_DEFINE_TYPE_WITH_PRIVATE (WindowMenuDbusmenu, window_menu_dbusmenu, WINDOW_MENU_TYPE);
71
72 /* Build the one-time class */
73 static void
74@@ -89,8 +89,6 @@
75 {
76 GObjectClass *object_class = G_OBJECT_CLASS (klass);
77
78- g_type_class_add_private (klass, sizeof (WindowMenuDbusmenuPrivate));
79-
80 object_class->dispose = window_menu_dbusmenu_dispose;
81
82 WindowMenuClass * menu_class = WINDOW_MENU_CLASS(klass);
83
84=== modified file 'src/window-menu-model.c'
85--- src/window-menu-model.c 2019-05-13 16:49:22 +0000
86+++ src/window-menu-model.c 2019-05-13 16:49:22 +0000
87@@ -48,7 +48,7 @@
88 };
89
90 #define WINDOW_MENU_MODEL_GET_PRIVATE(o) \
91-(G_TYPE_INSTANCE_GET_PRIVATE ((o), WINDOW_MENU_MODEL_TYPE, WindowMenuModelPrivate))
92+(window_menu_model_get_instance_private (WINDOW_MENU_MODEL(o)))
93
94 /* Base class stuff */
95 static void window_menu_model_class_init (WindowMenuModelClass *klass);
96@@ -64,7 +64,7 @@
97 static guint get_xid (WindowMenu * wm);
98
99 /* GLib boilerplate */
100-G_DEFINE_TYPE (WindowMenuModel, window_menu_model, WINDOW_MENU_TYPE);
101+G_DEFINE_TYPE_WITH_PRIVATE (WindowMenuModel, window_menu_model, WINDOW_MENU_TYPE);
102
103 /* Prefixes to the action muxer */
104 #define ACTION_MUX_PREFIX_APP "app"
105@@ -79,8 +79,6 @@
106 {
107 GObjectClass *object_class = G_OBJECT_CLASS (klass);
108
109- g_type_class_add_private (klass, sizeof (WindowMenuModelPrivate));
110-
111 object_class->dispose = window_menu_model_dispose;
112
113 WindowMenuClass * wm_class = WINDOW_MENU_CLASS(klass);
114
115=== modified file 'src/window-menu.c'
116--- src/window-menu.c 2015-06-03 23:10:07 +0000
117+++ src/window-menu.c 2019-05-13 16:49:22 +0000
118@@ -24,8 +24,6 @@
119 #include "window-menu.h"
120 #include "indicator-appmenu-marshal.h"
121
122-#define WINDOW_MENU_GET_PRIVATE(o) \
123-(G_TYPE_INSTANCE_GET_PRIVATE ((o), WINDOW_MENU_TYPE, WindowMenuPrivate))
124
125 /* Signals */
126

Subscribers

People subscribed via source and target branches