Merge lp:~abreu-alexandre/bamf/fix-chromeless-matching-for-webapps into lp:bamf/0.4

Proposed by Alexandre Abreu
Status: Superseded
Proposed branch: lp:~abreu-alexandre/bamf/fix-chromeless-matching-for-webapps
Merge into: lp:bamf/0.4
Diff against target: 173 lines (+82/-11)
3 files modified
src/bamf-matcher.c (+68/-10)
src/bamf-unity-webapps-tab.c (+12/-0)
src/bamf-unity-webapps-tab.h (+2/-1)
To merge this branch: bzr merge lp:~abreu-alexandre/bamf/fix-chromeless-matching-for-webapps
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Needs Fixing
Alexandre Abreu (community) Needs Resubmitting
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+149860@code.launchpad.net

This proposal has been superseded by a proposal from 2013-04-16.

Commit message

Fix chromeless launch for webapps: avoid double matching (browser + individual webapp)

Description of the change

Fix chromeless launch for webapps: avoid double matching (browser + individual webapp)

Fixes https://bugs.launchpad.net/libunity-webapps/+bug/1059475

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:523
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~abreu-alexandre/bamf/fix-chromeless-matching-for-webapps/+merge/149860/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/bamf-mbs-ci/42/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/bamf-mbs-ci/./build=pbuilder,distribution=quantal,flavor=amd64/42/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/bamf-mbs-ci/./build=pbuilder,distribution=quantal,flavor=i386/42/console

Click here to trigger a rebuild:
http://jenkins.qa.ubuntu.com/job/bamf-mbs-ci/42//rebuild/?

review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Needs Resubmitting
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

So, sorry for the big delay.

I've finally reviewed this bug, this fix breaks the fix for lp:692462, and we really don't want it.

Basically running "chromium-browser --app=http://google.com" with this causes to get a floating window with no related application icon at all.

