Merge lp:~robertcarr/unity/webapps into lp:unity

Proposed by Robert Carr
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: no longer in the source branch.
Merged at revision: 2624
Proposed branch: lp:~robertcarr/unity/webapps
Merge into: lp:unity
Diff against target: 176 lines (+86/-9)
2 files modified
launcher/BamfLauncherIcon.cpp (+85/-9)
launcher/BamfLauncherIcon.h (+1/-0)
To merge this branch: bzr merge lp:~robertcarr/unity/webapps
Reviewer Review Type Date Requested Status
Timo Jyrinki Approve
Marco Trevisan (Treviño) Approve
Review via email: mp+120433@code.launchpad.net

Commit message

Webapps support for unity

Description of the change

>>158 + if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid) == false)
>> 159 + continue;

>> dNo way to fix this in bamf more than here? However the IsWindowOnCurrentDesktop would only check for the >> viewport..

We would need to add the bamf_window_get_monitor style interface to bamf tab. the way I would really like to solve this is to make BamfWindow and BamfTab both inherit from a BamfViewContainer type class but its a bit difficult to work out exactly how it should work, and certainly at this point.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

30 +
31

Whitespace brigade.

Otherwise looks okay.

Tests?

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Yes, we would probably need it tested. Robert?

Revision history for this message
Robert Carr (robertcarr) wrote :

We have a pretty fair amount of autopilot coverage. But it is currently in the middle of being ported to Q. Is this enough? Do we need to get the autopilot tests in the branch or can we agree to land them asap and go ahead and land the functionality?

Pretty worried about feature freeze :)

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

This looks good to me.

review: Approve
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, I approve it as well then - just as I already mentioned on IRC, would be great if you could post here the link to a branch with the AP-tests migration work-in-progress, so that we remember about it and can see how the progress goes. Those autopilot tests are _VERY_ important. Could you post those ASAP?

Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

(Approved as tests have been assured to come soon)

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/1107/console reported an error when processing this lp:~robertcarr/unity/webapps branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/1111/console reported an error when processing this lp:~robertcarr/unity/webapps branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/1113/console reported an error when processing this lp:~robertcarr/unity/webapps branch.
Not merging it.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Should now go through with rev 2609 in.

review: Approve
Revision history for this message
Sebastien Bacher (seb128) wrote :

don't approve it, that will need to come in a separate transition, see https://bugs.launchpad.net/ubuntu/+source/bamf/+bug/1040268

basically bamf abi,api changes and the soname needs to be changed and a transition needs to happen in a planned way, that's going to be after ff with a ffe though

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, we're after FF - so we can approve it.

