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
=== modified file 'launcher/BamfLauncherIcon.cpp'
--- launcher/BamfLauncherIcon.cpp 2012-08-17 00:27:16 +0000
+++ launcher/BamfLauncherIcon.cpp 2012-08-21 21:50:36 +0000
@@ -39,6 +39,8 @@
39#include <glib/gi18n-lib.h>39#include <glib/gi18n-lib.h>
40#include <gio/gdesktopappinfo.h>40#include <gio/gdesktopappinfo.h>
4141
42#include <libbamf/bamf-tab.h>
43
42namespace unity44namespace unity
43{45{
44namespace launcher46namespace launcher
@@ -93,6 +95,12 @@
93 sig = new glib::Signal<void, BamfView*, BamfView*>(bamf_view, "child-removed",95 sig = new glib::Signal<void, BamfView*, BamfView*>(bamf_view, "child-removed",
94 [&] (BamfView*, BamfView*) { EnsureWindowState(); });96 [&] (BamfView*, BamfView*) { EnsureWindowState(); });
95 _gsignals.Add(sig);97 _gsignals.Add(sig);
98
99 sig = new glib::Signal<void, BamfView*, BamfView*>(bamf_view, "child-moved",
100 [&] (BamfView *, BamfView *) {
101 EnsureWindowState();
102 });
103 _gsignals.Add(sig);
96104
97 sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "urgent-changed",105 sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "urgent-changed",
98 [&] (BamfView*, gboolean urgent) {106 [&] (BamfView*, gboolean urgent) {
@@ -227,6 +235,7 @@
227 wm->Activate(arg.target);235 wm->Activate(arg.target);
228 return;236 return;
229 }237 }
238
230239
231 /* We should check each child to see if there is240 /* We should check each child to see if there is
232 * an unmapped (!= minimized) window around and241 * an unmapped (!= minimized) window around and
@@ -248,12 +257,17 @@
248257
249 for (GList* l = children; l; l = l->next)258 for (GList* l = children; l; l = l->next)
250 {259 {
251 if (!BAMF_IS_WINDOW(l->data))
252 continue;
253
254 auto view = static_cast<BamfView*>(l->data);260 auto view = static_cast<BamfView*>(l->data);
255 auto win = static_cast<BamfWindow*>(l->data);261 auto win = static_cast<BamfWindow*>(l->data);
256 Window xid = bamf_window_get_xid(win);262 Window xid;
263
264 if (BAMF_IS_WINDOW(l->data))
265 xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
266 else if (BAMF_IS_TAB(l->data))
267 xid = bamf_tab_get_xid(static_cast<BamfTab*>(l->data));
268 else
269 continue;
270
257271
258 if (!any_visible && wm->IsWindowOnCurrentDesktop(xid))272 if (!any_visible && wm->IsWindowOnCurrentDesktop(xid))
259 {273 {
@@ -615,15 +629,45 @@
615 OpenInstanceWithUris(empty);629 OpenInstanceWithUris(empty);
616}630}
617631
618void BamfLauncherIcon::Focus(ActionArg arg)632std::vector<Window> BamfLauncherIcon::GetFocusableWindows(ActionArg arg, bool &any_visible, bool &any_urgent)
619{633{
620 bool any_urgent = false;
621 bool any_visible = false;
622 bool any_user_visible = false;634 bool any_user_visible = false;
623 WindowManager* wm = WindowManager::Default();635 WindowManager* wm = WindowManager::Default();
624636
625 std::vector<Window> windows;637 std::vector<Window> windows;
626 GList* children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));638 GList* children;
639
640 BamfView *focusable_child = BAMF_VIEW (bamf_application_get_focusable_child (_bamf_app.RawPtr()));
641
642 if (focusable_child != NULL)
643 {
644 Window xid;
645
646 if (BAMF_IS_WINDOW (focusable_child))
647 xid = bamf_window_get_xid (BAMF_WINDOW(focusable_child));
648 else if (BAMF_IS_TAB (focusable_child))
649 {
650 BamfTab *focusable_tab = BAMF_TAB (focusable_child);
651
652 xid = bamf_tab_get_xid (focusable_tab);
653
654 bamf_tab_raise (focusable_tab);
655 }
656
657 windows.push_back(xid);
658 return windows;
659 }
660 else
661 {
662 if (g_strcmp0 (bamf_application_get_application_type (_bamf_app.RawPtr()), "webapp") == 0)
663 {
664 OpenInstanceLauncherIcon(arg);
665
666 return windows;
667 }
668 }
669
670 children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
627671
628 /* get the list of windows */672 /* get the list of windows */
629 for (GList* l = children; l; l = l->next)673 for (GList* l = children; l; l = l->next)
@@ -667,6 +711,16 @@
667 }711 }
668712
669 g_list_free(children);713 g_list_free(children);
714
715 return windows;
716
717}
718
719void BamfLauncherIcon::Focus(ActionArg arg)
720{
721 bool any_visible = false, any_urgent = false;
722 WindowManager* wm = WindowManager::Default();
723 std::vector<Window> windows = GetFocusableWindows(arg, any_visible, any_urgent);
670724
671 auto visibility = WindowManager::FocusVisibility::OnlyVisible;725 auto visibility = WindowManager::FocusVisibility::OnlyVisible;
672726
@@ -702,11 +756,27 @@
702 GList* children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));756 GList* children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
703 for (GList* l = children; l; l = l->next)757 for (GList* l = children; l; l = l->next)
704 {758 {
759 Window xid;
760
761 if (BAMF_IS_TAB(l->data))
762 {
763 /* BamfTab does not support the monitor interface...so a bit of a nasty hack here. */
764 xid = bamf_tab_get_xid (static_cast<BamfTab*>(l->data));
765
766 if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid) == false)
767 continue;
768
769 for (int j = 0; j < max_num_monitors; j++)
770 monitors[j] = true;
771
772 continue;
773 }
774
705 if (!BAMF_IS_WINDOW(l->data))775 if (!BAMF_IS_WINDOW(l->data))
706 continue;776 continue;
707777
708 auto window = static_cast<BamfWindow*>(l->data);778 auto window = static_cast<BamfWindow*>(l->data);
709 Window xid = bamf_window_get_xid(window);779 xid = bamf_window_get_xid(window);
710 int monitor = bamf_window_get_monitor(window);780 int monitor = bamf_window_get_monitor(window);
711781
712 if (monitor >= 0 && WindowManager::Default()->IsWindowOnCurrentDesktop(xid))782 if (monitor >= 0 && WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
@@ -851,6 +921,12 @@
851921
852 for (l = children; l; l = l->next)922 for (l = children; l; l = l->next)
853 {923 {
924 if (BAMF_IS_TAB (l->data))
925 {
926 // As Unity can not close a tab inside the provider application, we have to ask Bamf to delegate for us.
927 bamf_tab_close (BAMF_TAB (l->data));
928 continue;
929 }
854 if (!BAMF_IS_WINDOW(l->data))930 if (!BAMF_IS_WINDOW(l->data))
855 continue;931 continue;
856932
857933
=== modified file 'launcher/BamfLauncherIcon.h'
--- launcher/BamfLauncherIcon.h 2012-08-15 02:51:33 +0000
+++ launcher/BamfLauncherIcon.h 2012-08-21 21:50:36 +0000
@@ -111,6 +111,7 @@
111111
112 void OpenInstanceWithUris(std::set<std::string> uris);112 void OpenInstanceWithUris(std::set<std::string> uris);
113 void Focus(ActionArg arg);113 void Focus(ActionArg arg);
114 std::vector<Window> GetFocusableWindows(ActionArg arg, bool &any_visible, bool &any_urgent);
114 bool Spread(bool current_desktop, int state, bool force);115 bool Spread(bool current_desktop, int state, bool force);
115116
116 void OnWindowMinimized(guint32 xid);117 void OnWindowMinimized(guint32 xid);