review: Needs Fixing

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bamf-matcher.c'
2--- src/bamf-matcher.c 2013-01-29 19:06:11 +0000
3+++ src/bamf-matcher.c 2013-02-21 15:32:27 +0000
4@@ -28,6 +28,7 @@
5
6 #ifdef HAVE_WEBAPPS
7 #include "bamf-unity-webapps-application.h"
8+#include "bamf-unity-webapps-tab.h"
9 #endif
10 #include <strings.h>
11
12@@ -1601,16 +1602,8 @@
13
14 if (!filter_by_wmclass)
15 {
16- if (is_web_app_window (window))
17- {
18- // This ensures that a new application is created even for unknown webapps
19- filter_by_wmclass = TRUE;
20- }
21- else
22- {
23- target_class = class_name;
24- filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file (self, target_class);
25- }
26+ target_class = class_name;
27+ filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file (self, target_class);
28 }
29
30 if (desktop_file)
31@@ -1998,6 +1991,7 @@
32 if (pid > 1 && !g_list_find (self->priv->known_pids, GUINT_TO_POINTER (pid)))
33 self->priv->known_pids = g_list_prepend (self->priv->known_pids, GUINT_TO_POINTER (pid));
34
35+
36 ensure_window_hint_set (self, window);
37
38 /* We need to make our objects for bus export, the quickest way to do this, though not
39@@ -2113,6 +2107,13 @@
40 return;
41 }
42
43+ // A new chromeless webapp window will be "matched" later
44+ // when the context daemon pick up the new "interest" in
45+ // on_webapp_child_added to avoid duplicates (matching on the
46+ // browser AND the webapp itself)
47+ if (is_web_app_window(window))
48+ return;
49+
50 if (is_open_office_window (self, window))
51 {
52 win_type = bamf_legacy_window_get_window_type (window);
53@@ -2809,14 +2810,71 @@
54 }
55
56 #ifdef HAVE_WEBAPPS
57+static gboolean
58+does_webapp_tab_with_xid_exists(BamfMatcher *matcher, guint64 xid)
59+{
60+ GList *l;
61+ BamfView *view;
62+
63+ g_return_val_if_fail(matcher != NULL, FALSE);
64+ g_return_val_if_fail(matcher->priv != NULL, FALSE);
65+
66+ for (l = matcher->priv->views; l; l = l->next)
67+ {
68+ view = l->data;
69+ if (!BAMF_IS_UNITY_WEBAPPS_TAB (view))
70+ continue;
71+
72+ if (xid == bamf_tab_get_xid(BAMF_TAB(view)))
73+ break;
74+ }
75+ return l != NULL;
76+}
77+
78 static void
79 on_webapp_child_added (BamfView *application,
80 BamfView *child,
81 gpointer user_data)
82 {
83 BamfMatcher *self;
84+ BamfLegacyWindow * legacy_window;
85
86 self = (BamfMatcher *)user_data;
87+
88+ if (!BAMF_IS_UNITY_WEBAPPS_TAB(child))
89+ return;
90+
91+ legacy_window =
92+ bamf_unity_webapps_tab_get_legacy_window_for(BAMF_UNITY_WEBAPPS_TAB(child));
93+
94+ if (is_web_app_window(legacy_window))
95+ {
96+ // Quickly check if we need to create an main window for
97+ // this chromeless webapp (so that unity can pick it up as an
98+ // independant window: see
99+ // BamfApplicationManager::create_window & friends)
100+ g_debug("Chromeless webapp launch detected: '%s'",
101+ bamf_legacy_window_get_name (legacy_window));
102+
103+ gboolean do_register_bamf_window = TRUE;
104+ if (self->priv->views
105+ && does_webapp_tab_with_xid_exists(self, bamf_tab_get_xid(BAMF_TAB(child))))
106+ do_register_bamf_window = FALSE;
107+
108+ if (do_register_bamf_window)
109+ {
110+ bamf_matcher_register_view_stealing_ref (self,
111+ BAMF_VIEW (bamf_window_new (legacy_window)));
112+ }
113+ else
114+ {
115+ g_debug("Found at least another window/tab for chromeless"
116+ " webapp '%s' and same window id",
117+ bamf_legacy_window_get_name (legacy_window));
118+ }
119+ }
120+
121+ // In all cases register the new tab with the "Launcher" & bamf views
122 bamf_matcher_register_view_stealing_ref (self, child);
123 }
124
125
126=== modified file 'src/bamf-unity-webapps-tab.c'
127--- src/bamf-unity-webapps-tab.c 2013-02-04 19:19:57 +0000
128+++ src/bamf-unity-webapps-tab.c 2013-02-21 15:32:27 +0000
129@@ -402,11 +402,23 @@
130 gint
131 bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab)
132 {
133+ g_return_val_if_fail(tab != NULL, -1);
134+ g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), -1);
135 return tab->priv->interest_id;
136 }
137
138+BamfLegacyWindow*
139+bamf_unity_webapps_tab_get_legacy_window_for (BamfUnityWebappsTab *tab)
140+{
141+ g_return_val_if_fail(tab != NULL, NULL);
142+ g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), NULL);
143+ return tab->priv->legacy_window;
144+}
145+
146 BamfUnityWebappsTab *
147 bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id)
148 {
149 return (BamfUnityWebappsTab *)g_object_new (BAMF_TYPE_UNITY_WEBAPPS_TAB, "context", context, "interest-id", interest_id, NULL);
150 }
151+
152+
153
154=== modified file 'src/bamf-unity-webapps-tab.h'
155--- src/bamf-unity-webapps-tab.h 2012-08-21 22:01:48 +0000
156+++ src/bamf-unity-webapps-tab.h 2013-02-21 15:32:27 +0000
157@@ -23,6 +23,7 @@
158
159 #include <unity-webapps-context.h>
160
161+#include "bamf-legacy-window.h"
162 #include "bamf-tab.h"
163
164
165@@ -55,7 +56,7 @@
166 BamfUnityWebappsTab *bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id);
167
168 gint bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab);
169-
170+BamfLegacyWindow* bamf_unity_webapps_tab_get_legacy_window_for(BamfUnityWebappsTab *tab);
171
172
173 #endif

Subscribers

People subscribed via source and target branches