When running a wlroots-based compositor nested under another Wayland
compositor with HiDPI scaling, the nested window appears blurry and
incorrectly sized. This is because the Wayland backend does not:
1. Detect and track the parent compositor's output scale
2. Set wl_surface_set_buffer_scale() to match the parent's scale
3. Multiply output dimensions by the scale factor when handling
configure events
This patch fixes all three issues by:
- Adding wlr_wl_parent_output structure to track parent outputs
- Listening to wl_output.scale events from the parent compositor
- Setting buffer_scale on all backend surfaces (output and layers)
- Scaling output dimensions to account for buffer scale
- Setting wlr_output.scale so nested clients render at correct DPI
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/854
When an FD is passed to xcb_connect_to_fd(), xcb takes ownership of that
FD and is responsible for closing it, which it does when
xcb_disconnect() is called. But the xwayland handler code also keeps a
copy of the FD and closes it via safe_close() in
server_finish_process().
This double-close can cause all sorts of problems if another part of
wlroots allocates another FD between the two closes - the latter close
will close the wrong FD and things go horribly wrong (in my case leading
to use-after-free and segfaults).
Fix this by setting wm_fd[0]=-1 after calling xwm_create(), and ensuring
that xwm_create() closes the FD if startup errors occur.
The important bit here is whether this is using a single or two
sub-passes. The flag isn't used for anything else.
Preparation for an upcoming one-subpass codepath.
Upon leasing, the wlr_drm_lease_connector_v1 will be automatically clean up by the wlr_output
destroy handler. There is no need for the wlr_drm_lease_manager to keep track of leased connectors.
We were iterating over involved outputs, applying the new state and
sending the commit event for each one. This resulted in commit
events being fired while we weren't done applying the new state for
all outputs.
Fix this by first applying all of the states, then firing all of
the events.
Closes: https://github.com/swaywm/sway/issues/8829
Add wlr-internal enums for the properties specified in
color-representation-v1 (encoding, range, chroma siting, alpha mode) so
that other parts of wlroots can use these without depending on the
protocol specifics and without needing to include the protocol headers.
Also add conversion functions to convert the protocol enum values into
the wlroots enum values.