-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wayland server side decorations #3425
Conversation
Had to move `XdgTopLevelStable` to its header file so I can include it, and moved `from()` to be public.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3425 +/- ##
==========================================
+ Coverage 77.31% 77.40% +0.08%
==========================================
Files 1068 1074 +6
Lines 68284 68834 +550
==========================================
+ Hits 52797 53282 +485
- Misses 15487 15552 +65 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a style guide at https://mir-server.io/doc/cppguide/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking the WAYLAND_DEBUG log, we're never sending a toplevel_decoration_v1.configure()
event. The client needs this to know whether or not to draw decorations
Removed superfluous `configure` method, as well as unwrapping `mode` to a normal uint32_t.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the basics are working. Once you're satisfied with "error handling" etc please mark the PR "ready"
As discussed, there should be some corresponding tests in wlcs.
Not needed for this PR We should discuss a follow on PR that allows the decoration decision strategy to be customised by shells built with Mir. There are eight possible strategies: the client has three requests (ssd, csd and unset) to which we can respond in two ways. But half of the "legal" strategies are perverse. What remains are:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to manage toplevels_with_decorations
better. Stale entries are problematic for two reasons:
- decoration objects can be destroyed, leaving the corresponding toplevel incorrectly classified
- toplevel objects can be destroyed leaving an invalid pointer
Comparisons (during lookup) with invalid pointers are undefined behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits pending side-channel discussion
eeaf76b
to
0741868
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also unresolved comments from an earlier review
…able copying. Co-authored-by: Alan Griffiths <[email protected]>
Also fixed a sneaky bug caused by checking if one toplevel was registered instead of zero. toplevels should be already unregistered by their decorations by the time they're destroyed, otherwise it's a protocol error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting there...
const auto orphaned_decoration = !toplevels_with_decorations->unregister_toplevel(toplevel); | ||
if (!client->is_being_destroyed() && orphaned_decoration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto orphaned_decoration = !toplevels_with_decorations->unregister_toplevel(toplevel); | |
if (!client->is_being_destroyed() && orphaned_decoration) | |
if (!toplevels_with_decorations->unregister_toplevel(toplevel) && !client->is_being_destroyed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see what is achieved here other than saving a variable declaration (which the compiler likely optimizes anyway). I think the original might be a bit more readable.
/// \return true if the toplevel didn't exist in the set, false otherwise. | ||
/// The return value is used in the destroy callback of the toplevel to | ||
/// check if the toplevel is destroyed before the decoration (orphaned | ||
/// decoration). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This is a very weird semantic: returning
false
on success. - It is normal to document the preconditions, action, and postconditions of a function. Not where its result happens to be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I myself was a bit confused while using this method.
I've moved the explanation to where the mentioned case is actually handled. I might've detailed things too much, but I think this will save the next person (likely me :)) that works on this code some time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…re_decoration_throws_orphaned`
Closes #3371