introduce rules for monitor configuration
(with dwm, this would already have been done by the X server)
This commit is contained in:
parent
97f29ec67f
commit
1907ee3879
11
config.h
11
config.h
@ -1,3 +1,14 @@
|
|||||||
|
/* monitors */
|
||||||
|
static const MonitorRule monrules[] = {
|
||||||
|
/* name scale */
|
||||||
|
{ "X11-1", 1 },
|
||||||
|
{ "eDP-1", 2 },
|
||||||
|
{ "HDMI-A-1", 1 },
|
||||||
|
/* defaults */
|
||||||
|
{ NULL, 1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* keyboard */
|
||||||
static const struct xkb_rule_names xkb_rules = {
|
static const struct xkb_rule_names xkb_rules = {
|
||||||
.rules = NULL,
|
.rules = NULL,
|
||||||
.model = NULL,
|
.model = NULL,
|
||||||
|
15
dwl.c
15
dwl.c
@ -81,6 +81,11 @@ typedef struct {
|
|||||||
struct wl_listener frame;
|
struct wl_listener frame;
|
||||||
} Monitor;
|
} Monitor;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const char *name;
|
||||||
|
float scale;
|
||||||
|
} MonitorRule;
|
||||||
|
|
||||||
/* Used to move all of the data necessary to render a surface from the top-level
|
/* Used to move all of the data necessary to render a surface from the top-level
|
||||||
* frame handler to the per-surface render function. */
|
* frame handler to the per-surface render function. */
|
||||||
struct render_data {
|
struct render_data {
|
||||||
@ -247,9 +252,17 @@ createmon(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocates and configures our state for this output */
|
/* Allocates and configures monitor state using configured rules */
|
||||||
Monitor *m = calloc(1, sizeof(*m));
|
Monitor *m = calloc(1, sizeof(*m));
|
||||||
m->wlr_output = wlr_output;
|
m->wlr_output = wlr_output;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < LENGTH(monrules); i++) {
|
||||||
|
if (!monrules[i].name ||
|
||||||
|
!strcmp(wlr_output->name, monrules[i].name)) {
|
||||||
|
wlr_output_set_scale(wlr_output, monrules[i].scale);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Sets up a listener for the frame notify event. */
|
/* Sets up a listener for the frame notify event. */
|
||||||
m->frame.notify = rendermon;
|
m->frame.notify = rendermon;
|
||||||
wl_signal_add(&wlr_output->events.frame, &m->frame);
|
wl_signal_add(&wlr_output->events.frame, &m->frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user