diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-08-09 13:57:39 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-08-09 13:57:39 +0000 |
| commit | c840cac739329c18aba8397b593f358f35412d97 (patch) | |
| tree | acf61568a854ccf3569f6fec6c6b3136ca22a442 /src | |
| parent | cdeb87c0597f075b6649a0270db8a511a325256a (diff) | |
| download | qmmp-c840cac739329c18aba8397b593f358f35412d97.tar.gz qmmp-c840cac739329c18aba8397b593f358f35412d97.tar.bz2 qmmp-c840cac739329c18aba8397b593f358f35412d97.zip | |
hotkey plugin: fixed bug with capslock
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1132 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
| -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; |
