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
=== modified file 'src/bamf-matcher.c'
--- src/bamf-matcher.c 2013-01-29 19:06:11 +0000
+++ src/bamf-matcher.c 2013-02-21 15:32:27 +0000
@@ -28,6 +28,7 @@
2828
29#ifdef HAVE_WEBAPPS29#ifdef HAVE_WEBAPPS
30#include "bamf-unity-webapps-application.h"30#include "bamf-unity-webapps-application.h"
31#include "bamf-unity-webapps-tab.h"
31#endif32#endif
32#include <strings.h>33#include <strings.h>
3334
@@ -1601,16 +1602,8 @@
16011602
1602 if (!filter_by_wmclass)1603 if (!filter_by_wmclass)
1603 {1604 {
1604 if (is_web_app_window (window))1605 target_class = class_name;
1605 {1606 filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file (self, target_class);
1606 // This ensures that a new application is created even for unknown webapps
1607 filter_by_wmclass = TRUE;
1608 }
1609 else
1610 {
1611 target_class = class_name;
1612 filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file (self, target_class);
1613 }
1614 }1607 }
16151608
1616 if (desktop_file)1609 if (desktop_file)
@@ -1998,6 +1991,7 @@
1998 if (pid > 1 && !g_list_find (self->priv->known_pids, GUINT_TO_POINTER (pid)))1991 if (pid > 1 && !g_list_find (self->priv->known_pids, GUINT_TO_POINTER (pid)))
1999 self->priv->known_pids = g_list_prepend (self->priv->known_pids, GUINT_TO_POINTER (pid));1992 self->priv->known_pids = g_list_prepend (self->priv->known_pids, GUINT_TO_POINTER (pid));
20001993
1994
2001 ensure_window_hint_set (self, window);1995 ensure_window_hint_set (self, window);
20021996
2003 /* We need to make our objects for bus export, the quickest way to do this, though not1997 /* We need to make our objects for bus export, the quickest way to do this, though not
@@ -2113,6 +2107,13 @@
2113 return;2107 return;
2114 }2108 }
21152109
2110 // A new chromeless webapp window will be "matched" later
2111 // when the context daemon pick up the new "interest" in
2112 // on_webapp_child_added to avoid duplicates (matching on the
2113 // browser AND the webapp itself)
2114 if (is_web_app_window(window))
2115 return;
2116
2116 if (is_open_office_window (self, window))2117 if (is_open_office_window (self, window))
2117 {2118 {
2118 win_type = bamf_legacy_window_get_window_type (window);2119 win_type = bamf_legacy_window_get_window_type (window);
@@ -2809,14 +2810,71 @@
2809}2810}
28102811
2811#ifdef HAVE_WEBAPPS2812#ifdef HAVE_WEBAPPS
2813static gboolean
2814does_webapp_tab_with_xid_exists(BamfMatcher *matcher, guint64 xid)
2815{
2816 GList *l;
2817 BamfView *view;
2818
2819 g_return_val_if_fail(matcher != NULL, FALSE);
2820 g_return_val_if_fail(matcher->priv != NULL, FALSE);
2821
2822 for (l = matcher->priv->views; l; l = l->next)
2823 {
2824 view = l->data;
2825 if (!BAMF_IS_UNITY_WEBAPPS_TAB (view))
2826 continue;
2827
2828 if (xid == bamf_tab_get_xid(BAMF_TAB(view)))
2829 break;
2830 }
2831 return l != NULL;
2832}
2833
2812static void2834static void
2813on_webapp_child_added (BamfView *application,2835on_webapp_child_added (BamfView *application,
2814 BamfView *child,2836 BamfView *child,
2815 gpointer user_data)2837 gpointer user_data)
2816{2838{
2817 BamfMatcher *self;2839 BamfMatcher *self;
2840 BamfLegacyWindow * legacy_window;
28182841
2819 self = (BamfMatcher *)user_data;2842 self = (BamfMatcher *)user_data;
2843
2844 if (!BAMF_IS_UNITY_WEBAPPS_TAB(child))
2845 return;
2846
2847 legacy_window =
2848 bamf_unity_webapps_tab_get_legacy_window_for(BAMF_UNITY_WEBAPPS_TAB(child));
2849
2850 if (is_web_app_window(legacy_window))
2851 {
2852 // Quickly check if we need to create an main window for
2853 // this chromeless webapp (so that unity can pick it up as an
2854 // independant window: see
2855 // BamfApplicationManager::create_window & friends)
2856 g_debug("Chromeless webapp launch detected: '%s'",
2857 bamf_legacy_window_get_name (legacy_window));
2858
2859 gboolean do_register_bamf_window = TRUE;
2860 if (self->priv->views
2861 && does_webapp_tab_with_xid_exists(self, bamf_tab_get_xid(BAMF_TAB(child))))
2862 do_register_bamf_window = FALSE;
2863
2864 if (do_register_bamf_window)
2865 {
2866 bamf_matcher_register_view_stealing_ref (self,
2867 BAMF_VIEW (bamf_window_new (legacy_window)));
2868 }
2869 else
2870 {
2871 g_debug("Found at least another window/tab for chromeless"
2872 " webapp '%s' and same window id",
2873 bamf_legacy_window_get_name (legacy_window));
2874 }
2875 }
2876
2877 // In all cases register the new tab with the "Launcher" & bamf views
2820 bamf_matcher_register_view_stealing_ref (self, child);2878 bamf_matcher_register_view_stealing_ref (self, child);
2821}2879}
28222880
28232881
=== modified file 'src/bamf-unity-webapps-tab.c'
--- src/bamf-unity-webapps-tab.c 2013-02-04 19:19:57 +0000
+++ src/bamf-unity-webapps-tab.c 2013-02-21 15:32:27 +0000
@@ -402,11 +402,23 @@
402gint 402gint
403bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab)403bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab)
404{404{
405 g_return_val_if_fail(tab != NULL, -1);
406 g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), -1);
405 return tab->priv->interest_id;407 return tab->priv->interest_id;
406}408}
407409
410BamfLegacyWindow*
411bamf_unity_webapps_tab_get_legacy_window_for (BamfUnityWebappsTab *tab)
412{
413 g_return_val_if_fail(tab != NULL, NULL);
414 g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), NULL);
415 return tab->priv->legacy_window;
416}
417
408BamfUnityWebappsTab *418BamfUnityWebappsTab *
409bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id)419bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id)
410{420{
411 return (BamfUnityWebappsTab *)g_object_new (BAMF_TYPE_UNITY_WEBAPPS_TAB, "context", context, "interest-id", interest_id, NULL);421 return (BamfUnityWebappsTab *)g_object_new (BAMF_TYPE_UNITY_WEBAPPS_TAB, "context", context, "interest-id", interest_id, NULL);
412}422}
423
424
413425
=== modified file 'src/bamf-unity-webapps-tab.h'
--- src/bamf-unity-webapps-tab.h 2012-08-21 22:01:48 +0000
+++ src/bamf-unity-webapps-tab.h 2013-02-21 15:32:27 +0000
@@ -23,6 +23,7 @@
2323
24#include <unity-webapps-context.h>24#include <unity-webapps-context.h>
2525
26#include "bamf-legacy-window.h"
26#include "bamf-tab.h"27#include "bamf-tab.h"
2728
2829
@@ -55,7 +56,7 @@
55BamfUnityWebappsTab *bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id);56BamfUnityWebappsTab *bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id);
5657
57gint bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab);58gint bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab);
5859BamfLegacyWindow* bamf_unity_webapps_tab_get_legacy_window_for(BamfUnityWebappsTab *tab);
5960
6061
61#endif62#endif

Subscribers

People subscribed via source and target branches