Skip to content

wayland: HiDPI fixes#837

Merged
clefebvre merged 6 commits into
masterfrom
wayland-fixes
Jul 1, 2026
Merged

wayland: HiDPI fixes#837
clefebvre merged 6 commits into
masterfrom
wayland-fixes

Conversation

@clefebvre

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_viewport sets 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.

Comment thread src/wayland/meta-wayland-xdg-shell.c Outdated
Comment thread src/wayland/meta-wayland-surface.c
Comment thread src/wayland/meta-window-wayland.c Outdated
clefebvre and others added 4 commits July 1, 2026 17:00
…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.
@clefebvre clefebvre merged commit a92dc19 into master Jul 1, 2026
3 checks passed
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.

3 participants