wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 7b84669efbf9fec43726e98a92ea283a57ce874b
parent a56311392c47482f7c23d6f240082c24971424b2
Author: Kris Maglione <jg@suckless.org>
Date:   Tue,  1 Apr 2008 19:26:46 -0400

Fix M-S-t in rc.wmii. Fix issue #6.

Diffstat:
cmd/strut/win.c | 1-
cmd/wmii/client.c | 10++++++----
cmd/wmii/event.c | 30++++++++++++++++++++++++++++++
cmd/wmii/fns.h | 1+
rc/rc.wmii.rc | 7++++---
5 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/cmd/strut/win.c b/cmd/strut/win.c @@ -87,7 +87,6 @@ config(Window *w, XConfigureEvent *ev) { frame.r = rectaddpt(Rect(0, 0, ev->width, ev->height), Pt(ev->x+ev->border_width, ev->y+ev->border_width)); restrut(); - } static void diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c @@ -474,7 +474,6 @@ client_focus(Client *c) { flushevents(FocusChangeMask, true); _id = id++ % 99; - Dprint(DFocus, "client_focus([%C]%s) %ld\n", c, clientname(c), _id); if(c && c->group) c->group->client = c; @@ -482,16 +481,19 @@ client_focus(Client *c) { sync(); flushevents(FocusChangeMask, true); + Dprint(DFocus, "client_focus([%C]%s) %ld\n", c, clientname(c), _id); Dprint(DFocus, "\t%02d [%C]%s\n\t=> [%C]%s\n", _id, screen->focus, clientname(screen->focus), c, clientname(c)); if(screen->focus != c) { if(c) { - if(c->proto & ProtoTakeFocus) - client_message(c, "WM_TAKE_FOCUS", 0); - else if(!c->noinput) + if(!c->noinput) setfocus(&c->w, RevertToParent); + if(c->proto & ProtoTakeFocus) { + xtime_kludge(); + client_message(c, "WM_TAKE_FOCUS", 0); + } }else setfocus(screen->barwin, RevertToParent); event("ClientFocus %C\n", c); diff --git a/cmd/wmii/event.c b/cmd/wmii/event.c @@ -19,6 +19,36 @@ dispatch_event(XEvent *e) { #define handle(w, fn, ev) \ BLOCK(if((w)->handler->fn) (w)->handler->fn((w), ev)) +static int +findtime(Display *d, XEvent *e, XPointer v) { + Window *w; + + w = (Window*)v; + if(e->type == PropertyNotify && e->xproperty.window == w->w) { + xtime = e->xproperty.time; + return true; + } + return false; +} + +void +xtime_kludge(void) { + Window *w; + WinAttr wa; + XEvent e; + long l; + + w = createwindow(&scr.root, Rect(0, 0, 1, 1), 0, InputOnly, &wa, 0); + + XSelectInput(display, w->w, PropertyChangeMask); + changeprop_long(w, "ATOM", "ATOM", &l, 0); + sync(); + XIfEvent(display, &e, findtime, (void*)w); + + destroywindow(w); +} + + uint flushevents(long event_mask, bool dispatch) { XEvent ev; diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h @@ -91,6 +91,7 @@ void dispatch_event(XEvent*); uint flushenterevents(void); uint flushevents(long, bool dispatch); void print_focus(const char*, Client*, const char*); +void xtime_kludge(void); /* ewmh.c */ int ewmh_clientmessage(XClientMessageEvent*); diff --git a/rc/rc.wmii.rc b/rc/rc.wmii.rc @@ -85,7 +85,8 @@ fn Event-Unresponsive { xmessage -nearmouse -buttons Kill,Wait -print \ $msg $wi_nl '' `{wmiir read /client/sel/label}} if(~ $resp Kill) - wmiir xwrite /client/$client/ctl slay }&} + wmiir xwrite /client/$client/ctl slay + }&} echo $wmiinormcol | wmiir create $noticebar fn Event-Notice { wmiir xwrite $noticebar $wi_arg @@ -142,7 +143,7 @@ fn Action-status { } # Source Variables, &c -if(~ $0 rc.wmii.local */rc.wmii.local) +if(~ $0 ('' */)rc.wmii.local) wi_notice This file should not be named rc.wmii.local if not . `{wi_script -f rc.wmii.local} @@ -158,7 +159,7 @@ fn key { key $MODKEY-Control-t || fn $key { switch(`{wmiir read /keys | wc -l}) { case 0 1 - wmiir xwrite /ctl $keys + wmiir xwrite /keys $keys wmiir xwrite /ctl grabmod $MODKEY case * ifs=() { keys=`{wmiir read /keys} }