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

tree/view: Do not clip to geometry if using CSD #8033

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thal
Copy link

@thal thal commented Mar 3, 2024

As of commit 9da295c, surfaces of xdg_toplevels are clipped to a region defined by the geometry. This causes drop shadows of floating windows to be cut off, as seen with gnome-calculator against a white background:
image
This PR will avoid clipping if a sway_view is in a floating container and using CSD.

struct wlr_box clip = {0};
if (clip_to_geometry) {
clip = (struct wlr_box){
.x = con->view->geometry.x,
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 it should just be using con->current.content_x instead of con->view->geometry.x here.

Copy link
Author

Choose a reason for hiding this comment

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

Tried this but it did not work properly. Looks like content_x and content_y are absolute coordinates, while subsurface_tree_set_clip expects surface-local coordinates.

@thal
Copy link
Author

thal commented Mar 10, 2024

The new revision passes con->view->geometry to subsurface_tree_set_clip which is more consistent with the coordinates, and cleans up the code slightly.

@Nefsen402
Copy link
Contributor

I think the only difference between clipping with the geometry size instead of the content_{width, height} size is that if the application decides it shouldn't configure to the size of the window sway wanted. This is a problem when the application is bigger than the frame (this can be easy to trigger if you tile firefox and make it small - it will refuse to configure smaller than a certain size). This will allow firefox to overflow the bounds of the container. I believe we need to keep the content_{width, height} size.

@thal
Copy link
Author

thal commented Mar 10, 2024

I've restored the patch to use content_width, content_height.
@Nefsen402, I tested with Firefox as you suggested, but I did not see any issues with either version of the patch, even when the configured size was smaller than the container.

If a floating window is using CSD, the geometry should not be used to
define the clipping region. Otherwise drop shadows and such may be
clipped excessively.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants