Skip to content
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

WIP: Wayland z layering #4857

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jwijenbergh
Copy link
Contributor

@jwijenbergh jwijenbergh commented Jun 1, 2024

Some TODOs here and there, just want this PRed now so people can test.

Also tests still TODO of course

@jwijenbergh jwijenbergh marked this pull request as draft June 1, 2024 12:50
This took me a while to figure out. If the window is still pending,
placing it after this configure will result in wlroots' visibility
checks to be confused. This probably is because the window has not
committed a buffer. Let's only do the configure workaround if the
window is pending and remove the place afterwards.

In english: with wayland z-layering and without this patch, if
floats_kept_above is enabled, an xwayland window that is under a
floating one will be invisible. Even if only parts of the window is
hidden by the floating one.
@jwijenbergh jwijenbergh force-pushed the wayland-z-layering branch 2 times, most recently from 3245b55 to 332890a Compare June 1, 2024 12:52
Comment on lines 358 to 360
SceneTree.create(
self.windows_tree
), # Keep above windows (floats go here if floats_kept_above
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

holy crap black is ugly

Comment on lines -955 to +1028
self.bring_to_front()
self.move_up()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elParaguayo is this correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused what needs to happen when above is set in place

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think move_up is ok here - but let's see what happens in the tests ;)

Comment on lines +718 to +719
if force and self.tree_layer is self.core.keep_below_window_tree:
self.reparent(self.get_new_layer(self._float_state))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elParaguayo does move_up or down with force also remove it from bring_to_front layer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x11 doesn't have a bring_to_front layer. In x11, bring_to_front ignores layers and brings the window to the front. Once it loses focus, it should be restacked according to its layer.

The behaviour of force is as follows. If this is True, move_up will move the window out of the kept_below layer group, and move_down will move the window out of the kept_above layer group. If False, the windows can only move within their respective layer groups.

Comment on lines +478 to 479
# TODO: is this correct
self.bring_to_front()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to check all bring to front calls in the wayland code base

Copy link
Member

@elParaguayo elParaguayo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have started having a go with this. Some thoughts below.

Also noticed that rofi opened behind floating windows. I then had a coredump...

Comment on lines +718 to +719
if force and self.tree_layer is self.core.keep_below_window_tree:
self.reparent(self.get_new_layer(self._float_state))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x11 doesn't have a bring_to_front layer. In x11, bring_to_front ignores layers and brings the window to the front. Once it loses focus, it should be restacked according to its layer.

The behaviour of force is as follows. If this is True, move_up will move the window out of the kept_below layer group, and move_down will move the window out of the kept_above layer group. If False, the windows can only move within their respective layer groups.

Comment on lines +709 to +714
def keep_below(self) -> None:
self.reparent(self.core.keep_below_window_tree)

@expose_command()
def keep_above(self) -> None:
self.reparent(self.core.keep_above_window_tree)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In X11, we have a kept_above/below property. We should add that here.

In addition, the X11 method signature includes an enable argument. If this is set, then kept_above/below is set to that value. If it's None then the state is toggled.

Comment on lines -955 to +1028
self.bring_to_front()
self.move_up()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think move_up is ok here - but let's see what happens in the tests ;)

Copy link

github-actions bot commented Sep 6, 2024

This PR is stale because it has been open 90 days with no activity. Remove the status: stale label or comment, or this will be closed in 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants