private void dispatch_key_press() { KeyPress e = (KeyPress)evt; int keycode = e.detail(); int keystate = e.state(); int keysym = display.input.keycode_to_keysym(keycode, keystate); if ((event_mask & KEYBOARD_BIT) != 0) { handle_keyboard(keysym, keystate, e.event_x(), e.event_y()); } if (keysym == gnu.x11.keysym.Misc.ESCAPE) { exit(); } }