-
Notifications
You must be signed in to change notification settings - Fork 186
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
vswitch: remove "ghost window" on target workspace. #2106
Conversation
Windows are never meant to sit between outputs, this is by design in Wayfire. Anyway.
So your approach is actually on the right track! However we still need an intermediate node to translate the view to the correct output coordinates in multi-monitor scenarios. Does everything work properly if you use a translation node from the Maybe it would be worth refactoring our node code so that:
This way we don't have duplicate functionality, plugins can do translation+clipping in a generic way (it would be useful for some other plugins as well). If this sounds way too complicated, simply using a translation node without any clipping will still be an improvement and should be almost trivial to implement, and the rest can be left for later. |
Not sure I understood exactly what you are suggesting, but... I changed overlay_view_node from an output_node_t to a translation_node_t. With a small but nonzero offset, like in this commit which uses an offset of (1, 1), things look almost correct. In that commit, the window moves down and to the right by 1 pixel while the animation is happening. But with an offset of (0, 0), the window isn't displayed at all. While the switch is happening, the window disappears, and then when the animation ends, the window reappears. The translated node isn't drawn at all. I think this is because translation_node_instance_t::schedule_instructions doesn't do anything if the bounding box is the same as the children's bounding box. |
Your commit looks ok but I am not sure why offset 0,0 doesn't work. What do you mean exactly by "doesn't do anything if ..."? I don't see a line which matches your description https://github.com/WayfireWM/wayfire/blob/master/src/view/translation-node.cpp |
What I'm talking about is this if statement. As far as I can tell, what is happening is that the bounding box is always 0,0,0,0 and our_damage.empty() is always false, so no instructions are scheduled. Poking at the code some more looks like there might be a missing return statement in vswitch_overlay_node_t::get_bounding_box. If the view is locked, the code calculates the bounding box of the transformed node, but doesn't return it, instead falling out of the if and returning 0, 0, 0, 0. Fixing that seems to fix the problem. Patch coming up. |
7f1dd34
to
1ad4afb
Compare
// Render as an overlay, but make sure it is translated and clipped properly to the local output | ||
overlay_view_node = std::make_shared<scene::output_node_t>(output); | ||
// Render as an overlay, but make sure it is translated to the local output | ||
overlay_view_node = std::make_shared<scene::translation_node_t>(output); |
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 may look correct but is slightly misleading. The translation node has a boolean parameter (which in this particular case can be either true or false, it won't make a difference), and since output is a pointer, it is auto-converted to a bool.
You need to set the node's offset manually to origin(o->get_layout_geometry())
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 may look correct but is slightly misleading. The translation node has a boolean parameter (which in this particular case can be either true or false, it won't make a difference), and since output is a pointer, it is auto-converted to a bool.
Oops! Fixed.
You need to set the node's offset manually to origin(o->get_layout_geometry())
Attempted.
Ah, nice catch! |
When animating, the plugin disables the original view, then adds a new output node which is rendered as an overlay while the animation runs. Unfortunately the workspace wall also picks up the new output node and draws it on the target workspace, resulting in a duplicate window. This commit is a simple fix that uses a translation node instead of an output node. This requires fixing what looks like a missing return statement in vswitch_overlay_node_t::get_bounding_box. Fixes WayfireWM#2041
1ad4afb
to
5410b8a
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.
LGTM, thanks!
I'll test when I get back home & merge.
Works great!! Thanks. :) |
When animating, the plugin disables the original view, then adds a new output node which is rendered as an overlay while the animation runs. Unfortunately the workspace wall also picks up the new output node and draws it on the target workspace, resulting in a duplicate window. This commit is a simple fix that uses a translation node instead of an output node. This requires fixing what looks like a missing return statement in vswitch_overlay_node_t::get_bounding_box. Fixes #2041
I don't understand how the scenegraph APIs work, but by tinkering with the code it looks like adding the overlay as a child of the scene::output_node_t results in both the overlay and the original window being displayed, even though the original window is hidden with wf::scene::set_node_enabled on its transfomed node.
This fix works on one output, but if a window is split across multiple outputs, then the overlay appears on the wrong output as well. That said, windows split across multiple outputs don't seem to work at the moment - only one output displays its part of the window, the others don't - so I don't know if that's a problem with this commit or a deeper problem.
Fixes #2041