mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-03-22 00:41:30 +00:00
monitorconfig: update for dwl-wlroots-next-f4249db and for dwl-0.8
This commit is contained in:
parent
1988d629ec
commit
1b063e68bb
@ -3,7 +3,8 @@ Allows more monitor configuration in config.h
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/Palanix/dwl/src/branch/monitorconfig)
|
||||
- [2024-02-15](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/monitorconfig/monitorconfig.patch)
|
||||
- [wlroots-next-f4249db](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/monitorconfig/monitorconfig-wlroots-next-f4249db.patch)
|
||||
- [0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/monitorconfig/monitorconfig-0.8.patch)
|
||||
|
||||
### Authors
|
||||
- [Palanix](https://codeberg.org/Palanix)
|
||||
|
||||
@ -1,43 +1,38 @@
|
||||
From 73f70cd9d817a307030f360f6c8a2500046b8b76 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
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
From 72137ab7f63e251f2e1c9557e236fd4e9c4efa38 Mon Sep 17 00:00:00 2001
|
||||
From: A Frederick Christensen <dwl@ivories.org>
|
||||
Date: Tue, 24 Feb 2026 23:12:17 -0600
|
||||
Subject: [PATCH] monitorconfig: update for dwl 0.8
|
||||
|
||||
Co-authored-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||
---
|
||||
config.def.h | 11 +++++++----
|
||||
config.def.h | 12 ++++++++----
|
||||
dwl.c | 25 +++++++++++++++++++------
|
||||
2 files changed, 26 insertions(+), 10 deletions(-)
|
||||
2 files changed, 27 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8f498d2..4ccacd2 100644
|
||||
index 8a6eda0..597e3bb 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -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 */
|
||||
@@ -40,10 +40,14 @@ static const Layout layouts[] = {
|
||||
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
|
||||
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
|
||||
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 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, 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
|
||||
*/
|
||||
/* defaults */
|
||||
- /* 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 }, */
|
||||
- { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0.0f, 0 ,1},
|
||||
+ /* name mfact nmaster scale layout rotate/reflect x y resx resy rate mode adaptive */
|
||||
+ /*{"eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000f, 1, 1}, /* example of a HiDPI laptop monitor at 120Hz: */
|
||||
+ /*
|
||||
+ * mode lets the user decide how dwl should implement the modes:
|
||||
+ * -1 sets a custom mode following the user's choice
|
||||
+ * All other numbers set the mode at the index n; 0 is the standard mode; see wlr-randr
|
||||
+ */
|
||||
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0.0f, 0, 1},
|
||||
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
||||
};
|
||||
|
||||
/* keyboard */
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 52bfbc8..9609b6d 100644
|
||||
index 44f3ad9..987b5a6 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -215,6 +215,11 @@ typedef struct {
|
||||
@ -50,9 +45,9 @@ index 52bfbc8..9609b6d 100644
|
||||
+ int mode;
|
||||
+ int adaptive;
|
||||
} MonitorRule;
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -865,6 +870,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||
@@ -1041,6 +1046,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,7 +55,7 @@ index 52bfbc8..9609b6d 100644
|
||||
const MonitorRule *r;
|
||||
size_t i;
|
||||
struct wlr_output_state state;
|
||||
@@ -893,16 +899,23 @@ createmon(struct wl_listener *listener, void *data)
|
||||
@@ -1069,16 +1075,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);
|
||||
@ -80,7 +75,7 @@ index 52bfbc8..9609b6d 100644
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- /* The mode is a tuple of (width, height, refresh rate), and each
|
||||
- * monitor supports only a specific set of modes. We just pick the
|
||||
- * monitor's preferred mode; a more sophisticated compositor would let
|
||||
@ -90,6 +85,6 @@ index 52bfbc8..9609b6d 100644
|
||||
/* Set up event listeners */
|
||||
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
|
||||
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
|
||||
--
|
||||
2.45.1
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
From 5c4acb4b870687e5305ce3ed60731476fc8db7a5 Mon Sep 17 00:00:00 2001
|
||||
From: A Frederick Christensen <dwl@ivories.org>
|
||||
Date: Tue, 24 Feb 2026 23:17:36 -0600
|
||||
Subject: [PATCH] monitorconfig: update for dwl-wlroots-next-f4249db
|
||||
|
||||
---
|
||||
config.def.h | 12 ++++++++----
|
||||
dwl.c | 25 +++++++++++++++++++------
|
||||
2 files changed, 27 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8a6eda0..597e3bb 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -40,10 +40,14 @@ static const Layout layouts[] = {
|
||||
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
|
||||
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
|
||||
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 }, */
|
||||
- { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
+ /* name mfact nmaster scale layout rotate/reflect x y resx resy rate mode adaptive */
|
||||
+ /*{"eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000f, 1, 1}, /* example of a HiDPI laptop monitor at 120Hz: */
|
||||
+ /*
|
||||
+ * mode lets the user decide how dwl should implement the modes:
|
||||
+ * -1 sets a custom mode following the user's choice
|
||||
+ * All other numbers set the mode at the index n; 0 is the standard mode; see wlr-randr
|
||||
+ */
|
||||
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0.0f, 0, 1},
|
||||
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
||||
};
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 8a9715d..c57591f 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -217,6 +217,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 {
|
||||
@@ -1043,6 +1048,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;
|
||||
@@ -1071,16 +1077,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 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);
|
||||
+ }
|
||||
+
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- /* The mode is a tuple of (width, height, refresh rate), and each
|
||||
- * monitor supports only a specific set of modes. We just pick the
|
||||
- * 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));
|
||||
-
|
||||
/* Set up event listeners */
|
||||
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
|
||||
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
|
||||
--
|
||||
2.52.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user