Mir

Merge lp:~attente/mir/basic-menu-surface-position into lp:mir

Proposed by William Hua
Status: Rejected
Rejected by: Daniel van Vugt
Proposed branch: lp:~attente/mir/basic-menu-surface-position
Merge into: lp:mir
Diff against target: 40 lines (+22/-1)
1 file modified
src/server/shell/default_placement_strategy.cpp (+22/-1)
To merge this branch: bzr merge lp:~attente/mir/basic-menu-surface-position
Reviewer Review Type Date Requested Status
Alan Griffiths Disapprove
Daniel van Vugt Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+247440@code.launchpad.net

Commit message

Use attachment_rect for surface position when available.

Description of the change

Use attachment_rect for surface position when available.

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
Alan Griffiths (alan-griffiths) wrote :

1. Doesn't compile - see below
2. Is wrong - the placement should be relative to the parent window

[ 34%] Building CXX object src/server/shell/CMakeFiles/mirshell.dir/default_placement_strategy.cpp.o
/mir/src/server/shell/default_placement_strategy.cpp: In member function 'virtual mir::scene::SurfaceCreationParameters mir::shell::DefaultPlacementStrategy::place(const mir::scene::Session&, const mir::scene::SurfaceCreationParameters&)':
/mir/src/server/shell/default_placement_strategy.cpp:46:27: error: 'struct mir::scene::SurfaceCreationParameters' has no member named 'attachment_rect'
     if (placed_parameters.attachment_rect.is_set())
                           ^
/mir/src/server/shell/default_placement_strategy.cpp:47:54: error: 'struct mir::scene::SurfaceCreationParameters' has no member named 'attachment_rect'
       placed_parameters.top_left = placed_parameters.attachment_rect.value().bottom_left();
                                                      ^
src/server/shell/CMakeFiles/mirshell.dir/build.make:54: recipe for target 'src/server/shell/CMakeFiles/mirshell.dir/default_placement_strategy.cpp.o' failed
make[2]: *** [src/server/shell/CMakeFiles/mirshell.dir/default_placement_strategy.cpp.o] Error 1
CMakeFiles/Makefile2:3151: recipe for target 'src/server/shell/CMakeFiles/mirshell.dir/all' failed

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2249. By William Hua

Give surfaces a default depth.

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

Also keep in mind PlacementStrategy only represents initial surface placement. Most of the complexity is in what happens when a surface moves. So PlacementStrategy becomes less significant than coordinated move() logic for surfaces and their children.

In fact, move() policy could theoretically subsume PlacementStrategy in future. I don't think we need both.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(1)-(2) What Alan said.

(3) I'm pretty sure this depth feature only exists to support the test framework. It shouldn't have a use in production (should it?) ...
34 + placed_parameters.of_depth(ms::DepthId(depth));

review: Needs Fixing
Revision history for this message
William Hua (attente) wrote :

Thanks, (1) and (2) should be fixed now.

For (3), I used the depth because child surfaces were ending up on the same layer as their parents, which led to them (child surfaces) being obscured. I'm not sure if there's a more proper way to do that though. I guess I just assumed that child surfaces were generally above their parents. Is there another way to specify the position of the surface in the stacking order?

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I think this approach is doomed - DefaultPlacementStrategy only affects the initial placement of the window and, while abusing the depth does put the menu on top of the parent it also puts it on top of other surfaces too (even ones have focus).

To be effective there needs to be more "plumbing" in the window management to handle

It ignores client preferences as to where to locate the menu WRT to placement rectangle boundaries and allows both the parent and the menu to be moved independently.

review: Disapprove
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Hi William,
Thanks for the MP. However, we (the Mir team) should probably carefully consider what sort of plumbing should be laid out first. I recommend you raise this as a bug (unless one already exists) describing what's not working for you and we'll take a look. Please help us prioritize by setting the bug importance according to your situation. Thanks.

Unmerged revisions

2249. By William Hua

Give surfaces a default depth.

2248. By William Hua

Position relative to parent.

2247. By William Hua

attachment_rect -> aux_rect

2246. By William Hua

Merge lp:~andreas-pokorny/mir/fix-1414630.

2245. By William Hua

Merge lp:mir.

2244. By William Hua

Use attachment_rect for menu surface position.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/shell/default_placement_strategy.cpp'
2--- src/server/shell/default_placement_strategy.cpp 2015-01-14 06:39:13 +0000
3+++ src/server/shell/default_placement_strategy.cpp 2015-01-26 23:10:43 +0000
4@@ -17,6 +17,7 @@
5 */
6
7 #include "default_placement_strategy.h"
8+#include "mir/scene/surface.h"
9 #include "mir/scene/surface_creation_parameters.h"
10 #include "mir/shell/display_layout.h"
11 #include "mir/geometry/rectangle.h"
12@@ -43,7 +44,27 @@
13 mir_display_output_id_invalid};
14 auto placed_parameters = request_parameters;
15
16- geom::Rectangle rect{request_parameters.top_left, request_parameters.size};
17+ if (placed_parameters.aux_rect.is_set())
18+ placed_parameters.top_left = placed_parameters.aux_rect.value().bottom_left();
19+
20+ if (auto parent = placed_parameters.parent.lock())
21+ {
22+ auto origin = parent->top_left();
23+ placed_parameters.top_left = placed_parameters.top_left + geom::DeltaX(origin.x.as_int());
24+ placed_parameters.top_left = placed_parameters.top_left + geom::DeltaY(origin.y.as_int());
25+
26+ auto depth = 1;
27+
28+ while (parent)
29+ {
30+ parent = parent->parent();
31+ ++depth;
32+ }
33+
34+ placed_parameters.of_depth(ms::DepthId(depth));
35+ }
36+
37+ geom::Rectangle rect{placed_parameters.top_left, placed_parameters.size};
38
39 if (request_parameters.output_id != output_id_invalid)
40 {

Subscribers

People subscribed via source and target branches