[wip] Preliminary support for overwriting subpixel rendering

Reported-by: @acoolstraw
This commit is contained in:
Consolatis 2022-08-31 19:02:17 +02:00
parent 9c271d792d
commit 5d412b2879
4 changed files with 17 additions and 0 deletions

View file

@ -11,6 +11,7 @@
<decoration>server</decoration>
<gap>0</gap>
<adaptiveSync>no</adaptiveSync>
<subpixel>0</subpixel>
<cycleViewPreview>no</cycleViewPreview>
<cycleViewOutlines>yes</cycleViewOutlines>
</core>

View file

@ -5,6 +5,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <wayland-server-core.h>
#include <wayland-server-protocol.h>
#include "common/buf.h"
#include "config/libinput.h"
@ -17,6 +18,7 @@ struct rcxml {
bool xdg_shell_server_side_deco;
int gap;
bool adaptive_sync;
enum wl_output_subpixel subpixel;
/* focus */
bool focus_follow_mouse;

View file

@ -360,6 +360,8 @@ entry(xmlNode *node, char *nodename, char *content)
rc.gap = atoi(content);
} else if (!strcasecmp(nodename, "adaptiveSync.core")) {
rc.adaptive_sync = get_bool(content);
} else if (!strcasecmp(nodename, "subpixel.core")) {
rc.subpixel = atoi(content);
} else if (!strcmp(nodename, "name.theme")) {
rc.theme_name = strdup(content);
} else if (!strcmp(nodename, "cornerradius.theme")) {
@ -490,6 +492,7 @@ rcxml_init()
wl_list_init(&rc.mousebinds);
wl_list_init(&rc.libinput_categories);
rc.xdg_shell_server_side_deco = true;
rc.subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
rc.corner_radius = 8;
rc.font_size_activewindow = 10;
rc.font_size_menuitem = 10;

View file

@ -9,6 +9,7 @@
#define _POSIX_C_SOURCE 200809L
#include "config.h"
#include <assert.h>
#include <wayland-server-protocol.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_drm_lease_v1.h>
#include <wlr/types/wlr_output.h>
@ -16,6 +17,7 @@
#include <wlr/types/wlr_scene.h>
#include <wlr/util/region.h>
#include <wlr/util/log.h>
#include "buffer.h"
#include "labwc.h"
#include "layers.h"
@ -106,6 +108,15 @@ new_output_notify(struct wl_listener *listener, void *data)
wlr_output_preferred_mode(wlr_output);
wlr_output_set_mode(wlr_output, preferred_mode);
/* Allow to overwrite subpixel rendering */
if (rc.subpixel != WL_OUTPUT_SUBPIXEL_UNKNOWN
&& rc.subpixel != wlr_output->subpixel) {
wlr_log(WLR_ERROR,
"changing configured output subpixel rendering from %u to %u",
wlr_output->subpixel, rc.subpixel);
wlr_output_set_subpixel(wlr_output, rc.subpixel);
}
/*
* Sometimes the preferred mode is not available due to hardware
* constraints (e.g. GPU or cable bandwidth limitations). In these