Skip to content

wayland: Add opt-in border inset window properties - #16108

Open
svncibrahim wants to merge 1 commit into
libsdl-org:mainfrom
svncibrahim:wayland-border-insets
Open

wayland: Add opt-in border inset window properties#16108
svncibrahim wants to merge 1 commit into
libsdl-org:mainfrom
svncibrahim:wayland-border-insets

Conversation

@svncibrahim

Copy link
Copy Markdown
Contributor
  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Description

A client that draws its own decorations (shadows, an invisible resize border) has no way on Wayland to declare that the window geometry is the surface minus those insets, so snap, tile and maximize align to the surface edges instead of the visible content.

This adds four opt-in window properties:

  SDL_PROP_WINDOW_WAYLAND_BORDER_INSET_LEFT_NUMBER
  SDL_PROP_WINDOW_WAYLAND_BORDER_INSET_TOP_NUMBER
  SDL_PROP_WINDOW_WAYLAND_BORDER_INSET_RIGHT_NUMBER
  SDL_PROP_WINDOW_WAYLAND_BORDER_INSET_BOTTOM_NUMBER

When set, SDL sets the xdg window geometry to the surface minus the insets and translates configure sizes, size limits and popup positioning accordingly. All-zero insets (the default) leave the geometry call and the protocol traffic identical to today.

The insets apply only to xdg-toplevel windows and are skipped while maximized or fullscreen, where an exact size is required. The configure-size dedup is now state-aware, so a maximize or fullscreen toggle at unchanged dimensions is re-adopted instead of skipped.

Existing Issue(s)

@Kontrabant Kontrabant left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few initial comments.

Just to let you know, I'm going to be traveling later this week, and won't be back until near the end of the month, so if I'm slow to respond, that's why. A final merge will have to wait until I'm back as well.

Comment thread include/SDL3/SDL_video.h
Comment thread src/video/wayland/SDL_waylandwindow.c
Comment thread src/video/wayland/SDL_waylandwindow.c Outdated
Comment thread src/video/wayland/SDL_waylandwindow.c Outdated
@Kontrabant Kontrabant added this to the 3.6.0 milestone Aug 3, 2026
@svncibrahim
svncibrahim force-pushed the wayland-border-insets branch from 88c880a to 0b1ca47 Compare August 3, 2026 18:23
Applications drawing client-side decorations (shadows, invisible resize borders) can declare their insets via four new window properties. SDL sets the xdg geometry to the surface minus the insets and translates configure sizes, size limits and popup positioning accordingly. All-zero insets (the default) leave protocol traffic unchanged; the configure-size dedup becomes state-aware so a maximize/fullscreen toggle at unchanged dimensions is re-adopted rather than skipped.
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.

Wayland: let a client declare border insets

2 participants