diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/General/hotkey/hotkeydialog.cpp | 5 | ||||
| -rw-r--r-- | src/plugins/General/hotkey/hotkeydialog.h | 2 | ||||
| -rw-r--r-- | src/plugins/General/hotkey/hotkeymanager.cpp | 7 | ||||
| -rw-r--r-- | src/plugins/General/hotkey/hotkeymanager.h | 1 | ||||
| -rw-r--r-- | src/plugins/General/hotkey/settingsdialog.cpp | 4 |
5 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/General/hotkey/hotkeydialog.cpp b/src/plugins/General/hotkey/hotkeydialog.cpp index abc6574fd..75672347e 100644 --- a/src/plugins/General/hotkey/hotkeydialog.cpp +++ b/src/plugins/General/hotkey/hotkeydialog.cpp @@ -37,10 +37,11 @@ HotkeyDialog::~HotkeyDialog() void HotkeyDialog::keyPressEvent (QKeyEvent *event) { - m_key = event->nativeVirtualKey (); + m_key = HotkeyManager::keycodeToKeysym(event->nativeScanCode ()); m_modifiers = event->nativeModifiers (); foreach(long mask_mod, HotkeyManager::ignModifiersList()) m_modifiers &= ~mask_mod; //remove ignoried modifiers (num lock, caps lock, etc) + ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers)); QWidget::keyPressEvent(event); } @@ -50,7 +51,7 @@ quint32 HotkeyDialog::nativeModifiers () const return m_modifiers; } -quint32 HotkeyDialog::nativeVirtualKey () const +quint32 HotkeyDialog::keySym () const { return m_key; } diff --git a/src/plugins/General/hotkey/hotkeydialog.h b/src/plugins/General/hotkey/hotkeydialog.h index a0c96049a..5fd8c4e89 100644 --- a/src/plugins/General/hotkey/hotkeydialog.h +++ b/src/plugins/General/hotkey/hotkeydialog.h @@ -38,7 +38,7 @@ public: ~HotkeyDialog(); quint32 nativeModifiers () const; - quint32 nativeVirtualKey () const; + quint32 keySym () const; public slots: virtual void accept(); diff --git a/src/plugins/General/hotkey/hotkeymanager.cpp b/src/plugins/General/hotkey/hotkeymanager.cpp index 712c7871c..ec1fb4350 100644 --- a/src/plugins/General/hotkey/hotkeymanager.cpp +++ b/src/plugins/General/hotkey/hotkeymanager.cpp @@ -127,7 +127,7 @@ bool HotkeyManager::eventFilter(QObject* o, QEvent* e) if (e->type() == QEvent::KeyPress && (o == qApp->desktop () || o == qApp->activeWindow ())) { QKeyEvent* k = static_cast<QKeyEvent*>(e); - quint32 key = k->nativeVirtualKey (); + quint32 key = XKeycodeToKeysym(QX11Info::display(), k->nativeScanCode (), 0); quint32 mod = k->nativeModifiers (); foreach(Hotkey *hotkey, m_grabbedKeys) { @@ -283,3 +283,8 @@ QList<long> HotkeyManager::ignModifiersList() } return ret; } + +quint32 HotkeyManager::keycodeToKeysym(quint32 keycode) +{ + return XKeycodeToKeysym(QX11Info::display(), keycode, 0); +} diff --git a/src/plugins/General/hotkey/hotkeymanager.h b/src/plugins/General/hotkey/hotkeymanager.h index d892a78ce..dddb10a9e 100644 --- a/src/plugins/General/hotkey/hotkeymanager.h +++ b/src/plugins/General/hotkey/hotkeymanager.h @@ -73,6 +73,7 @@ public: static const QString getKeyString(quint32 key, quint32 modifiers); static QList<long> ignModifiersList(); + static quint32 keycodeToKeysym(quint32 keycode); protected: virtual bool eventFilter(QObject* o, QEvent* e); diff --git a/src/plugins/General/hotkey/settingsdialog.cpp b/src/plugins/General/hotkey/settingsdialog.cpp index 18a77f5a6..bc4e897e5 100644 --- a/src/plugins/General/hotkey/settingsdialog.cpp +++ b/src/plugins/General/hotkey/settingsdialog.cpp @@ -100,8 +100,8 @@ void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item) if (item->type() >= QTableWidgetItem::UserType && dialog->exec() == QDialog::Accepted) { - item->setText(HotkeyManager::getKeyString(dialog->nativeVirtualKey (), dialog->nativeModifiers ())); - k->key = dialog->nativeVirtualKey (); + item->setText(HotkeyManager::getKeyString(dialog->keySym (), dialog->nativeModifiers ())); + k->key = dialog->keySym (); k->mod = dialog->nativeModifiers (); } delete dialog; |
