Merge lp:~alan-griffiths/miral/fix-1628981 into lp:miral

Proposed by Alan Griffiths
Status: Merged
Approved by: Gerry Boland
Approved revision: 376
Merged at revision: 374
Proposed branch: lp:~alan-griffiths/miral/fix-1628981
Merge into: lp:miral
Diff against target: 70 lines (+15/-4)
4 files modified
miral-shell/titlebar_window_manager.cpp (+7/-1)
miral/basic_window_manager.cpp (+1/-1)
miral/window_info.cpp (+5/-2)
test/test_window_manager_tools.h (+2/-0)
To merge this branch: bzr merge lp:~alan-griffiths/miral/fix-1628981
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+307282@code.launchpad.net

Commit message

Fix focus logic: Surfaces that have not painted are not visible; surfaces that are not visible should not become active; and, titlebars cannot rely on the parent advise_focus_lost() events arriving after the titlebar creation.

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

Looks ok

review: Approve
lp:~alan-griffiths/miral/fix-1628981 updated
377. By Alan Griffiths

Fix broken test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'miral-shell/titlebar_window_manager.cpp'
2--- miral-shell/titlebar_window_manager.cpp 2016-09-28 11:42:35 +0000
3+++ miral-shell/titlebar_window_manager.cpp 2016-09-30 09:40:01 +0000
4@@ -268,7 +268,13 @@
5 if (application == titlebar_provider->session())
6 {
7 titlebar_provider->advise_new_titlebar(window_info);
8- return;
9+
10+ auto const parent = window_info.parent();
11+
12+ if (tools.active_window() == parent)
13+ titlebar_provider->paint_titlebar_for(parent, 0xFF);
14+ else
15+ titlebar_provider->paint_titlebar_for(parent, 0x3F);
16 }
17 }
18
19
20=== modified file 'miral/basic_window_manager.cpp'
21--- miral/basic_window_manager.cpp 2016-09-23 16:55:46 +0000
22+++ miral/basic_window_manager.cpp 2016-09-30 09:40:01 +0000
23@@ -892,7 +892,7 @@
24 }
25 }
26
27- if (info_for_hint.can_be_active())
28+ if (info_for_hint.can_be_active() && info_for_hint.is_visible())
29 {
30 mru_active_windows.push(hint);
31 focus_controller->set_focus_to(hint.application(), hint);
32
33=== modified file 'miral/window_info.cpp'
34--- miral/window_info.cpp 2016-09-23 14:13:40 +0000
35+++ miral/window_info.cpp 2016-09-30 09:40:01 +0000
36@@ -18,6 +18,8 @@
37
38 #include "miral/window_info.h"
39
40+#include <mir/scene/surface.h>
41+
42 #include <limits>
43
44 using namespace mir::geometry;
45@@ -213,9 +215,10 @@
46 case mir_surface_state_minimized:
47 return false;
48 default:
49- break;
50+ if (std::shared_ptr<mir::scene::Surface> surface = window())
51+ return surface->visible();
52 }
53- return true;
54+ return false;
55 }
56
57 void miral::WindowInfo::constrain_resize(Point& requested_pos, Size& requested_size) const
58
59=== modified file 'test/test_window_manager_tools.h'
60--- test/test_window_manager_tools.h 2016-09-23 11:59:53 +0000
61+++ test/test_window_manager_tools.h 2016-09-30 09:40:01 +0000
62@@ -86,6 +86,8 @@
63 mir::geometry::Size size() const override { return size_; }
64 void resize(mir::geometry::Size const& size) override { size_ = size; }
65
66+ bool visible() const override { return true; }
67+
68 std::string name_;
69 MirSurfaceType type_;
70 mir::geometry::Point top_left_;

Subscribers

People subscribed via source and target branches