The lp:bamf trunk already has webapps support, so accepting this merge proposal will only help us find possible problems earlier when using unity-team/staging. We'll try releasing everything next week.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/BamfLauncherIcon.cpp'
2--- launcher/BamfLauncherIcon.cpp 2012-08-17 00:27:16 +0000
3+++ launcher/BamfLauncherIcon.cpp 2012-08-21 21:50:36 +0000
4@@ -39,6 +39,8 @@
5 #include <glib/gi18n-lib.h>
6 #include <gio/gdesktopappinfo.h>
7
8+#include <libbamf/bamf-tab.h>
9+
10 namespace unity
11 {
12 namespace launcher
13@@ -93,6 +95,12 @@
14 sig = new glib::Signal<void, BamfView*, BamfView*>(bamf_view, "child-removed",
15 [&] (BamfView*, BamfView*) { EnsureWindowState(); });
16 _gsignals.Add(sig);
17+
18+ sig = new glib::Signal<void, BamfView*, BamfView*>(bamf_view, "child-moved",
19+ [&] (BamfView *, BamfView *) {
20+ EnsureWindowState();
21+ });
22+ _gsignals.Add(sig);
23
24 sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "urgent-changed",
25 [&] (BamfView*, gboolean urgent) {
26@@ -227,6 +235,7 @@
27 wm->Activate(arg.target);
28 return;
29 }
30+
31
32 /* We should check each child to see if there is
33 * an unmapped (!= minimized) window around and
34@@ -248,12 +257,17 @@
35
36 for (GList* l = children; l; l = l->next)
37 {
38- if (!BAMF_IS_WINDOW(l->data))
39- continue;
40-
41 auto view = static_cast<BamfView*>(l->data);
42 auto win = static_cast<BamfWindow*>(l->data);
43- Window xid = bamf_window_get_xid(win);
44+ Window xid;
45+
46+ if (BAMF_IS_WINDOW(l->data))
47+ xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
48+ else if (BAMF_IS_TAB(l->data))
49+ xid = bamf_tab_get_xid(static_cast<BamfTab*>(l->data));
50+ else
51+ continue;
52+
53
54 if (!any_visible && wm->IsWindowOnCurrentDesktop(xid))
55 {
56@@ -615,15 +629,45 @@
57 OpenInstanceWithUris(empty);
58 }
59
60-void BamfLauncherIcon::Focus(ActionArg arg)
61+std::vector<Window> BamfLauncherIcon::GetFocusableWindows(ActionArg arg, bool &any_visible, bool &any_urgent)
62 {
63- bool any_urgent = false;
64- bool any_visible = false;
65 bool any_user_visible = false;
66 WindowManager* wm = WindowManager::Default();
67
68 std::vector<Window> windows;
69- GList* children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
70+ GList* children;
71+
72+ BamfView *focusable_child = BAMF_VIEW (bamf_application_get_focusable_child (_bamf_app.RawPtr()));
73+
74+ if (focusable_child != NULL)
75+ {
76+ Window xid;
77+
78+ if (BAMF_IS_WINDOW (focusable_child))
79+ xid = bamf_window_get_xid (BAMF_WINDOW(focusable_child));
80+ else if (BAMF_IS_TAB (focusable_child))
81+ {
82+ BamfTab *focusable_tab = BAMF_TAB (focusable_child);
83+
84+ xid = bamf_tab_get_xid (focusable_tab);
85+
86+ bamf_tab_raise (focusable_tab);
87+ }
88+
89+ windows.push_back(xid);
90+ return windows;
91+ }
92+ else
93+ {
94+ if (g_strcmp0 (bamf_application_get_application_type (_bamf_app.RawPtr()), "webapp") == 0)
95+ {
96+ OpenInstanceLauncherIcon(arg);
97+
98+ return windows;
99+ }
100+ }
101+
102+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
103
104 /* get the list of windows */
105 for (GList* l = children; l; l = l->next)
106@@ -667,6 +711,16 @@
107 }
108
109 g_list_free(children);
110+
111+ return windows;
112+
113+}
114+
115+void BamfLauncherIcon::Focus(ActionArg arg)
116+{
117+ bool any_visible = false, any_urgent = false;
118+ WindowManager* wm = WindowManager::Default();
119+ std::vector<Window> windows = GetFocusableWindows(arg, any_visible, any_urgent);
120
121 auto visibility = WindowManager::FocusVisibility::OnlyVisible;
122
123@@ -702,11 +756,27 @@
124 GList* children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
125 for (GList* l = children; l; l = l->next)
126 {
127+ Window xid;
128+
129+ if (BAMF_IS_TAB(l->data))
130+ {
131+ /* BamfTab does not support the monitor interface...so a bit of a nasty hack here. */
132+ xid = bamf_tab_get_xid (static_cast<BamfTab*>(l->data));
133+
134+ if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid) == false)
135+ continue;
136+
137+ for (int j = 0; j < max_num_monitors; j++)
138+ monitors[j] = true;
139+
140+ continue;
141+ }
142+
143 if (!BAMF_IS_WINDOW(l->data))
144 continue;
145
146 auto window = static_cast<BamfWindow*>(l->data);
147- Window xid = bamf_window_get_xid(window);
148+ xid = bamf_window_get_xid(window);
149 int monitor = bamf_window_get_monitor(window);
150
151 if (monitor >= 0 && WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
152@@ -851,6 +921,12 @@
153
154 for (l = children; l; l = l->next)
155 {
156+ if (BAMF_IS_TAB (l->data))
157+ {
158+ // As Unity can not close a tab inside the provider application, we have to ask Bamf to delegate for us.
159+ bamf_tab_close (BAMF_TAB (l->data));
160+ continue;
161+ }
162 if (!BAMF_IS_WINDOW(l->data))
163 continue;
164
165
166=== modified file 'launcher/BamfLauncherIcon.h'
167--- launcher/BamfLauncherIcon.h 2012-08-15 02:51:33 +0000
168+++ launcher/BamfLauncherIcon.h 2012-08-21 21:50:36 +0000
169@@ -111,6 +111,7 @@
170
171 void OpenInstanceWithUris(std::set<std::string> uris);
172 void Focus(ActionArg arg);
173+ std::vector<Window> GetFocusableWindows(ActionArg arg, bool &any_visible, bool &any_urgent);
174 bool Spread(bool current_desktop, int state, bool force);
175
176 void OnWindowMinimized(guint32 xid);