From a0b491c962729e72cf16c65ef43479ba655d8b0b Mon Sep 17 00:00:00 2001 From: QC Date: Wed, 9 Sep 2015 12:00:28 +0200 Subject: [PATCH] React to focus in/out event --- source/rofi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/rofi.c b/source/rofi.c index ea21a5ca..0a433b21 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -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 ) ) {