Skip to content

Add Buffer::width() and Buffer::height() getters#269

Merged
madsmtm merged 8 commits into
masterfrom
madsmtm/width-height
Nov 23, 2025
Merged

Add Buffer::width() and Buffer::height() getters#269
madsmtm merged 8 commits into
masterfrom
madsmtm/width-height

Conversation

@madsmtm
Copy link
Copy Markdown
Member

@madsmtm madsmtm commented Jun 5, 2025

Part of #237.

I've decided to return these in pixels corresponding to the surface/buffer itself, as that's what Softbuffer concerns itself with. If the user wants to render at the current screen DPI, they either need to multiply by a scaling factor themselves, or size the buffer using logical sizes and rely on the compositor to upscale it (which we don't yet expose knobs to control, but which we could in the future).

@madsmtm madsmtm added the enhancement New feature or request label Jun 5, 2025
Comment thread src/backends/wayland/mod.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs
@madsmtm madsmtm force-pushed the madsmtm/width-height branch from 6789eff to 344f8b7 Compare June 5, 2025 17:21
Copy link
Copy Markdown
Member

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

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

The examples look so much better with this change, no more "hacks" based on a possibly-stale and/or desynced window size.

Approving at least the Android parts; these getters are just fields returned internally.

Comment thread CHANGELOG.md Outdated
@madsmtm madsmtm merged commit a9bae73 into master Nov 23, 2025
38 checks passed
@madsmtm madsmtm deleted the madsmtm/width-height branch November 23, 2025 13:20
@MarijnS95 MarijnS95 changed the title Add Buffer::width and Buffer::height Add Buffer::width() and Buffer::height() getters Nov 25, 2025
@madsmtm madsmtm linked an issue Jan 14, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

X11: Crash when resizing winit example window

4 participants