Skip to content

Draft: wp-fractional-scale-v1 (w-p!149): new protocol implementation

Kirill Primak requested to merge vyivel/wlroots:fractional-scale into master

Implements wayland/wayland-protocols!149

Depends on !3831 (merged)

Example compositor: https://gitlab.freedesktop.org/vyivel/loupe

Caveats

  • We use pixman to work with regions, so those are stored using integers.
    • One way to fix this completely would be to store factors alongside regions and apply them when necessary. This will work fine for wl_surface input regions and pointer constraining regions, but dealing with wl_surface opaque regions doesn't sound fun.

    • Another (somewhat hacky) solution which utilizes the fact that wl_fixed_t is technically int32_t:

      struct wlr_fixed_region {
              pixman_region32_t region;
      };

      Not sure how viable it is.

    • Of course, the 100% correct and sane solution would be to add a floating point region type. Maybe it's not as bad as it sounds.

Breaking changes

  • All coordinates and sizes are now double.
  • Custom protocol implementations now must apply wlr_surface.{client,server}_scale_factor.
    • This isn't strictly required if the compositor doesn't implement fractional scaling using this protocol.
Edited by Kirill Primak

Merge request reports