Re: [hackers] [dwm][PATCH] fix lost focus issues when current window is fullscreen

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue, 26 Jul 2016 22:34:57 +0200

On Tue, Jul 26, 2016 at 02:15:36PM +0200, soeren_AT_soeren-tempel.net wrote:
> From: Sören Tempel <soeren+git_AT_soeren-tempel.net>
>
> If your current window is in fullscreen mode than you are able to
> trigger a few cases where the current window focus is lost. For instance
> when your current window is in fullscreen mode and you spawn a new
> window (e.g. using dmenu) the new window will be focused but you can't
> see it because the previous window is still in fullscreen mode.
>
> For instance if you run mpv --fullscreen somevideo.mkv, invoke dmenu
> afterwards using Alt+P and start a terminal emulator than you can't see
> your terminal emulator window even though it is now the current window.
>
> This patch attempts to fix these edge cases by either not allowing
> certain actions when the current window is fullscreen or by
> deactivating the fullscreen mode before performing certain operations.

Hey,

Nice find. I have tested your patch but think we should do it differently.

I don't think we should reset fullscreen on the current client, but instead
keep the focus on it and don't change focus to a new client while a fullscreen
one is running. Below is my suggested patch, lemme know what you think and if
it works correctly as I described:


diff --git a/dwm.c b/dwm.c
index b2bc9bd..600c9b5 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -1085,6 +1085,10 @@ manage(Window w, XWindowAttributes *wa)
                         (unsigned char *) &(c->win), 1);
         XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
         setclientstate(c, NormalState);
+ if (c->mon->sel && c->mon->sel->isfullscreen) {
+ XMapWindow(dpy, c->win);
+ return;
+ }
         if (c->mon == selmon)
                 unfocus(selmon->sel, 0);
         c->mon->sel = c;


-- 
Kind regards,
Hiltjo
Received on Tue Jul 26 2016 - 22:34:57 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 26 2016 - 22:48:13 CEST