Merge lp:~3v1n0/unity/panel-titles-fixes into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3976
Proposed branch: lp:~3v1n0/unity/panel-titles-fixes
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/application-manager-new
Diff against target: 71 lines (+18/-11)
2 files modified
panel/PanelMenuView.cpp (+11/-10)
unity-shared/BamfApplicationManager.cpp (+7/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/panel-titles-fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend Approve
Review via email: mp+256995@code.launchpad.net

Commit message

PanelMenuView: connect to target window / application title changes

This will be smart enough to work with LIM and global menus

Description of the change

We need to connect to title changes for relevant windows, so we monitor the maximized window on LIM case and the active one otherwise.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Yep, fixes the issue and I see no apparent regressions. Jenkins failure is due to space running out.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/PanelMenuView.cpp'
2--- panel/PanelMenuView.cpp 2015-04-22 13:04:53 +0000
3+++ panel/PanelMenuView.cpp 2015-04-22 13:04:54 +0000
4@@ -272,6 +272,16 @@
5 if (old_target != target_window)
6 {
7 window_buttons_->controlled_window = target_window;
8+
9+ if (ApplicationWindowPtr const& win = ApplicationManager::Default().GetWindowForId(target_window))
10+ {
11+ auto refresh_cb = sigc::hide(sigc::mem_fun(this, &PanelMenuView::RefreshAndRedraw));
12+ win_name_changed_conn_ = win->title.changed.connect(refresh_cb);
13+
14+ if (ApplicationPtr const& app = win->application())
15+ app_name_changed_conn_ = app->title.changed.connect(refresh_cb);
16+ }
17+
18 ClearEntries();
19
20 if (indicator::AppmenuIndicator::Ptr appmenu = menu_manager_->AppMenu())
21@@ -771,7 +781,7 @@
22 return "";
23 }
24
25- if (WindowManager::Default().IsWindowMaximized(window_xid) && !use_appname)
26+ if (window_xid == maximized_window() && !use_appname)
27 label = window->title();
28
29 if (label.empty())
30@@ -1029,10 +1039,6 @@
31 {
32 if (new_app)
33 {
34- app_name_changed_conn_ = new_app->title.changed.connect([this] (std::string const&t) {
35- RefreshAndRedraw();
36- });
37-
38 if (integrated_menus_ || always_show_menus_)
39 return;
40
41@@ -1095,11 +1101,6 @@
42 maximized_wins_.push_front(active_xid);
43 UpdateMaximizedWindow();
44 }
45-
46- // register callback for new view
47- win_name_changed_conn_ = new_win->title.changed.connect([this] (std::string const& t) {
48- RefreshAndRedraw();
49- });
50 }
51
52 active_window = active_xid;
53
54=== modified file 'unity-shared/BamfApplicationManager.cpp'
55--- unity-shared/BamfApplicationManager.cpp 2015-04-22 13:04:53 +0000
56+++ unity-shared/BamfApplicationManager.cpp 2015-04-22 13:04:54 +0000
57@@ -640,7 +640,13 @@
58 if (xid == 0)
59 return nullptr;
60
61- std::shared_ptr<GList> windows(bamf_matcher_get_windows(matcher_), g_list_free);
62+ // TODO: use bamf_matcher_get_window_for_xid
63+ auto* app = bamf_matcher_get_application_for_xid(matcher_, xid);
64+
65+ if (!app)
66+ return nullptr;
67+
68+ std::shared_ptr<GList> windows(bamf_view_get_children(reinterpret_cast<BamfView*>(app)), g_list_free);
69
70 for (GList* l = windows.get(); l; l = l->next)
71 {