mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-26 17:54:17 +00:00
Update monfig
This commit is contained in:
parent
eb063627dc
commit
2555207b57
@ -1,4 +1,4 @@
|
||||
From 00d302a8196fd4d8d006d78c10e08014b220403e Mon Sep 17 00:00:00 2001
|
||||
From e43e79b7974b34786c9d3cc7b02952e7a1cd50a0 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
|
||||
@ -8,64 +8,72 @@ Content-Transfer-Encoding: 8bit
|
||||
|
||||
Co-authored-by: Leonardo Hernández Hernández <leohdz172@proton.me
|
||||
---
|
||||
config.def.h | 15 +++++++++------
|
||||
dwl.c | 18 +++++++++++++-----
|
||||
2 files changed, 22 insertions(+), 11 deletions(-)
|
||||
config.def.h | 11 +++++++----
|
||||
dwl.c | 24 +++++++++++++++++++-----
|
||||
2 files changed, 26 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..1091e6c 100644
|
||||
index 9009517..4cf8471 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -36,15 +36,18 @@ static const Layout layouts[] = {
|
||||
{ "[M]", monocle },
|
||||
};
|
||||
|
||||
-/* monitors */
|
||||
-/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
|
||||
+/* monitors
|
||||
+ * The order in which monitors are defined determines their position.
|
||||
+ * Non-configured monitors are always added to the left.
|
||||
+ * NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
|
||||
@@ -39,12 +39,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[] = {
|
||||
- /* name mfact nmaster scale layout rotate/reflect x y */
|
||||
- /* example of a HiDPI laptop monitor:
|
||||
- { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
+ /* name mfact nmaster scale layout rotate/reflect x y resx resy rate adaptive*/
|
||||
+ /* name mfact nmaster scale layout rotate/reflect x y resx resy rate mode adaptive*/
|
||||
+ /* example of a HiDPI laptop monitor at 120Hz:
|
||||
+ { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000f, 1},
|
||||
+ { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000f, 1, 1},
|
||||
*/
|
||||
/* defaults */
|
||||
- { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 0.0f, 1},
|
||||
+ // Note that when you do set a custom monrule it has to have resx/resy and refresh rate > 0 otherwise you will not have a displayed screen.
|
||||
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 0.0f, 0 ,1},
|
||||
+ // mode let's the user decide on how dwl should implement the modes:
|
||||
+ // -1 Sets a custom mode following the users choice
|
||||
+ // All other number's set the mode at the index n, 0 is the standard mode; see wlr-randr
|
||||
};
|
||||
|
||||
/* keyboard */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index fa76db2..ef2d2f1 100644
|
||||
index fa76db2..52d210c 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -212,6 +212,10 @@ typedef struct {
|
||||
@@ -212,6 +212,11 @@ typedef struct {
|
||||
const Layout *lt;
|
||||
enum wl_output_transform rr;
|
||||
int x, y;
|
||||
+ int resx;
|
||||
+ int resy;
|
||||
+ float rate;
|
||||
+ int mode;
|
||||
+ int adaptive;
|
||||
} MonitorRule;
|
||||
|
||||
typedef struct {
|
||||
@@ -876,15 +880,19 @@ createmon(struct wl_listener *listener, void *data)
|
||||
@@ -848,6 +853,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;
|
||||
+ struct wlr_output_mode *mode = wl_container_of(wlr_output->modes.next, mode, link);
|
||||
const MonitorRule *r;
|
||||
size_t i;
|
||||
struct wlr_output_state state;
|
||||
@@ -876,15 +882,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);
|
||||
+
|
||||
+ if(r->name)
|
||||
+ if(r->mode == -1)
|
||||
+ wlr_output_state_set_custom_mode(&state, r->resx, r->resy,
|
||||
+ r->rate > 0 ? (int)(r->rate * 1000) : 0);
|
||||
+ else
|
||||
+ wlr_output_state_set_mode(&state, wlr_output_preferred_mode(wlr_output));
|
||||
+ (int) (r->rate > 0 ? r->rate * 1000 : 0));
|
||||
+ else {
|
||||
+ 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;
|
||||
@ -82,5 +90,5 @@ index fa76db2..ef2d2f1 100644
|
||||
/* Set up event listeners */
|
||||
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
|
||||
--
|
||||
2.43.2
|
||||
2.44.0
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user