Mir

Merge lp://staging/~vanvugt/mir/parenting-server-api into lp://staging/mir

Proposed by Daniel van Vugt
Status: Superseded
Proposed branch: lp://staging/~vanvugt/mir/parenting-server-api
Merge into: lp://staging/mir
Diff against target: 498 lines (+191/-10)
21 files modified
client-ABI-sha1sums (+1/-1)
common-ABI-sha1sums (+1/-1)
include/common/mir_toolkit/common.h (+6/-0)
include/server/mir/frontend/session.h (+2/-0)
include/server/mir/frontend/surface.h (+3/-0)
platform-ABI-sha1sums (+1/-1)
server-ABI-sha1sums (+3/-3)
src/server/frontend/session_mediator.cpp (+1/-2)
src/server/scene/application_session.cpp (+17/-0)
src/server/scene/application_session.h (+1/-0)
src/server/scene/basic_surface.cpp (+37/-0)
src/server/scene/basic_surface.h (+5/-0)
tests/include/mir_test_doubles/mock_frontend_surface.h (+3/-0)
tests/include/mir_test_doubles/mock_surface.h (+3/-0)
tests/include/mir_test_doubles/stub_scene_session.h (+4/-0)
tests/include/mir_test_doubles/stub_scene_surface.h (+2/-0)
tests/include/mir_test_doubles/stub_session.h (+4/-0)
tests/unit-tests/client/test_client_mir_surface.cpp (+2/-1)
tests/unit-tests/scene/test_application_session.cpp (+46/-0)
tests/unit-tests/scene/test_basic_surface.cpp (+14/-1)
tests/unit-tests/scene/test_surface_impl.cpp (+35/-0)
To merge this branch: bzr merge lp://staging/~vanvugt/mir/parenting-server-api
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Needs Fixing
Review via email: mp+240410@code.staging.launchpad.net

This proposal has been superseded by a proposal from 2014-11-06.

Commit message

Introduce basic surface parent information in the server API.

Description of the change

Server ABI broken, but we have already bumped it for this series.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

59 + virtual void set_parent(std::weak_ptr<Surface> const&, int id) = 0;

It can't be right that both a pointer and an int are passed here.

Presumably they are both ways of referencing the same parent and passing them separately makes the interface easy to abuse.

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

Alan: Actually yes that's the messy part, but is the lesser evil.

The problem is that surface ID is only meaningful in the upper layer (SessionMediator) where it's a key into the map. Down in the scene::Surface and scene::BasicSurface it's meaningless to mention IDs. So the obvious answer then is don't mention any surface ID in the lower layers (set_parent). You can indeed omit the "int id", but that creates two problems:
  1. query() doesn't work at all, because the surface implementation doesn't known its parent ID.
  2. Any future use of query(mir_surface_attrib_parent) in the upper layers would require bespoke hacks in the SessionMediator (return parent() and linear search for the surface pointer to get the ID).

So the options are either live with issues #1 & #2, or the current design to pass in the surface ID separately for storage in the BasicSurface's attribute list (which costs nothing as the memory is already reserved).

That said, making query() return no useful result looks like it could suffice for now. And it would simplify the interface as you point out. I might try it.

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

OK, I tried making set_parent a one-parameter function. It got really ugly. I then had to document that query(mir_surface_attrib_parent) is non-functional, also lost parent-changed event support, and the resulting hacks required to make tests work again were too ugly. Because "parent" then became effectively not a surface attribute any more.

set_parent with two parameters is certainly cleaner, and more functional.

Alternatively, we could clean it up by adding an id() to scene::Surface, but I think that's unnecessary, more complex, and would be equally easy to abuse. The current proposal seems best.

2027. By Daniel van Vugt

Merge latest development-branch

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

Hm. As mentioned on the client-side of this proposal I suspect it would make more sense for parent to _not_ be a surface attribute, but a create-time option; that should neatly resolve the problem that the int parameter of
59 + virtual void set_parent(std::weak_ptr<Surface> const&, int id) = 0;
is solving?

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

59 + virtual void set_parent(std::weak_ptr<Surface> const&, int id) = 0;

The int id needs to go away.

"Alternatively, we could clean it up by adding an id() to scene::Surface, but I think that's unnecessary, more complex, and would be equally easy to abuse."

Why would that be equally easy to abuse? Ids for a surface would be created at construction time and never change.

" Because "parent" then became effectively not a surface attribute any more."

Perhaps that's a strong hint that it isn't then.

So I think the path to resolve this "needs fixing" is indeed to ad an id to Surface.

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

It's ugly because:
  * id() to a Surface object is meaningless. Only external users of the surface need the ID.
  * You either have to make the constructor take an ID parameter (more annoying coupling), or add a set_id() function which is the part that would be equally easy to abuse.

But if it unblocks us, I might give it a go.

2028. By Daniel van Vugt

Merge latest trunk

2029. By Daniel van Vugt

Merge latest trunk

2030. By Daniel van Vugt

Remove the controversial "int id" parameter.

2031. By Daniel van Vugt

(Re)introduce Session::configure_surface for binding attribute values
with session information (parent surface IDs).

Fun fact: the mock classes already have this method from a former life.
Somebody forgot to delete it :)

2032. By Daniel van Vugt

Add a unit test for ApplicationSession::configure_surface()

2033. By Daniel van Vugt

Expand new test to verify parenting occurs

2034. By Daniel van Vugt

Also verify that configure_surface() gives the correct shared_ptr to
set_parent().

2035. By Daniel van Vugt

Merge latest trunk

2036. By Daniel van Vugt

Add a dummy expectation to silence gmock (part of LP: #1390312)

2037. By Daniel van Vugt

Merge latest trunk

2038. By Daniel van Vugt

Merge latest trunk

2039. By Daniel van Vugt

Merge latest trunk and fix conflicts.

2040. By Daniel van Vugt

Tidy up ApplicationSession unit-tests' mocks.

2041. By Daniel van Vugt

Merge latest trunk

2042. By Daniel van Vugt

Merge latest trunk

2043. By Daniel van Vugt

Merge latest trunk

Unmerged revisions

2043. By Daniel van Vugt

Merge latest trunk

2042. By Daniel van Vugt

Merge latest trunk

2041. By Daniel van Vugt

Merge latest trunk

2040. By Daniel van Vugt

Tidy up ApplicationSession unit-tests' mocks.

2039. By Daniel van Vugt

Merge latest trunk and fix conflicts.

2038. By Daniel van Vugt

Merge latest trunk

2037. By Daniel van Vugt

Merge latest trunk

2036. By Daniel van Vugt

Add a dummy expectation to silence gmock (part of LP: #1390312)

2035. By Daniel van Vugt

Merge latest trunk

2034. By Daniel van Vugt

Also verify that configure_surface() gives the correct shared_ptr to
set_parent().

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches