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

This commit is contained in:
Anselm R. Garbe 2006-06-30 14:10:03 +02:00
parent 1821c3c3e5
commit 281e1fb5ab
4 changed files with 36 additions and 1 deletions

View File

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

View File

@ -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,
@ -84,6 +88,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)
{

View File

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

View File

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