wmii

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

commit 281e1fb5ab1de616a6b58ed14635992de6fe3b0d
parent 1821c3c3e51f6eb38f4d23d106348c79f31f6614
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Fri, 30 Jun 2006 14:10:03 +0200

added focus{in,out} notification (this is necessary to get a clue while we can grab the keyboard for the tagbar)


Diffstat:
cmd/wm/client.c | 3++-
cmd/wm/event.c | 22++++++++++++++++++++++
liblitz/blitz.h | 2++
liblitz/input.c | 10++++++++++
4 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -116,7 +116,8 @@ create_client(Window w, XWindowAttributes *wa) fwa.background_pixmap = ParentRelative; fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ExposureMask - | ButtonPressMask | PointerMotionMask | ButtonReleaseMask; + | ButtonPressMask | PointerMotionMask | FocusChangeMask + | ButtonReleaseMask | KeyPressMask; c->framewin = XCreateWindow(blz.display, blz.root, c->rect.x, c->rect.y, c->rect.width + 2 * def.border, diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -16,6 +16,8 @@ static void handle_buttonrelease(XEvent *e); static void handle_configurerequest(XEvent *e); static void handle_destroynotify(XEvent *e); static void handle_enternotify(XEvent *e); +static void handle_focusin(XEvent *e); +static void handle_focusout(XEvent *e); static void handle_leavenotify(XEvent *e); static void handle_expose(XEvent *e); static void handle_keypress(XEvent *e); @@ -31,6 +33,8 @@ void (*handler[LASTEvent]) (XEvent *) = { [ConfigureRequest]= handle_configurerequest, [DestroyNotify] = handle_destroynotify, [EnterNotify] = handle_enternotify, + [FocusIn] = handle_focusin, + [FocusOut] = handle_focusout, [LeaveNotify] = handle_leavenotify, [Expose] = handle_expose, [KeyPress] = handle_keypress, @@ -85,6 +89,24 @@ handle_buttonrelease(XEvent *e) } static void +handle_focusin(XEvent *e) +{ + Frame *f; + XFocusChangeEvent *ev = &e->xfocus; + if((f = frame_of_win(ev->window))) + blitz_focusin_input(&f->tagbar); +} + +static void +handle_focusout(XEvent *e) +{ + Frame *f; + XFocusChangeEvent *ev = &e->xfocus; + if((f = frame_of_win(ev->window))) + blitz_focusout_input(&f->tagbar); +} + +static void handle_motionnotify(XEvent *e) { Frame *f; diff --git a/liblitz/blitz.h b/liblitz/blitz.h @@ -100,3 +100,5 @@ Bool blitz_bpress_input(BlitzInput *i, int x, int y); Bool blitz_brelease_input(BlitzInput *i, int x, int y); Bool blitz_bmotion_input(BlitzInput *i, int x, int y); Bool blitz_ispointinrect(int x, int y, XRectangle * r); +void blitz_focusin_input(BlitzInput *i); +void blitz_focusout_input(BlitzInput *i); diff --git a/liblitz/input.c b/liblitz/input.c @@ -143,6 +143,16 @@ charof(BlitzInput *i, int x, int y) return xcharof(i, x, i->text, strlen(i->text)); } +void +blitz_focusin_input(BlitzInput *i) +{ +} + +void +blitz_focusout_input(BlitzInput *i) +{ +} + Bool blitz_bpress_input(BlitzInput *i, int x, int y) {