Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
Fix color updates when changing client focus from key events
Browse files Browse the repository at this point in the history
This patch was originally posted on this Arch Linux forum thread:

  https://bbs.archlinux.org/viewtopic.php?id=176489

It was created against the combined wmii+ixp release found here:

  http://dl.suckless.org/wmii/wmii+ixp-3.9.2.tbz

I'm having a hard time remembering the details of the bug this patch
fixes now, but here is the e-mail I sent to Kris Maglione and Arch's
wmii package maintainer if you're interested:

> The problem comes down to the focusout() function in cmd/wmii/event.c.
> It tests for the condition that the event's mode is NotifyGrab and
> there is a KeyPress event later in the queue, and if both of these
> fail then it proceeds to handle the FocusOut event, eventually
> clearing disp.focus to c_magic in focusout_event()
> (cmd/wmii/client.c).  Then, when the KeyPress event finally does
> arrive, client_focus() is unable to update the previously-focused
> client's border with normcolors because disp.focus was already
> cleared.
>
> My fix simply tweaks focusout()'s logic so that the else branch never
> executes if ev->mode == NotifyGrab, regardless of whether there's a
> KeyPress event in the queue yet.  I don't know whether it should be
> considered a bug in X that we received a FocusOut-NotifyGrab event
> before the KeyPress event is available, but this change seems to work.

Corey
  • Loading branch information
cmtptr authored and sunaku committed Apr 18, 2015
1 parent 0d2ad7e commit fc3e198
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/wmii/event.c
Expand Up @@ -70,9 +70,10 @@ event_focusout(XFocusChangeEvent *ev) {
if(ev->mode == NotifyUngrab) if(ev->mode == NotifyUngrab)
disp.hasgrab = nil; disp.hasgrab = nil;


if((ev->mode == NotifyGrab) if(ev->mode == NotifyGrab) {
&& XCheckMaskEvent(display, KeyPressMask, &me)) if (XCheckMaskEvent(display, KeyPressMask, &me))
event_dispatch(&me); event_dispatch(&me);
}
else if((w = findwin(ev->window))) else if((w = findwin(ev->window)))
event_handle(w, focusout, ev); event_handle(w, focusout, ev);
} }
Expand Down

0 comments on commit fc3e198

Please sign in to comment.