backend/wayland: handle subpixel

This commit is contained in:
Alexander Orzechowski 2022-01-06 19:24:30 -05:00 committed by Alexander Orzechowski
parent d37572486b
commit 7927cb1ecd
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,
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,
@ -445,6 +446,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);

View file

@ -511,6 +511,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) {
@ -518,12 +519,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

View file

@ -55,6 +55,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