diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 2d6b75740f..b0d85e24ac 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -329,7 +329,7 @@ process_events() { // We thought about not generating the keypress event, but we need // that repeat for backspace. Rethink later. - handle_keypress(event.xkey); + handle_keyrepeat(event.xkey); continue; } else { @@ -1499,6 +1499,34 @@ handle_keypress(XKeyEvent &event) { } } +/** + * Generates a keyrepeat corresponding to the indicated X KeyPress event. + */ +void x11GraphicsWindow:: +handle_keyrepeat(XKeyEvent &event) { + if (_properties.get_mouse_mode() != WindowProperties::M_relative) { + _input->set_pointer_in_window(event.x, event.y); + } + + // Now get the raw unshifted button. + ButtonHandle button = get_button(event, false); + if (button != ButtonHandle::none()) { + if (button == KeyboardButton::lcontrol() || button == KeyboardButton::rcontrol()) { + _input->button_down(KeyboardButton::control()); + } + if (button == KeyboardButton::lshift() || button == KeyboardButton::rshift()) { + _input->button_down(KeyboardButton::shift()); + } + if (button == KeyboardButton::lalt() || button == KeyboardButton::ralt()) { + _input->button_down(KeyboardButton::alt()); + } + if (button == KeyboardButton::lmeta() || button == KeyboardButton::rmeta()) { + _input->button_down(KeyboardButton::meta()); + } + _input->button_down(button); + } +} + /** * Generates a keyrelease corresponding to the indicated X KeyRelease event. */ diff --git a/panda/src/x11display/x11GraphicsWindow.h b/panda/src/x11display/x11GraphicsWindow.h index f512b16a19..56235d96df 100644 --- a/panda/src/x11display/x11GraphicsWindow.h +++ b/panda/src/x11display/x11GraphicsWindow.h @@ -59,6 +59,7 @@ protected: virtual void setup_colormap(XVisualInfo *visual); void handle_keystroke(XKeyEvent &event); void handle_keypress(XKeyEvent &event); + void handle_keyrepeat(XKeyEvent &event); void handle_keyrelease(XKeyEvent &event); ButtonHandle get_button(XKeyEvent &key_event, bool allow_shift);