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

This commit is contained in:
Kris Maglione 2008-04-01 19:26:46 -04:00
parent a56311392c
commit 7b84669efb
5 changed files with 41 additions and 8 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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*);

View File

@ -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} }