Skip to content

fix: collapse shadow padding when window touches a screen edge - #2717

Open
gadfly3173 wants to merge 1 commit into
sourcegit-scm:developfrom
gadfly3173:fix/window-edge-snap
Open

gadfly3173 wants to merge 1 commit into
sourcegit-scm:developfrom
gadfly3173:fix/window-edge-snap

Conversation

@gadfly3173

Copy link
Copy Markdown
Contributor

Closes #2716

The custom window frame draws its shadow inside a 12px transparent
padding that belongs to the window bounds, so window managers clamp
the padded bounds against the screen edge and the visible content
stops short of it. Collapse the padding on the touching side to let
the content sit flush against the edge.
@dwndland

Copy link
Copy Markdown

Tested on Endeavour OS)

It might be a little special, but it does not work in all the cases.
In my setup, two monitors are alligned vertically, so Monitor 2 is above Monitor 3.
And all monitors have a bottom panel configureed.
The shadow disappears at the bottom panel only if there is no screen below, so on my upper screen it still snaps with this shadow gap.

(Just as a side note. My setup is special, so this would not block anything IMHO)

@gadfly3173

Copy link
Copy Markdown
Contributor Author

Avalonia can detect each physical monitor through Screen.Bounds, but Screen.WorkingArea is the usable area after panels and is not always available per monitor on Linux/X11.
With vertically stacked monitors, the upper monitor’s bottom panel is an internal edge of the virtual desktop, so the window may still retain its bottom shadow there:

┌──────────────────┐
│ Upper monitor    │
│                  │
│                  │
│ Upper panel      │
└──────────────────┘  ← internal desktop edge
┌──────────────────┐
│ Lower monitor    │
│                  │
│                  │
│ Lower panel      │
└──────────────────┘

This comes from src/Avalonia.X11/Screens/X11Screen.Providers.cs, where UpdateWorkArea() reads the root _NET_WORKAREA and sets WorkingArea = Bounds.Intersect(wa); src/Avalonia.Controls/Platform/ScreenHelper.cs then selects a screen based on the window’s intersecting area.

@dwndland

Copy link
Copy Markdown

I am on wayland, just as a side note :D
I think its right what you say. The working area does not support that something in the vertical middle of it is stealing space. I guess.

But interestingly, this is he only exception its seems.
My setup is following.
I have 3 monitors horizontally and a 4th in the center on top.
The screen edges left and right of the top monitor is seen right, just the lower panel not. I would have expected the working area would be have an imaginary monitor top left and top right, to get a full square :D

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants