mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-06-14 14:32:57 -04:00
backend/wayland: Fix HiDPI support for nested compositors
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 Implements: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/854 Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5186 Co-Authored-By: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
This commit is contained in:
parent
a94cd29eb1
commit
514eeebd3c
6 changed files with 171 additions and 15 deletions
|
|
@ -16,6 +16,14 @@
|
|||
#include <wlr/render/drm_format_set.h>
|
||||
#include <wlr/render/drm_syncobj.h>
|
||||
|
||||
struct wlr_wl_parent_output {
|
||||
struct wlr_wl_backend *backend;
|
||||
struct wl_output *wl_output;
|
||||
uint32_t global_name;
|
||||
int32_t scale;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct wlr_wl_backend {
|
||||
struct wlr_backend backend;
|
||||
|
||||
|
|
@ -30,6 +38,9 @@ struct wlr_wl_backend {
|
|||
struct wl_listener event_loop_destroy;
|
||||
char *activation_token;
|
||||
|
||||
struct wl_list parent_outputs; // wlr_wl_parent_output.link
|
||||
int32_t max_parent_scale;
|
||||
|
||||
/* remote state */
|
||||
struct wl_display *remote_display;
|
||||
bool own_remote_display;
|
||||
|
|
@ -99,6 +110,9 @@ struct wlr_wl_output {
|
|||
struct wlr_wl_backend *backend;
|
||||
struct wl_list link;
|
||||
|
||||
// From parent compositor, unscaled.
|
||||
int32_t logical_width, logical_height;
|
||||
|
||||
struct wl_surface *surface;
|
||||
bool own_surface;
|
||||
struct wl_callback *frame_callback;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue