From ca223c7f0c3d92001d967557b353bc867cc6cabe Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Dec 2024 12:30:41 +0530 Subject: [PATCH] On fucking wayland Qt sends us key events with type keypress that are not instances of the QKeyEvent class. Sigh. --- src/calibre/gui2/keyboard.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/keyboard.py b/src/calibre/gui2/keyboard.py index 5884521377..37f9b584dd 100644 --- a/src/calibre/gui2/keyboard.py +++ b/src/calibre/gui2/keyboard.py @@ -20,6 +20,7 @@ from qt.core import ( QIcon, QItemSelectionModel, QKeyCombination, + QKeyEvent, QKeySequence, QLabel, QMenu, @@ -519,7 +520,7 @@ class Editor(QFrame): # {{{ if t == QEvent.Type.ShortcutOverride: event.accept() return True - if t == QEvent.Type.KeyPress: + if t == QEvent.Type.KeyPress and isinstance(event, QKeyEvent): self.key_press_event(event, 1 if obj is self.button1 else 2) return True return QFrame.eventFilter(self, obj, event)