mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Fix normal mode keyboard grab.
This commit is contained in:
parent
176fd15de1
commit
558bb38630
3 changed files with 12 additions and 4 deletions
|
@ -207,7 +207,9 @@ 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 | FocusChangeMask );
|
||||
XSelectInput ( display, box,
|
||||
KeyReleaseMask | KeyPressMask | ExposureMask |
|
||||
ButtonPressMask | StructureNotifyMask | FocusChangeMask );
|
||||
|
||||
gc = XCreateGC ( display, box, 0, 0 );
|
||||
int line_style = LineOnOffDash;
|
||||
|
@ -1503,7 +1505,6 @@ static int run_dmenu ()
|
|||
|
||||
// Dmenu modi has a return state.
|
||||
ret_state = dmenu_switcher_dialog ();
|
||||
|
||||
teardown ( pfd );
|
||||
return ret_state;
|
||||
}
|
||||
|
|
|
@ -286,8 +286,12 @@ int window_send_message ( Display *display, Window target,
|
|||
return r;
|
||||
}
|
||||
|
||||
extern unsigned int normal_window_mode;
|
||||
int take_keyboard ( Display *display, Window w )
|
||||
{
|
||||
if ( normal_window_mode ) {
|
||||
return 1;
|
||||
}
|
||||
for ( int i = 0; i < 500; i++ ) {
|
||||
if ( XGrabKeyboard ( display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime ) == GrabSuccess ) {
|
||||
return 1;
|
||||
|
@ -300,7 +304,9 @@ int take_keyboard ( Display *display, Window w )
|
|||
|
||||
void release_keyboard ( Display *display )
|
||||
{
|
||||
XUngrabKeyboard ( display, CurrentTime );
|
||||
if ( !normal_window_mode ) {
|
||||
XUngrabKeyboard ( display, CurrentTime );
|
||||
}
|
||||
}
|
||||
// bind a key combination on a root window, compensating for Lock* states
|
||||
void x11_grab_key ( Display *display, unsigned int modmask, KeySym key )
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
#include <rofi.h>
|
||||
|
||||
|
||||
static int test = 0;
|
||||
static int test = 0;
|
||||
unsigned int normal_window_mode = 0;
|
||||
|
||||
#define TASSERT( a ) { \
|
||||
assert ( a ); \
|
||||
|
|
Loading…
Reference in a new issue