Fix monitorconfig patch

This commit is contained in:
Palanix 2024-05-03 23:37:08 +02:00
parent 51e07cb4b7
commit 0c4851e4a0
No known key found for this signature in database
GPG Key ID: 439CD6BD9905FAC5

View File

@ -1,4 +1,4 @@
From e43e79b7974b34786c9d3cc7b02952e7a1cd50a0 Mon Sep 17 00:00:00 2001
From e7a8ee402ba7f03c621eab9df839aabd8aa5eb4c Mon Sep 17 00:00:00 2001
From: Palanix <palanixyt@gmail.com>
Date: Mon, 4 Apr 2022 16:08:29 +0200
Subject: [PATCH] Updated patch now allowing setting x and y
@ -9,14 +9,14 @@ Content-Transfer-Encoding: 8bit
Co-authored-by: Leonardo Hernández Hernández <leohdz172@proton.me
---
config.def.h | 11 +++++++----
dwl.c | 24 +++++++++++++++++++-----
2 files changed, 26 insertions(+), 9 deletions(-)
dwl.c | 25 +++++++++++++++++++------
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/config.def.h b/config.def.h
index 9009517..4cf8471 100644
index 8847e58..a8860c4 100644
--- a/config.def.h
+++ b/config.def.h
@@ -39,12 +39,15 @@ static const Layout layouts[] = {
@@ -38,12 +38,15 @@ static const Layout layouts[] = {
/* monitors */
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = {
@ -37,10 +37,10 @@ index 9009517..4cf8471 100644
/* keyboard */
diff --git a/dwl.c b/dwl.c
index fa76db2..52d210c 100644
index bf763df..fdd603b 100644
--- a/dwl.c
+++ b/dwl.c
@@ -212,6 +212,11 @@ typedef struct {
@@ -215,6 +215,11 @@ typedef struct {
const Layout *lt;
enum wl_output_transform rr;
int x, y;
@ -52,7 +52,7 @@ index fa76db2..52d210c 100644
} MonitorRule;
typedef struct {
@@ -848,6 +853,7 @@ createmon(struct wl_listener *listener, void *data)
@@ -865,6 +870,7 @@ createmon(struct wl_listener *listener, void *data)
/* This event is raised by the backend when a new output (aka a display or
* monitor) becomes available. */
struct wlr_output *wlr_output = data;
@ -60,22 +60,23 @@ index fa76db2..52d210c 100644
const MonitorRule *r;
size_t i;
struct wlr_output_state state;
@@ -876,15 +882,23 @@ createmon(struct wl_listener *listener, void *data)
@@ -893,16 +899,23 @@ createmon(struct wl_listener *listener, void *data)
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
wlr_output_state_set_scale(&state, r->scale);
wlr_output_state_set_transform(&state, r->rr);
+
+ wlr_output_state_set_adaptive_sync_enabled(&state, r->adaptive);
+
+ if(r->mode == -1)
+ wlr_output_state_set_custom_mode(&state, r->resx, r->resy,
+ (int) (r->rate > 0 ? r->rate * 1000 : 0));
+ else {
+ else if (!wl_list_empty(&wlr_output->modes)) {
+ for (int j = 0; j < r->mode; j++) {
+ mode = wl_container_of(mode->link.next, mode, link);
+ }
+ wlr_output_state_set_mode(&state, mode);
+ }
+
+ wlr_output_state_set_adaptive_sync_enabled(&state, r->adaptive);
break;
}
}
@ -85,10 +86,10 @@ index fa76db2..52d210c 100644
- * monitor's preferred mode; a more sophisticated compositor would let
- * the user configure it. */
- wlr_output_state_set_mode(&state, wlr_output_preferred_mode(wlr_output));
+ wlr_output_init_render(wlr_output, alloc, drw);
-
/* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
--
2.44.0
2.45.0