Re: [dwm] max_and_focus.patch regression

From: Anselm R. Garbe <arg_AT_10kloc.org>
Date: Mon, 4 Sep 2006 17:08:50 +0200

On Mon, Sep 04, 2006 at 04:57:31PM +0200, Sander van Dijk wrote:
> On 9/4/06, Anselm R. Garbe <arg_AT_10kloc.org> wrote:
> >On Mon, Sep 04, 2006 at 04:18:48PM +0200, Jukka Salmi wrote:
> >> Hi,
> >>
> >> changeset [1]400 seems to have introduced the following behaviour: if
> >> Firefox is running in floating mode and I open a new browser window
> >> (Ctrl-N from within Firefox), the newly opened window is opened "behind"
> >> the existing one (but it gets the focus). With an older dwm binary
> >> it's opened in front of the existing window, as expected. Any hints?
> >>
> >>
> >> TIA, Jukka
> >>
> >> [1] http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm?cs=052657ff2e7b
> >
> >I can reproduce this as well.
> >
> >Regards,
> >--
> > Anselm R. Garbe ><>< www.ebrag.de ><>< GPG key: 0D73F361
> >
> >
>
> My guess is that a call to restack() at the end of manage() in
> client.c will fix this;
>
> change:
>
> if(isvisible(c))
> focus(c);
>
> to:
>
> if(isvisible(c)) {
> focus(c);
> restack();
> }
>
> I'm not at a unix box now so I can't promise, but I think that'll fix
> it. Sorry I overlooked that.

Actually that is a suboptimal fix. I pushed a different solution
which uses the knowledge, that arrange() calls restack()
already. The described problem occured because 'sel' may
point to a different (the previously selected client) until
the focus() is called in the end, this results in a wrong Z
layer order when arrange() calls restack().

--- a/client.c Mon Sep 4 12:23:41 2006 +0200
+++ b/client.c Mon Sep 4 17:02:13 2006 +0200
@@ -254,6 +254,8 @@ manage(Window w, XWindowAttributes *wa)
         clients = c;
 
         settitle(c);
+ if(isvisible(c))
+ sel = c;
         arrange(NULL);
         XMapWindow(dpy, c->win);
         XMapWindow(dpy, c->twin);

Regards,

-- 
 Anselm R. Garbe  ><><  www.ebrag.de  ><><  GPG key: 0D73F361
Received on Mon Sep 04 2006 - 17:08:50 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:30:52 UTC