1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

React to focus in/out event

This commit is contained in:
QC 2015-09-09 12:00:28 +02:00
parent 93d10cc7c8
commit a0b491c962

View file

@ -200,7 +200,7 @@ static Window create_window ( Display *display )
Window box = XCreateWindow ( display, DefaultRootWindow ( display ), Window box = XCreateWindow ( display, DefaultRootWindow ( display ),
0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput, 0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput,
vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr ); 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 ); gc = XCreateGC ( display, box, 0, 0 );
int line_style = LineOnOffDash; 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. // Handle event.
else if ( ev.type == Expose ) { else if ( ev.type == Expose ) {
while ( XCheckTypedEvent ( display, Expose, &ev ) ) { while ( XCheckTypedEvent ( display, Expose, &ev ) ) {