aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-06 13:56:28 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-06 13:58:56 -0600
commit4a32293548667e68cd9a103e22368b8db1754deb (patch)
tree7876e8b30d165b8ae09a66a2096ed4d4b6d3971d /dwl.c
parent9136b6247d186790926bdee32d0a17d668ff8924 (diff)
Revert "fix flickering when resizing/spawning windows"
This reverts commit 017bb7d7521f68d37bfe656c10f45edbcc92dd61. Bug: https://github.com/djpohly/dwl/issues/349
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/dwl.c b/dwl.c
index b26743c..a1f579a 100644
--- a/dwl.c
+++ b/dwl.c
@@ -182,6 +182,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 {
@@ -1383,6 +1384,8 @@ mapnotify(struct wl_listener *listener, void *data)
}
printstatus();
+ c->mon->un_map = 1;
+
unset_fullscreen:
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
wl_list_for_each(w, &clients, link)
@@ -1683,19 +1686,30 @@ rendermon(struct wl_listener *listener, void *data)
* generally at the output's refresh rate (e.g. 60Hz). */
Monitor *m = wl_container_of(listener, m, frame);
Client *c;
+ 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)
- if (client_is_rendered_on_mon(c, m) && (!c->isfloating && c->resize))
- goto skip;
- if (!wlr_scene_output_commit(m->scene_output))
+ /* 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;
-skip:
/* 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
@@ -2260,6 +2274,9 @@ unmapnotify(struct wl_listener *listener, void *data)
grabc = NULL;
}
+ if (c->mon)
+ c->mon->un_map = 1;
+
if (client_is_unmanaged(c)) {
if (c == exclusive_focus)
exclusive_focus = NULL;