wayland: HiDPI fixes#837
Merged
Merged
Conversation
clefebvre
commented
Jul 1, 2026
Member
- Fix partially hidden mouse cursor during movement
- Fix scrolling in Electron apps
- Fix mapping of maximized Electron apps
Fix motion rendering in Wayland with HiDPI. Moving the mouse cursor in HiDPI scale 2, in Wayland, resulted in only the top-left quarter of the cursor being visible during motion. Fixes #835 Store the dimensions of each GBM (Graphics Buffer Manager) cursor BO (buffer object) alongside the BO itself, and use those dimensions when assigning the cursor plane. Wayland HiDPI cursors can be preprocessed into an image smaller than the hardware cursor maximum. Allocating and presenting the cursor using the actual preprocessed size keeps the legacy DRM (Direct Rendering Manager) cursor ioctl (input/output control) dimensions aligned with the BO layout, avoiding padded hardware-max buffers being interpreted as the visible cursor image.
There was a problem hiding this comment.
Pull request overview
This PR targets Wayland HiDPI correctness issues affecting cursor rendering, viewport-damage handling (notably Electron scrolling), and maximized-state/configure behavior for XDG toplevels.
Changes:
- Track per-buffer cursor dimensions in the native cursor renderer to avoid using a single fixed GPU cursor size.
- Adjust damage-to-buffer mapping when
wp_viewportsets a destination size (fixes incorrect damage clipping that can break scrolling). - Improve maximized/configure handling (including synthetic maximize transitions and ensuring a configure reply when already maximized) and suppress compositor size-change effects for the synthetic transition.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/wayland/meta-window-wayland.h | Exposes new Wayland window helper APIs for configure sending and maximize-transition scheduling. |
| src/wayland/meta-window-wayland.c | Adds tracking for configure acks and synthetic maximize transitions; adds fixed-size-state geometry correction. |
| src/wayland/meta-wayland-xdg-shell.c | Adjusts maximize request handling and defers geometry warnings when no buffer is attached. |
| src/wayland/meta-wayland-surface.c | Changes damage processing for viewport destination-size scenarios (HiDPI/Electron scrolling). |
| src/core/window-private.h | Adds a flag to suppress compositor size-change effects for synthetic transitions. |
| src/compositor/compositor.c | Honors the new suppression flag to skip size-change effects. |
| src/backends/native/meta-cursor-renderer-native.c | Tracks cursor BO width/height per buffer to fix partially hidden cursor during movement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…thout src rect Fixes #835 When wp_viewport sets a destination size without a source rect, the viewport maps the full buffer to the destination size. Surface damage from wl_surface.damage is in destination/logical coordinates; after scaling by surface->scale, the damage region is in dst * scale coordinates. In this case the source rectangle passed to meta_region_crop_and_scale() must describe the full buffer. Using the destination-sized surface rect, or dividing the buffer size by surface->scale, makes the source rect too small and causes the viewport damage transform to clip or scale damage incorrectly. Use buffer_rect as the implicit source rectangle so damage is mapped through the viewport transform into the correct buffer coordinates.
Some Wayland clients can request maximization before they have completed their first configure-ack-commit cycle, then commit a stale restored size instead of the compositor-configured maximized size. Track whether a client has acked a configure yet, preserve the compositor size for fixed-size states, and schedule an initial maximized-state transition when needed so clients update their maximized state after mapping. Fixes Slack/VScode, probably most Chromium-based apps, initial window mapping when they were maximized beforehand. These apps used to not fill the screen in HiDPI, though their state was maximized, leading to non-working titlebar unmaximize button, quarter-sized window dimensions and wrong coordinates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.