backend/wayland: handle subpixel

This commit is contained in:
Alexander Orzechowski 2022-01-06 19:24:30 -05:00
parent e7ee2a2442
commit f0b387db1e
3 changed files with 12 additions and 2 deletions

View file

@ -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, 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 x, int32_t y, int32_t phys_width, int32_t phys_height,
int32_t subpixel, const char *make, const char *model, int32_t transform) { 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, 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->scale = 1;
output->name = name; output->name = name;
output->backend = wl; output->backend = wl;
output->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
wl_list_insert(&wl->remote_outputs, &output->link); wl_list_insert(&wl->remote_outputs, &output->link);
wl_output_add_listener(wl_output, &output_listener, output); wl_output_add_listener(wl_output, &output_listener, output);

View file

@ -679,6 +679,7 @@ void surface_update(struct wlr_wl_output *output) {
} }
uint32_t scale = 1; uint32_t scale = 1;
enum wl_output_subpixel subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
struct wlr_wl_active_remote_output *active; struct wlr_wl_active_remote_output *active;
wl_list_for_each(active, &output->active_remote_outputs, link) { 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) { if (scale < output->scale) {
scale = output->scale; scale = output->scale;
} }
if (output->subpixel != WL_OUTPUT_SUBPIXEL_UNKNOWN) {
subpixel = output->subpixel;
}
} }
struct wlr_output_state state = { 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, .mode_type = WLR_OUTPUT_STATE_MODE_CUSTOM,
.scale = scale, .scale = scale,
.subpixel = subpixel,
.custom_mode = { .custom_mode = {
.width = output->requested.width * scale, .width = output->requested.width * scale,
.height = output->requested.height * scale .height = output->requested.height * scale

View file

@ -56,6 +56,7 @@ struct wlr_wl_remote_output {
struct wl_output *output; struct wl_output *output;
struct wlr_wl_backend *backend; struct wlr_wl_backend *backend;
uint32_t scale; uint32_t scale;
enum wl_output_subpixel subpixel;
// we use this to identify the output in the // we use this to identify the output in the
// global registry so that we can remove it later // global registry so that we can remove it later