summaryrefslogtreecommitdiffhomepage
path: root/dwm.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2021-05-12 15:00:04 +0200
committerbakkeby <[email protected]>2021-05-12 15:04:43 +0200
commit0b5bc76eef18ff323a776ef8596dab9d5171f7c5 (patch)
treef4c1380d6ab9492830e4b5b6e73554c81ddd15eb /dwm.c
parentef89eb7c71aebab4e2cc797b2016d80cf1d7a193 (diff)
downloaddwm-flexipatch-0b5bc76eef18ff323a776ef8596dab9d5171f7c5.tar.gz
dwm-flexipatch-0b5bc76eef18ff323a776ef8596dab9d5171f7c5.zip
toggelfullscreen: addressing focus change issue when exiting fullscreen properly
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/dwm.c b/dwm.c
index a4883a0..da82ad3 100644
--- a/dwm.c
+++ b/dwm.c
@@ -2817,19 +2817,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
#endif // NOBORDER_PATCH
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
- #if FAKEFULLSCREEN_CLIENT_PATCH
- if (c->fakefullscreen == 1)
- /* Exception: if the client was in actual fullscreen and we exit out to fake fullscreen
- * mode, then the focus would drift to whichever window is under the mouse cursor at the
- * time. To avoid this we pass True to XSync which will make the X server disregard any
- * other events in the queue thus cancelling the EnterNotify event that would otherwise
- * have changed focus. */
- XSync(dpy, True);
- else
- XSync(dpy, False);
- #else
XSync(dpy, False);
- #endif // FAKEFULLSCREEN_CLIENT_PATCH
}
void
@@ -3277,6 +3265,7 @@ setfocus(Client *c)
void
setfullscreen(Client *c, int fullscreen)
{
+ XEvent ev;
int savestate = 0, restorestate = 0;
if ((c->fakefullscreen == 0 && fullscreen && !c->isfullscreen) // normal fullscreen
@@ -3334,6 +3323,13 @@ setfullscreen(Client *c, int fullscreen)
restack(c->mon);
} else
resizeclient(c, c->x, c->y, c->w, c->h);
+
+ /* Exception: if the client was in actual fullscreen and we exit out to fake fullscreen
+ * mode, then the focus would sometimes drift to whichever window is under the mouse cursor
+ * at the time. To avoid this we ask X for all EnterNotify events and just ignore them.
+ */
+ if (!c->isfullscreen)
+ while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
#else
void