aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorPalanix <palanixyt@gmail.com>2022-02-28 23:46:24 +0100
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-23 12:09:24 -0600
commit7d724dc7f34561e7a6d4ab97ff24b07805593f63 (patch)
treee4044b551b2013cb24e32fbb919a38f4efd46d4d /dwl.c
parent326eee14445f8a2c08e80c30778445630c75d3bb (diff)
Fix dwl freezing when resizing
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/dwl.c b/dwl.c
index 9ea44e2..3185062 100644
--- a/dwl.c
+++ b/dwl.c
@@ -178,6 +178,7 @@ struct Monitor {
unsigned int tagset[2];
double mfact;
int nmaster;
+ int un_map; /* If a map/unmap happened on this monitor, then this should be true */
};
typedef struct {
@@ -1379,6 +1380,8 @@ mapnotify(struct wl_listener *listener, void *data)
if (c->isfullscreen)
setfullscreen(c, 1);
+
+ c->mon->un_map = 1;
}
void
@@ -1648,17 +1651,27 @@ rendermon(struct wl_listener *listener, void *data)
int skip = 0;
struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+
/* Render if no XDG clients have an outstanding resize and are visible on
- * this monitor.
- */
- wl_list_for_each(c, &clients, link)
- skip = skip || (c->resize && VISIBLEON(c, m));
+ * this monitor. */
+ /* Checking m->un_map for every client is not optimal but works */
+ wl_list_for_each(c, &clients, link) {
+ if ((c->resize && m->un_map) || (c->type == XDGShell
+ && (c->surface.xdg->pending.geometry.width !=
+ c->surface.xdg->current.geometry.width
+ || c->surface.xdg->pending.geometry.height !=
+ c->surface.xdg->current.geometry.height))) {
+ /* Lie */
+ wlr_surface_send_frame_done(client_surface(c), &now);
+ skip = 1;
+ }
+ }
if (!skip && !wlr_scene_output_commit(m->scene_output))
return;
-
/* Let clients know a frame has been rendered */
- clock_gettime(CLOCK_MONOTONIC, &now);
wlr_scene_output_send_frame_done(m->scene_output, &now);
+ m->un_map = 0;
}
void
@@ -2196,6 +2209,9 @@ unmapnotify(struct wl_listener *listener, void *data)
grabc = NULL;
}
+ if (c->mon)
+ c->mon->un_map = 1;
+
if (client_is_unmanaged(c)) {
wlr_scene_node_destroy(c->scene);
return;