add refresh rate patch for perseus

This commit is contained in:
2026-04-12 21:54:19 +02:00
parent 76aa69c13a
commit 3308bdb0ad
2 changed files with 39 additions and 4 deletions
+8 -4
View File
@@ -1,11 +1,15 @@
[
(final: prev: {
dwl = (
prev.dwl.override {
dwl =
(prev.dwl.override {
configH = ./config_files/dwl/config.h;
enableXWayland = true;
}
);
}).overrideAttrs
(oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [
../../patches/dwl/refresh_rate.patch
];
});
})
(final: prev: {
+31
View File
@@ -0,0 +1,31 @@
--- dwl-bak/dwl.c 2026-04-09 15:53:00.841862418 +0200
+++ dwl/dwl.c 2026-04-09 16:02:39.604999328 +0200
@@ -1045,6 +1045,7 @@
size_t i;
struct wlr_output_state state;
Monitor *m;
+ struct wlr_output_mode *mode = NULL;
if (!wlr_output_init_render(wlr_output, alloc, drw))
return;
@@ -1077,7 +1078,19 @@
* 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));
+ if (refresh_rate || s_width || s_height) {
+ wl_list_for_each(mode, &wlr_output->modes, link) {
+ if ((refresh_rate == 0 || mode->refresh == refresh_rate) && (s_width == 0 || mode->width == s_width) && (s_height == 0 || mode->height == s_height)) {
+ break;
+ }
+ }
+ }
+ if (mode == NULL) {
+ printf("Was not able find output mode with (width, height, refresh rate): (%d, %d, %d)\n", s_width, s_height, refresh_rate);
+ mode = wlr_output_preferred_mode(wlr_output);
+ }
+
+ wlr_output_state_set_mode(&state, mode);
/* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);