-
Notifications
You must be signed in to change notification settings - Fork 341
foreign-toplevel-management: Report parent toplevel #2419
foreign-toplevel-management: Report parent toplevel #2419
Conversation
Related PR for wayfire: WayfireWM/wayfire#769 |
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.
See comments.
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 once the style issues are fixed.
a497d7a
to
722e83a
Compare
wl_list_for_each_safe(tl, tmp3, &manager->toplevels, link) { | ||
if (tl->parent == toplevel) { | ||
/* Note: we do not send a parent signal to the client, that | ||
* should be done by the caller if it wishes */ |
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.
Hmm. This won't work because the parent == toplevel->parent
check in wlr_foreign_toplevel_handle_v1_set_parent
will bail out early.
I think it'd make sense to just send the event here.
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 was thinking the caller would always set the handle for the child before destroying the parent, but actually there is no guarantee for this, so it is better to send it here. I've added comments to make it clear that this function will send parent event for any child toplevels.
@@ -405,6 +405,36 @@ void wlr_foreign_toplevel_handle_v1_set_fullscreen( | |||
toplevel_send_state(toplevel); | |||
} | |||
|
|||
static void send_parent(struct wlr_foreign_toplevel_handle_v1 *parent, | |||
struct wl_resource *toplevel_resource) { |
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.
The order of these arguments is a little bit misleading, I'd prefer having the wl_resource
first and then the parent. And maybe we can replace the wl_resource
argument with a proper wlr_foreign_toplevel_handle_v1
, to avoid mixing resource types up.
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.
Agreed, I've changed the order. I prefer using the resource, since this is a static function that is only called from two places in this file and the resource is already available, especially here:
https://github.com/dkondor/wlroots/blob/cf88b7f0bf73602eeff3a9161b1ea9a919ec4128/types/wlr_foreign_toplevel_management_v1.c#L589
it seems simpler to just use it.
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.
Apart from this, looks fine to me.
If possible, please update our test client in |
722e83a
to
a21de44
Compare
a21de44
to
abcb632
Compare
HI, |
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, thanks!
This is an implementation for swaywm/wlr-protocols#52
Works together with: https://github.com/dkondor/wayfire/tree/foreign-toplevel-report-parent
Example client: https://github.com/dkondor/cairo-dock-core/tree/wayland_egl
Tested: not displaying child views in the taskbar
Untested: actually grouping together views with the same parent
I'm happy to work on additional test cases if needed.
Potential issues:
-- Store the children of a toplevel in a list. I don't like this, since it essentially duplicates functionality that is likely already present in the compositor elsewhere.
-- Do not do check this and require the caller to ensure that either (1) a parent handle is only destroyed after all child handles; (2) wlr_foreign_toplevel_handle_v1_set_parent() is called with NULL or another parent before destroying the parent handle