fullscreenadaptivesync: update

- Updated to current main
This commit is contained in:
julmajustus
2026-09-20 03:30:30 +03:00
parent d5bbf841c2
commit 77bc50859c
2 changed files with 26 additions and 29 deletions
+6 -6
View File
@@ -1,9 +1,9 @@
### Description
# fullscreenadaptivesync Enables adaptive sync/VRR when a client is fullscreen.
# fullscreenadaptivesync - Enables adaptive sync/VRR when a client is fullscreen.
Adds a function that automatically enables adaptive sync/VRR when a fullscreen client is detected, and disables it once the client exits fullscreen.
---
1. **Why**
@@ -18,13 +18,13 @@ Adds a function that automatically enables adaptive sync/VRR when a fullscreen c
- When the client exits fullscreen, adaptive sync is disabled again.
4. **togglefullscreenadaptivesync**
- Adds a switch to enable or disable the fullscreenadaptivesync behavior.
- Adds a switch to enable or disable the fullscreenadaptivesync behavior.
- Enabled by default.
### Download
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/fullscreenadaptivesync-wlroots-next)
- [0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/fullscreenadaptivesync/fullscreenadaptivesync-v0.8.patch)
- [wlroots-next-d41ecb7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/fullscreenadaptivesync/fullscreenadaptivesync-wlroots-next-d41ecb7.patch)
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/fullscreenadaptivesync-0.9)
- [0.8](./fullscreenadaptivesync-v0.8.patch)
- [main-d16036e](./fullscreenadaptivesync-d16036e.patch)
### Authors
- [julmajustus](https://codeberg.org/julmajustus)
@@ -1,18 +1,15 @@
From 5d475f7afe7ba7cee389a5c5ed4fa676b408fee5 Mon Sep 17 00:00:00 2001
From 860793b4ff7b03c0fe4be03f2086ae5f25876293 Mon Sep 17 00:00:00 2001
From: julmajustus <julmajustus@tutanota.com>
Date: Mon, 22 Jun 2026 23:02:25 +0300
Subject: [PATCH] fullscreen_adaptive_sync: Minor bug fixes
Date: Sun, 20 Sep 2026 02:32:01 +0300
Subject: [PATCH] fullscreenadaptivesync refactor for d16036e
- Fixed logic error inside unmapnotify
- Added no-op guards inside set_adaptive_sync
- Added extra check for the config commit success
---
config.def.h | 1 +
dwl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index 8a6eda0..06b3153 100644
index 13c5322..262e3f3 100644
--- a/config.def.h
+++ b/config.def.h
@@ -138,6 +138,7 @@ static const Key keys[] = {
@@ -21,13 +18,13 @@ index 8a6eda0..06b3153 100644
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
+ { MODKEY, XKB_KEY_F5, togglefullscreenadaptivesync, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_0, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
diff --git a/dwl.c b/dwl.c
index 8101ffa..aabd882 100644
index 4cfd0fd..c3ab2ba 100644
--- a/dwl.c
+++ b/dwl.c
@@ -323,6 +323,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
@@ -340,6 +340,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
static void requestmonstate(struct wl_listener *listener, void *data);
static void resize(Client *c, struct wlr_box geo, int interact);
static void run(char *startup_cmd);
@@ -35,7 +32,7 @@ index 8101ffa..aabd882 100644
static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating);
@@ -340,6 +341,7 @@ static void tagmon(const Arg *arg);
@@ -357,6 +358,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
@@ -43,16 +40,16 @@ index 8101ffa..aabd882 100644
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data);
@@ -440,6 +442,8 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
static struct wl_listener start_drag = {.notify = startdrag};
@@ -462,6 +464,8 @@ static struct wl_listener start_drag = {.notify = startdrag};
static struct wl_listener new_session_lock = {.notify = locksession};
static struct wl_listener new_foreign_toplevel_capture_request = {.notify = capturerequest};
+static int fullscreen_adaptive_sync_enabled = 1;
+
#ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data);
@@ -2300,6 +2304,43 @@ run(char *startup_cmd)
@@ -2453,6 +2457,43 @@ run(char *startup_cmd)
wl_display_run(dpy);
}
@@ -96,7 +93,7 @@ index 8101ffa..aabd882 100644
void
setcursor(struct wl_listener *listener, void *data)
{
@@ -2363,10 +2404,12 @@ setfullscreen(Client *c, int fullscreen)
@@ -2516,10 +2557,12 @@ setfullscreen(Client *c, int fullscreen)
if (fullscreen) {
c->prev = c->geom;
resize(c, c->mon->m, 0);
@@ -109,7 +106,7 @@ index 8101ffa..aabd882 100644
}
arrange(c->mon);
printstatus();
@@ -2546,7 +2589,7 @@ setup(void)
@@ -2699,7 +2742,7 @@ setup(void)
output_layout = wlr_output_layout_create(dpy);
wl_signal_add(&output_layout->events.change, &layout_change);
@@ -118,7 +115,7 @@ index 8101ffa..aabd882 100644
/* Configure a listener to be notified when new outputs are available on the
* backend. */
@@ -2636,8 +2679,8 @@ setup(void)
@@ -2795,8 +2838,8 @@ setup(void)
wl_signal_add(&virtual_keyboard_mgr->events.new_virtual_keyboard,
&new_virtual_keyboard);
virtual_pointer_mgr = wlr_virtual_pointer_manager_v1_create(dpy);
@@ -129,7 +126,7 @@ index 8101ffa..aabd882 100644
seat = wlr_seat_create(dpy, "seat0");
wl_signal_add(&seat->events.request_set_cursor, &request_cursor);
@@ -2767,6 +2810,12 @@ togglefullscreen(const Arg *arg)
@@ -2930,6 +2973,12 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen);
}
@@ -142,7 +139,7 @@ index 8101ffa..aabd882 100644
void
toggletag(const Arg *arg)
{
@@ -2822,6 +2871,7 @@ unmapnotify(struct wl_listener *listener, void *data)
@@ -2985,6 +3034,7 @@ unmapnotify(struct wl_listener *listener, void *data)
{
/* Called when the surface is unmapped, and should no longer be shown. */
Client *c = wl_container_of(listener, c, unmap);
@@ -150,7 +147,7 @@ index 8101ffa..aabd882 100644
if (c == grabc) {
cursor_mode = CurNormal;
grabc = NULL;
@@ -2837,6 +2887,9 @@ unmapnotify(struct wl_listener *listener, void *data)
@@ -3002,6 +3052,9 @@ unmapnotify(struct wl_listener *listener, void *data)
setmon(c, NULL, 0);
wl_list_remove(&c->flink);
}
@@ -158,8 +155,8 @@ index 8101ffa..aabd882 100644
+ if (c->isfullscreen)
+ set_adaptive_sync(lastmon, 0);
wlr_scene_node_destroy(&c->scene->node);
printstatus();
if (c->foreign_toplevel_handle) {
wlr_ext_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel_handle);
--
2.53.0
2.55.0