[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bkdelibs=5D_khtml/xml=3A_Fix_keyCode_for_=28_and_sim?=
From: Maks Orlovich <maksim () kde ! org>
Date: 2011-02-19 22:43:38
Message-ID: 20110219224338.A3157A60BE () git ! kde ! org
[Download RAW message or body]
Git commit c59759b14618ab2a81fa430f8074c5c95e6b9b38 by Maks Orlovich.
Committed on 13/02/2011 at 18:52.
Pushed by orlovich into branch 'master'.
Fix keyCode for ( and similar in keydown/up
We want to return something like ( for those to avoid
confusion on arrow keys, which affected e.g. youtube.
BUG: 224315
M +25 -3 khtml/xml/dom2_eventsimpl.cpp
http://commits.kde.org/kdelibs/c59759b14618ab2a81fa430f8074c5c95e6b9b38
diff --git a/khtml/xml/dom2_eventsimpl.cpp b/khtml/xml/dom2_eventsimpl.cpp
index f4b4c61..f01a533 100644
--- a/khtml/xml/dom2_eventsimpl.cpp
+++ b/khtml/xml/dom2_eventsimpl.cpp
@@ -899,10 +899,32 @@ int KeyboardEventImpl::keyCode() const
{
//Keycode on key events always identifies the -key- and not the input,
//so e.g. 'a' will get 'A'
- if (m_virtKeyVal != DOM_VK_UNDEFINED)
+ if (m_virtKeyVal != DOM_VK_UNDEFINED) {
return m_virtKeyVal;
- else
- return QChar((unsigned short)m_keyVal).toUpper().unicode();
+ } else {
+ unsigned char code = QChar((unsigned short)m_keyVal).toUpper().unicode();
+ // Some codes we get from Qt are things like ( which conflict with
+ // browser scancodes. Remap them to what's on their keycaps in a US
+ // layout.
+ if (virtKeyToQtKey()->hasLeft(code)) {
+ switch (code) {
+ case '!': return '1';
+ case '@': return '2';
+ case '#': return '3';
+ case '$': return '4';
+ case '%': return '5';
+ case '^': return '6';
+ case '&': return '7';
+ case '*': return '8';
+ case '(': return '9';
+ case ')': return '0';
+ default:
+ kWarning(6000) << "Don't know how resolve conflict of code:" << code
+ << " with a virtKey";
+ }
+ }
+ return code;
+ }
}
int KeyboardEventImpl::charCode() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic