Closed
Bug 166240
Opened 21 years ago
Closed 12 years ago
Implement D3E KeyboardEvent.location (except JOYSTICK)
Categories
(Core :: DOM: Events, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla15
People
(Reporter: ilya.konstantinov+future, Assigned: masayuki)
References
()
Details
(Keywords: dev-doc-complete)
Attachments
(9 files, 1 obsolete file)
1.17 KB,
text/html
|
Details | |
5.69 KB,
patch
|
smaug
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
2.92 KB,
patch
|
karlt
:
review+
|
Details | Diff | Splinter Review |
2.07 KB,
patch
|
smichaud
:
review+
|
Details | Diff | Splinter Review |
809 bytes,
patch
|
cpeterson
:
review+
|
Details | Diff | Splinter Review |
1.11 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
816 bytes,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
28.28 KB,
patch
|
jimm
:
review+
|
Details | Diff | Splinter Review |
19.51 KB,
patch
|
smaug
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
To complete my XBL plugin for Mozilla which enhances BiDi support with useful keyboard shortcuts, I wanted to bind Windows-like LeftCtrl-Shift and RightCtrl-Shift shortcuts to left/right directionality changes. Unfortunatelly (as I found later, as a result of the "key handling revision 3" document), Mozilla doesn't differentiate between left and right Shift, Ctrl or Alt. Could this be changed? To retrieve the side of the modifiers, we can use the same property names as Internet Explorer does (altLeft, ctrlLeft, shiftLeft): http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_event.asp
![]() |
||
Updated•21 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•21 years ago
|
Priority: -- → P3
Reporter | ||
Comment 1•21 years ago
|
||
Note: DOM 3 can differentiate between left and right modifiers in its TextEvent, but we don't support this part of DOM 3 yet. Our KeyEvent is non-standard anyway -- should KeyEvent remain frozen (hoping to deprecate it one day) or can we implement this feature too until TextEvent support arrives?
Reporter | ||
Updated•20 years ago
|
Assignee: joki → mozilla-bugzilla
Reporter | ||
Comment 2•19 years ago
|
||
Clarifying: This bug would be fixed when DOM3 events (namely KeyboardEvent) are in.
Depends on: nsdomevent_separate
Comment 3•16 years ago
|
||
Can someone please add dependence on a relevant bug re adding DOM3 KeyboardEvent? Has there been any progress on this issue since 2004?
Updated•14 years ago
|
QA Contact: vladimire → events
Assignee | ||
Updated•13 years ago
|
Assignee: mozilla-bugzilla → masayuki
Summary: Ability to differentiate between left and right modifiers → Implement DOM3 KeyboardEvent.location for ability to differentiate between left and right modifiers
Is this issue still being worked on? It's absolutely ridiculous that an issue like this has to stay open for 9 years without any solution whatsoever. Can someone address this issue please? Give it the "moz" prefix until those DOM3 specifications are finally finished all you want, just add this functionality! Thanks, -J
Updated•12 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Updated•12 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 6•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Summary: Implement DOM3 KeyboardEvent.location for ability to differentiate between left and right modifiers → Implement D3E KeyboardEvent.location (except JOYSTICK)
Assignee | ||
Comment 7•12 years ago
|
||
Attachment #618609 -
Flags: review?(bugs)
Comment 8•12 years ago
|
||
Comment on attachment 618609 [details] [diff] [review] part.1 Add D3E KeyboardEvent.location I assume tests will be added in some other patch. IMO, this patch shouldn't be pushed before we support also other than DOM_KEY_LOCATION_STANDARD.
Attachment #618609 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 9•12 years ago
|
||
Windows's widget needs some clean up for this. For checking the key location, We need to call MapVirtualKeyEx() with scan code. I made mozilla::widget::NativeKeyInfo class in KeyboardLayout.h. It initializes all members at created. And computes the left-right distinguished key code from the key/char message. The instance is made in stack when methods make nsKeyEvent instance. And OnKeyDown() passes the instance to OnChar() and InitKeyEvent(). OnCharRaw() is replaced with OnChar(). On current code, they are not needed to be separated. InitKeyEvent() is separated from DispatchKeyEvent(). It initializes only common members between all callers.
Attachment #618615 -
Flags: review?(jmathies)
Assignee | ||
Comment 10•12 years ago
|
||
Comment on attachment 618615 [details] [diff] [review] part.2 Add support KeyboardEvent.location on Windows Sorry for the spam. This may have bug.
Attachment #618615 -
Flags: review?(jmathies)
Assignee | ||
Comment 11•12 years ago
|
||
Assignee | ||
Comment 12•12 years ago
|
||
This patch doesn't trust NSAlphaShiftKeyMask because it's applied to arrow keys too :-(
Attachment #618619 -
Flags: review?(smichaud)
Assignee | ||
Comment 13•12 years ago
|
||
We should support only MOBILE for now. If we can distinguish the kind of input device by KeyEvent.getDeviceId(), we might be set same location values for full keyboard connected by Bluetooth and set JOYSTICK. But I don't familiar with Android and shouldn't be problem for now because WebKit hasn't supported .location yet.
Attachment #618621 -
Flags: review?(bugs)
Assignee | ||
Comment 14•12 years ago
|
||
Looks like Qt's key event doesn't provide enough information for us about the key location. For Maemo, we should set MOBILE for now.
Attachment #618623 -
Flags: review?(bugs)
Assignee | ||
Comment 15•12 years ago
|
||
I don't know about Gonk. But I think setting MOBILE is enough for now.
Attachment #618624 -
Flags: review?(bugs)
Assignee | ||
Comment 16•12 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #8) > Comment on attachment 618609 [details] [diff] [review] > part.1 Add D3E KeyboardEvent.location > > I assume tests will be added in some other patch. > IMO, this patch shouldn't be pushed before we support also other than > DOM_KEY_LOCATION_STANDARD. Wow, I was surprised at your quick review! Thank you. Okay, I'll make nsIDOMWindowUtils::sendKeyEvent() tests tomorrow.
Comment 17•12 years ago
|
||
Comment on attachment 618619 [details] [diff] [review] part.4 Add support KeyboardEvent.location on Cocoa Looks fine to me.
Attachment #618619 -
Flags: review?(smichaud) → review+
Assignee | ||
Updated•12 years ago
|
Attachment #618618 -
Flags: review?(karlt)
Updated•12 years ago
|
Attachment #618618 -
Flags: review?(karlt) → review+
Assignee | ||
Comment 18•12 years ago
|
||
See comment 9 for the detail of this patch but I renamed NativeKeyInfo to NativeKey.
Attachment #618615 -
Attachment is obsolete: true
Attachment #618910 -
Flags: review?(jmathies)
Assignee | ||
Comment 19•12 years ago
|
||
The interface change doesn't break addon compatibility if they use true or false for aPreventDefault.
Attachment #618950 -
Flags: review?(bugs)
Assignee | ||
Comment 20•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=c570a89d7b0b
Updated•12 years ago
|
Attachment #618621 -
Flags: review?(bugs) → review+
Comment 21•12 years ago
|
||
Comment on attachment 618621 [details] [diff] [review] part.5 Add support KeyboardEvent.location on Android Actually, on Android the key events may be coming from a real keyboard. Think about Asus Transformer with a keyboard. Is there some way to know what kind of input device is used?
Attachment #618621 -
Flags: review+ → review?(wjohnston)
Updated•12 years ago
|
Attachment #618623 -
Flags: review?(bugs) → review+
Comment 22•12 years ago
|
||
Comment on attachment 618624 [details] [diff] [review] part.7 Add support KeyboardEvent.location on Gonk Should be ok.
Attachment #618624 -
Flags: review?(bugs) → review+
Updated•12 years ago
|
Attachment #618950 -
Flags: review?(bugs) → review+
Comment 23•12 years ago
|
||
Comment on attachment 618621 [details] [diff] [review] part.5 Add support KeyboardEvent.location on Android Chris is our resident IME expert right now. Throwing this to him.
Attachment #618621 -
Flags: review?(wjohnston) → review?(cpeterson)
Assignee | ||
Updated•12 years ago
|
Attachment #618609 -
Flags: superreview?(jst)
Assignee | ||
Updated•12 years ago
|
Attachment #618950 -
Flags: superreview?(jst)
Updated•12 years ago
|
Attachment #618609 -
Flags: superreview?(jst) → superreview+
Comment 24•12 years ago
|
||
Comment on attachment 618621 [details] [diff] [review] part.5 Add support KeyboardEvent.location on Android Review of attachment 618621 [details] [diff] [review]: ----------------------------------------------------------------- LGTM
Attachment #618621 -
Flags: review?(cpeterson) → review+
Updated•12 years ago
|
Attachment #618950 -
Flags: superreview?(jst) → superreview+
![]() |
||
Comment 25•12 years ago
|
||
Comment on attachment 618910 [details] [diff] [review] part.2 Add support KeyboardEvent.location on Windows Review of attachment 618910 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/windows/KeyboardLayout.cpp @@ +284,5 @@ > + if (!mIsExtended || > + WinUtils::GetWindowsVersion() < WinUtils::VISTA_VERSION) { > + return mScanCode; > + } > + return (0xE000 | mScanCode); Please add a comment explaining this constant. ::: widget/windows/nsWindow.cpp @@ +5738,5 @@ > + UINT scanCode = ::MapVirtualKeyEx(aNativeKeyCode, MAPVK_VK_TO_VSC, > + gKbdLayout.GetLayout()); > + LPARAM lParam = static_cast<LPARAM>(scanCode << 16); > + if (keySpecific == VK_RCONTROL || keySpecific == VK_RMENU) { > + lParam |= 0x1000000; ditto here.
Attachment #618910 -
Flags: review?(jmathies) → review+
Comment 26•12 years ago
|
||
Comment on attachment 618621 [details] [diff] [review] part.5 Add support KeyboardEvent.location on Android Review of attachment 618621 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/android/nsWindow.cpp @@ +1758,5 @@ > event.InitBasicModifiers(gMenu, > key.IsAltPressed(), > key.IsShiftPressed(), > false); > + event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_MOBILE; How will DOM_KEY_LOCATION_MOBILE events be handled differently than DOM_KEY_LOCATION_STANDARD events? If an Android device has an external hardware keyboard (like the ASUS Transformer), do we still want key events to be marked DOM_KEY_LOCATION_MOBILE?
Assignee | ||
Comment 27•12 years ago
|
||
Thank you for your reviews! (In reply to Chris Peterson (:cpeterson) from comment #26) > Comment on attachment 618621 [details] [diff] [review] > part.5 Add support KeyboardEvent.location on Android > > Review of attachment 618621 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: widget/android/nsWindow.cpp > @@ +1758,5 @@ > > event.InitBasicModifiers(gMenu, > > key.IsAltPressed(), > > key.IsShiftPressed(), > > false); > > + event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_MOBILE; > > How will DOM_KEY_LOCATION_MOBILE events be handled differently than > DOM_KEY_LOCATION_STANDARD events? > > If an Android device has an external hardware keyboard (like the ASUS > Transformer), do we still want key events to be marked > DOM_KEY_LOCATION_MOBILE? I'm not sure for that. http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-ID-KeyboardEvent-KeyLocationCode The definition of MOBILE is: > The key activation originated on a mobile device, either on a physical keypad or a virtual keyboard. I guess that the author assumes the "phsical keypad" is non-PC like keyboard of cellphones. So, I *think* that if we can detect which hardware causes the key event on Android, we should set STANDARD, LEFT, RIGHT or NUMPAD for PC keys on PC keyboard. But I don't know if it's possible on current Android's API. Chris, do you think it's possible? If it's possible, I'd like you to work on it because I don't have much knowledge for Android and environment for testing. And I think that if it's possible and needs a lot of work, we can do it in another bug. Fortunately, we have much time for Fx15 and the users who're using external keyboard with Android must not be so many. Do you agree with the values for external PC keyboard and working on another bug if we need a large patch for it, smaug?
Comment 28•12 years ago
|
||
(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) (away: 4/29 - 5/6) from comment #27) > I guess that the author assumes the "phsical keypad" is non-PC like keyboard > of cellphones. So, I *think* that if we can detect which hardware causes the > key event on Android, we should set STANDARD, LEFT, RIGHT or NUMPAD for PC > keys on PC keyboard. But I don't know if it's possible on current Android's > API. Chris, do you think it's possible? If it's possible, I'd like you to > work on it because I don't have much knowledge for Android and environment > for testing. I propose that we use your DOM_KEY_LOCATION_MOBILE patch as-is. If external PC-style keyboards become important, I can implement that change later. I'm not sure how to differentiate between a built-in hardware keyboard and an external PC-style keyboard, but I agree that should be a different bug.
Assignee | ||
Comment 29•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/03c2b4944d97 https://hg.mozilla.org/integration/mozilla-inbound/rev/1b790392d570 https://hg.mozilla.org/integration/mozilla-inbound/rev/3472062aae7f https://hg.mozilla.org/integration/mozilla-inbound/rev/27b17363e5ba https://hg.mozilla.org/integration/mozilla-inbound/rev/b5a2056342d7 https://hg.mozilla.org/integration/mozilla-inbound/rev/efa1a19df3e4 https://hg.mozilla.org/integration/mozilla-inbound/rev/691e7e02395e https://hg.mozilla.org/integration/mozilla-inbound/rev/de5745bce8bc (In reply to Chris Peterson (:cpeterson) from comment #28) > (In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) (away: 4/29 - 5/6) > from comment #27) > > I guess that the author assumes the "phsical keypad" is non-PC like keyboard > > of cellphones. So, I *think* that if we can detect which hardware causes the > > key event on Android, we should set STANDARD, LEFT, RIGHT or NUMPAD for PC > > keys on PC keyboard. But I don't know if it's possible on current Android's > > API. Chris, do you think it's possible? If it's possible, I'd like you to > > work on it because I don't have much knowledge for Android and environment > > for testing. > > I propose that we use your DOM_KEY_LOCATION_MOBILE patch as-is. If external > PC-style keyboards become important, I can implement that change later. ASUS has released a notebook with Android which can be used as tablet PC when the display separated from keyboard. On such device, I think that it's more important than the other cases. > I'm not sure how to differentiate between a built-in hardware keyboard and > an external PC-style keyboard, but I agree that should be a different bug. Okay.
Target Milestone: --- → mozilla15
Assignee | ||
Comment 30•12 years ago
|
||
like this. http://usa.asus.com/Eee/Eee_Pad/Eee_Pad_Transformer_TF101/
Comment 31•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/03c2b4944d97 https://hg.mozilla.org/mozilla-central/rev/1b790392d570 https://hg.mozilla.org/mozilla-central/rev/3472062aae7f https://hg.mozilla.org/mozilla-central/rev/27b17363e5ba https://hg.mozilla.org/mozilla-central/rev/b5a2056342d7 https://hg.mozilla.org/mozilla-central/rev/efa1a19df3e4 https://hg.mozilla.org/mozilla-central/rev/691e7e02395e https://hg.mozilla.org/mozilla-central/rev/de5745bce8bc
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 32•12 years ago
|
||
updated: https://developer.mozilla.org/en/Firefox_15_for_developers https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIDOMWindowUtils https://developer.mozilla.org/en/DOM/KeyboardEvent
Comment 33•11 years ago
|
||
As stated in the source code the left/right distinction for CTRL keys does not work on windows < vista because MapVirtualKeyEx is not able to distinguish them. However, the distinction for the ENTER key (normal or from numpad) works because it is done after mapping to the virtual key in the GetKeyLocation() method: case VK_RETURN: return !mIsExtended ? nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD : nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD; Is there a reason we could not do the same for the VK_CONTROL key (and presumably others) in order to get full support of the key location feature for Windows XP also ? The mIsExtended should enables us to tell whether it was the right or the left CONTROL key or am I misunderstanding something here ?
Assignee | ||
Comment 34•11 years ago
|
||
(In reply to drinounet from comment #33) > As stated in the source code the left/right distinction for CTRL keys does > not work on windows < vista because MapVirtualKeyEx is not able to > distinguish them. > However, the distinction for the ENTER key (normal or from numpad) works > because it is done after mapping to the virtual key in the GetKeyLocation() > method: > > case VK_RETURN: > return !mIsExtended ? nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD : > nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD; > > Is there a reason we could not do the same for the VK_CONTROL key (and > presumably others) in order to get full support of the key location feature > for Windows XP also ? > The mIsExtended should enables us to tell whether it was the right or the > left CONTROL key or am I misunderstanding something here ? Oh, really? Could you file a bug for that? And cc me. I'll check it next week. But it might be too late for Fx16...
Comment 35•11 years ago
|
||
Thanks, i just filed it here: https://bugzilla.mozilla.org/show_bug.cgi?id=773651
Comment 36•9 years ago
|
||
I've created the last bit of docs missing: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.location (Thanks :masayuki for the rest!)
Keywords: dev-doc-needed → dev-doc-complete
Comment 37•4 years ago
|
||
@phillip: So, what's the deal with this bug? Why was it ever closed without being fixed? I don't quite get it from following the comments. I should mention this would help BiDi users.
You need to log in
before you can comment on or make changes to this bug.
Description
•