React to focus in/out event

This commit is contained in:
QC 2015-09-09 12:00:28 +02:00
parent 93d10cc7c8
commit a0b491c962
1 changed files with 7 additions and 1 deletions

View File

@ -200,7 +200,7 @@ static Window create_window ( Display *display )
Window box = XCreateWindow ( display, DefaultRootWindow ( display ),
0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput,
vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr );
XSelectInput ( display, box, ExposureMask | ButtonPressMask | StructureNotifyMask );
XSelectInput ( display, box, ExposureMask | ButtonPressMask | StructureNotifyMask | FocusChangeMask );
gc = XCreateGC ( display, box, 0, 0 );
int line_style = LineOnOffDash;
@ -1162,6 +1162,12 @@ MenuReturn menu ( Switcher *sw, char **input, char *prompt,
}
}
}
else if ( ev.type == FocusIn) {
take_keyboard(display, main_window);
}
else if ( ev.type == FocusOut) {
release_keyboard(display);
}
// Handle event.
else if ( ev.type == Expose ) {
while ( XCheckTypedEvent ( display, Expose, &ev ) ) {