python - grabbing keyboard doesnt allow changing focus -


as use display.grab_keyboard, no other window seems know of own focus.

with keyboardgrab running can select other windows , send keyevents them, if window text input there no blinking cursor.

i read grab_keyboard generating focusevents, doesnt mean blocks focus events, it?

what not getting here?

from xlib import x,xk xlib.display import display import signal,sys  root = none display = none  def main():     # current display     global display,root     display = display()     root = display.screen().root       root.change_attributes(event_mask = x.keypressmask|x.keyreleasemask)      root.grab_keyboard(true, x.grabmodeasync, x.grabmodeasync,x.currenttime)      signal.signal(signal.sigalrm, lambda a,b:sys.exit(1))     signal.alarm(10)      while true:         event = display.next_event()         print event.type  main() 

you grabbing keyboard, means keyboard input go program, no other window can receive keyboard input. that's point of grabbing keyboard.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -