diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 6b9408c9e..025b90e83 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -252,7 +252,8 @@ static void wlr_output_handle_scale(void *data, static void wlr_output_handle_geometry(void *data, struct wl_output *wl_output, int32_t x, int32_t y, int32_t phys_width, int32_t phys_height, int32_t subpixel, const char *make, const char *model, int32_t transform) { - // This is intentionally left blank + struct wlr_wl_remote_output *output = data; + output->subpixel = subpixel; } static void wlr_output_handle_mode(void *data, struct wl_output *wl_output, @@ -448,6 +449,7 @@ static void registry_global(void *data, struct wl_registry *registry, output->scale = 1; output->name = name; output->backend = wl; + output->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN; wl_list_insert(&wl->remote_outputs, &output->link); wl_output_add_listener(wl_output, &output_listener, output); diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 15f4335fc..b581785b5 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -679,6 +679,7 @@ void surface_update(struct wlr_wl_output *output) { } uint32_t scale = 1; + enum wl_output_subpixel subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN; struct wlr_wl_active_remote_output *active; wl_list_for_each(active, &output->active_remote_outputs, link) { @@ -686,12 +687,18 @@ void surface_update(struct wlr_wl_output *output) { if (scale < output->scale) { scale = output->scale; } + + if (output->subpixel != WL_OUTPUT_SUBPIXEL_UNKNOWN) { + subpixel = output->subpixel; + } } struct wlr_output_state state = { - .committed = WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_SCALE, + .committed = WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_SCALE | + WLR_OUTPUT_STATE_SUBPIXEL, .mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM, .scale = scale, + .subpixel = subpixel, .custom_mode = { .width = output->requested.width * scale, .height = output->requested.height * scale diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 6a58e2b98..d5bc43e7d 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -56,6 +56,7 @@ struct wlr_wl_remote_output { struct wl_output *output; struct wlr_wl_backend *backend; uint32_t scale; + enum wl_output_subpixel subpixel; // we use this to identify the output in the // global registry so that we can remove it later