Don't grab the keyboard on press and only react to presses (temporary until trial1).

This commit is contained in:
Tomeu Vizoso 2007-03-17 20:46:44 +01:00
parent ebe043a4d2
commit 57b617ef25
2 changed files with 19 additions and 2 deletions

View File

@ -92,6 +92,13 @@ class _KeyListener(object):
self._frame.mode != MODE_KEYBOARD:
return
if self._frame.visible:
self._frame.hide()
else:
self._frame.show()
self._frame.mode = MODE_KEYBOARD
"""
if self._state == _KeyListener._HIDDEN:
self._frame.show()
self._frame.mode = MODE_KEYBOARD
@ -101,13 +108,17 @@ class _KeyListener(object):
elif self._state == _KeyListener._SHOWN_RELEASED:
self._frame.hide()
self._state = _KeyListener._HIDDEN
"""
def key_release(self):
pass
"""
if self._state == _KeyListener._SHOWN_PRESSED:
self._state = _KeyListener._SHOWN_RELEASED
elif self._state == _KeyListener._SHOWN_REPEAT:
self._frame.hide()
self._state = _KeyListener._HIDDEN
"""
class Frame(object):
def __init__(self, shell):

View File

@ -173,12 +173,18 @@ class KeyHandler(object):
def _key_pressed_cb(self, grabber, keycode, state):
key = grabber.get_key(keycode, state)
logging.debug('_key_pressed_cb: %i %i %s' % (keycode, state, key))
if key:
self._key_pressed = key
self._keycode_pressed = keycode
self._keystate_pressed = state
gtk.gdk.keyboard_grab(gtk.gdk.get_default_root_window(),
owner_events=False, time=0L)
"""
status = gtk.gdk.keyboard_grab(gtk.gdk.get_default_root_window(),
owner_events=False, time=0L)
if status != gtk.gdk.GRAB_SUCCESS:
logging.error("KeyHandler._key_pressed_cb(): keyboard grab failed: " + status)
"""
action = _actions_table[key]
method = getattr(self, 'handle_' + action)