Closed
Bug 3511
Opened 26 years ago
Closed 26 years ago
[BLOCK] Need key code -> character code translation
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P1)
Tracking
()
VERIFIED
FIXED
M3
People
(Reporter: sfraser_bugs, Assigned: rods)
References
Details
(Whiteboard: 7/9 awaiting developer resolution on Windows keyCode vs. the Gecko virtual key codes questions)
As previously discussed at tague's key handling meeting, we need to have the
translation between virtual key codes (VKC) and character codes, before the
nsKeyEvent gets propagated. This requires work on each platform to get the
character code from platform-specific event data.
This bug is a followup to bug 2213, and was opened to keep track of this
specific requirement.
Comment 1•26 years ago
|
||
adding ftang and myself to the cc list
Comment 2•26 years ago
|
||
Yes, this needs to be done but its really platform work for the widget
libraries. I can add a new field into nsKeyEvent to hold the character code
data and make sure it gets represented internally but platform specific widget
libarary stuff isn't really my bag. Actually, do we need three bugs for this
to keep it clear?
Reporter | ||
Comment 3•26 years ago
|
||
It would seem that capturing the OS event and propagating an nsKeyEvent with the
char code in it falls under the layout umbrella. I agree that handling the key
events at the other end is widget/ender work; all we need for now is the
key event propagation to get fixed. So if you could do the first part, that
would be great.
Comment 4•26 years ago
|
||
That's fine. I'm signed up to ensure that within the layout engine key events
get to the right place. My point is that that has nothing to do with this
specific bug with the possible exception of adding a field to nsGUIEvent. As
the bug points out, this translation needs to happen before the nsKeyEvent is
propagated. Someone else should take this.
Reporter | ||
Comment 5•26 years ago
|
||
You're saying that the event capture and propagation lives in platform-specific
code. If so, please add the charCode field, and make 3 new bugs with platform
owners to implement it.
Reporter | ||
Updated•26 years ago
|
Priority: P2 → P1
Reporter | ||
Comment 6•26 years ago
|
||
Mail/news needs this for dogffood. You can't type punctuation characters now.
Making P1.
Reporter | ||
Updated•26 years ago
|
Assignee: joki → sdagley
Reporter | ||
Comment 7•26 years ago
|
||
Reassign to sdagley, who owns this for now.
QA contact re-assigned according to the product areas we're currently working
on.
Updated•26 years ago
|
Summary: Need key code -> character code translation → [BLOCK] Need key code -> character code translation
Target Milestone: M3
Updated•26 years ago
|
Status: NEW → ASSIGNED
Comment 9•26 years ago
|
||
The character code is now available on Mac and Linux. Rods will be checking in
the required code for Win32 in the morning.
Reporter | ||
Updated•26 years ago
|
Assignee: sdagley → sfraser
Status: ASSIGNED → NEW
Reporter | ||
Comment 10•26 years ago
|
||
rods has checked in already. When the tree goes green, I'll build and see what
works.
Reporter | ||
Updated•26 years ago
|
Assignee: sfraser → rods
OS: All → Windows NT
Reporter | ||
Comment 11•26 years ago
|
||
rods, there are still problems on Windows with some keys. The problem is that
the keyCode field of nsKeyEvent must contain one of the enum values in
nsIDOMEvent.h (also in nsGUIEvent.h), and not the nChar that comes in. The
problem is that keyCode is being set to values that have special meanings,
which means that switch(keyCode) statements elsewhere in the code base fail.
For example, if the char is '.', this may map to VK_HOME, which would be
interpreted as the Home key.
Now perhaps you see why that enum of VK_ codes is so evil.
The solution we've done on Mac and Linux is this: if the key event corresponds
to some special key (e.g. non-printable chars, like arrows, return, home, end
etc) then figure out the right VK_ enum value, and put that in the keyCode.
Otherwise, set the keyCode to 0. See nsGtkEventHandler.cpp for an exmaple.
Reporter | ||
Comment 12•26 years ago
|
||
Oh, wait. I needed to throw a switch in the editor to handle key codes properly.
Duh. Typing works better now.
The the question now is, is the keyCode field always getting the correct value,
because the enum of VK_ values just (magically) happens to correspond to key
codes on Windows keyboards?
Comment 13•26 years ago
|
||
Just to clarify - rods checked in the code to fill in the character code so this
bug is technically fixed but sfraser has some additional questions on the Windows
keyCode vs. the Gecko virtual key codes
Assignee | ||
Updated•26 years ago
|
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Comment 14•26 years ago
|
||
*** Bug 2213 has been marked as a duplicate of this bug. ***
Updated•26 years ago
|
Whiteboard: awaiting developer resolution on Windows keyCode vs. the Gecko virtual key codes questions
Updated•25 years ago
|
Whiteboard: awaiting developer resolution on Windows keyCode vs. the Gecko virtual key codes questions → 6/18 awaiting developer resolution on Windows keyCode vs. the Gecko virtual key codes questions
Updated•25 years ago
|
Whiteboard: 6/18 awaiting developer resolution on Windows keyCode vs. the Gecko virtual key codes questions → 7/9 awaiting developer resolution on Windows keyCode vs. the Gecko virtual key codes questions
Comment 15•25 years ago
|
||
email from rods:
We deliberately made the mappings be identical on one platform and than had the
others do extra work to map it, instead of having all the platforms map it.
The keyCode SHOULD be correct and always there, but tague has changed all my
code to support I18N, so I can no longer guarantee it.
Rod
Updated•25 years ago
|
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•