output scaling chicken-and-egg problem

Jonas Ådahl jadahl at redhat.com
Fri Dec 2 15:17:45 UTC 2022


On Fri, Dec 02, 2022 at 06:07:55PM +0300, Maxim Kartashev wrote:
> I wonder if it's possible to set the Wayland buffer scale correctly before
> the window appears on the screen for the first time?
> AFAIU, the sequence of events wrt proper scaling is roughly as follows:
> - receive wl_output.scale for each output
> - create surface, commit
> - receive xdg_surface.configure
> - create and attach a buffer, set_buffer_scale(X), commit
> - receive wl_surface.enter(wl_output Y with scale Z)
> - realize that Z != X, resize the buffer, do set_buffer_scale(Z)
> 
> So there's a potential for the window to "twitch" when it first appears on
> some output it didn't anticipate and its scale (and the size of the buffer)
> had to be adjusted. Is there a better way? Or maybe I'm interpreting the
> protocol in the wrong way?

There is no way right now, but there will be in a future version of the
core Wayland protocol.

See https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220
for details.

A short summary is that you'll receive a "preferred scale" as part of
the initial configuration that will let you avoid the initial wrong
scale you otherwise risk when on a HiDPI system.


Jonas

> 
> Thanks in advance!
> 
> Maxim.



More information about the wakefield-dev mailing list