Closed
Bug 104371
Opened 23 years ago
Closed 22 years ago
shiftKey not captured in KEYPRESS event
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Core
DOM: UI Events & Focus Handling
Tracking
()
RESOLVED
FIXED
mozilla1.2final
People
(Reporter: Christopher.Strolia-Davis, Assigned: bryner)
References
Details
(Keywords: testcase)
Attachments
(2 files, 6 obsolete files)
590 bytes,
text/html
|
Details | |
14.37 KB,
patch
|
bzbarsky
:
review+
hyatt
:
superreview+
|
Details | Diff | Splinter Review |
The shift key is not being captured by the event object when the KEYPRESS event
is fired. Alt and Ctrl keys seem to be working fine.
Reporter | ||
Comment 1•23 years ago
|
||
Reporter | ||
Comment 2•23 years ago
|
||
Just looked at explanations of Severities and changed severity to be more
accurate.
Severity: minor → normal
Comment 3•23 years ago
|
||
confirming on linux build 2002-01-18-08.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
Updated•23 years ago
|
Target Milestone: --- → mozilla1.0.1
Updated•23 years ago
|
QA Contact: madhur → rakeshmishra
Comment 4•23 years ago
|
||
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1a+) Gecko/20020704
Still not working. This breaks the Shift+Space scrollPageUp keybinding, which is
very annoying.
Comment 6•22 years ago
|
||
Just before firing the key press, the SHIFT key down boolean is being cleared.
This is incorrect.
Comment 7•22 years ago
|
||
I assume a similar bug exists in the Linux widget code.
Assignee: radha → hyatt
Comment 8•22 years ago
|
||
Attachment #103559 -
Attachment is obsolete: true
Comment 9•22 years ago
|
||
This fix seems to break SHIFT+space just being a space in editor. That seems
odd to me. Will investigate further.
Status: NEW → ASSIGNED
Updated•22 years ago
|
Target Milestone: mozilla1.0.1 → mozilla1.2final
Comment 10•22 years ago
|
||
This should do it. I need to figure out next if Mac has this same shift key
problem. I assume all widget code implementations do, since editor wouldn't
have worked otherwise.
Attachment #103560 -
Attachment is obsolete: true
Comment 11•22 years ago
|
||
Attachment #103601 -
Attachment is obsolete: true
Comment 12•22 years ago
|
||
I think you need to patch in widget/src/gtk/ too.
Comment 13•22 years ago
|
||
Attachment #103604 -
Attachment is obsolete: true
Comment 14•22 years ago
|
||
Comment on attachment 103628 [details] [diff] [review]
Patch that handles gtk, gtk2, cocoa, carbon, and win32
r=blizzard on the gtk and gtk2 changes
Comment 15•22 years ago
|
||
cc'ing brade to get editor review for the editor change.
Comment 16•22 years ago
|
||
Comment on attachment 103628 [details] [diff] [review]
Patch that handles gtk, gtk2, cocoa, carbon, and win32
r=brade
I think that this will be fine although Akkana and I have some concerns about
IME. Please verify that IME is not broken.
Historically, what I recall about this code is that we needed a way to know
whether a key combination was intended to be typed into an editor or was some
type of shortcut key or whatever. All widget code made a guess for that and
set all the modifier flags to false. If there were no modifiers and there was
a keypress with a charCode, the editor should try to insert that.
Probably if someone (foolishly) set "shift" as their modifier key, they'd run
into some problems but I think those would pop up long before getting into this
code ;-)
Attachment #103628 -
Flags: review+
Comment 17•22 years ago
|
||
oops! I also forgot to mention that you can remove these lines from the 2 editor
files:
521 if (NS_SUCCEEDED(aKeyEvent->GetKeyCode(&keyCode)) &&
522 - NS_SUCCEEDED(aKeyEvent->GetShiftKey(&isShift)) &&
523 NS_SUCCEEDED(aKeyEvent->GetCtrlKey(&ctrlKey)) &&
no point getting "isShift" if it isn't used anymore, it's just slowing us down ;-)
Comment 18•22 years ago
|
||
sr=me
Comment 19•22 years ago
|
||
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 20•22 years ago
|
||
Any idea what to look for in the code to see if OS/2 has this problem?
Comment 21•22 years ago
|
||
mkaply: A guess...
http://lxr.mozilla.org/mozilla/source/widget/src/os2/nsWindow.cpp#2138
else if (usVKey == VK_SPACE)
{
event.isShift = PR_FALSE;
}
Comment 22•22 years ago
|
||
might want to ping drivers too.... ;)
Comment 23•22 years ago
|
||
Somehow the
NS_SUCCEEDED(aKeyEvent->GetShiftKey(&isShift))
line got erased from editor/libeditor/html/nsHTMLEditor.cpp in this commit
(although it is not removed in the attached patch).
Now brad TBox correctly states:
+editor/libeditor/html/nsHTMLEditor.cpp:1235
+ `PRBool isShift' might be used uninitialized in this function
since isShift is still used in several places, but is never set to anything!
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 24•22 years ago
|
||
Uhh. You checked this in without drivers approval? Plus, it looks like there's
a warning there that needs to be fixed and os/2 might need updating?
Comment 25•22 years ago
|
||
I backed this out.
Comment 26•22 years ago
|
||
*** This bug should have been marked as a duplicate of bug 122017 ***
Comment 27•22 years ago
|
||
Reassigning to default component owner of events.
Assignee: hyatt → joki
Status: REOPENED → NEW
Comment 28•22 years ago
|
||
If someone wants to pick this up and run with it, I'd appreciate it. I'm gonna
be too busy in the next few days to deal with this.
Comment 30•22 years ago
|
||
The patch, as checked in, broke one hot key that I noticed - '*' in mail/news
which expands all threads. At least, I'm pretty sure this was what broke it.
Assignee | ||
Comment 31•22 years ago
|
||
Chagnes from the last patch:
- only remove isShift from nsPlaintextEditor; it's needed by nsHTMLEditor for
other purposes
- To fix key bindings such as "*", I made XBL not check for a matching shift
key state if the key was matched using the charcode, and shift was not
specified in the modifier mask.
- patched the rest of the widget toolkits
Attachment #103628 -
Attachment is obsolete: true
Comment 32•22 years ago
|
||
In the XBL code, rather than passing in cAlt | cShift | cMeta, etc. I'd rather
you had a #define or a constant for the full mask, e.g., cKeyMask and just
passed that in.
I think the code that ignores shift would be better served by setting a local
var to cKeyMask and then nulling SHIFT out rather than being set to a|b|c and
then adding in SHIFT conditionally.
With my suggested changes we could add new modifier keys in the future and not
have to change this code.
Updated•22 years ago
|
Attachment #103955 -
Flags: needs-work+
Assignee | ||
Comment 33•22 years ago
|
||
Attachment #103955 -
Attachment is obsolete: true
Comment 34•22 years ago
|
||
Comment on attachment 104070 [details] [diff] [review]
address hyatt's comments
sr=hyatt
Attachment #104070 -
Flags: superreview+
Comment 35•22 years ago
|
||
Comment on attachment 104070 [details] [diff] [review]
address hyatt's comments
r=brade for the editor and Macintosh changes
Comment 36•22 years ago
|
||
Comment on attachment 104070 [details] [diff] [review]
address hyatt's comments
r=bzbarsky on the xbl changes and widget changes
Attachment #104070 -
Flags: review+
Comment 37•22 years ago
|
||
Comment on attachment 104070 [details] [diff] [review]
address hyatt's comments
Wouldn't it be easier to reverse the mask?
>PRInt32 modKeys = cAllModifiers;
PRInt32 modIgnore = 0;
>modKeys &= ~cShift;
modIgnore = cShift;
>PRBool result = ModifiersMatchMask(aKeyEvent, modKeys);
PRBool result = ModifiersMatchMask(aKeyEvent, modIgnore);
>PRBool result = ModifiersMatchMask(aMouseEvent, cAllModifiers);
PRBool result = ModifiersMatchMask(aMouseEvent, 0);
>PRInt32 aModifiersMask)
PRInt32 aIgnoreMask)
>if (aModifiersMask & cMeta) {
if (!(aIgnoreMask & cMeta)) {
>if (aModifiersMask & cShift) {
if (!(aIgnoreMask & cShift)) {
>if (aModifiersMask & cAlt) {
if (!(aIgnoreMask & cAlt)) {
>if (aModifiersMask & cControl) {
if (!(aIgnoreMask & cControl)) {
Comment 38•22 years ago
|
||
Comment on attachment 104070 [details] [diff] [review]
address hyatt's comments
> nsXBLPrototypeHandler::ModifiersMatchMask(nsIDOMUIEvent* aEvent, PRInt32 aModifiersMask)
> {
> nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aEvent));
> nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aEvent));
To me this just cries out for an extra interface nsIDOMUIEventModifiers (or
whatever) that both nsIDOMKeyEvent and nsIDOMMouseEvent implement:
nsXBLPrototypeHandler::ModifiersMatchMask(nsIDOMUIEventModifiers*
aEventModifiers, PRInt32 aModifiersMask)
Comment 39•22 years ago
|
||
drivers are concerned about the possibilities of regressions here. Please hold
off on landing this till we open for 1.3a (real soon now). Thanks
Assignee | ||
Comment 40•22 years ago
|
||
checked in on the trunk.
Status: NEW → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → FIXED
Comment 41•22 years ago
|
||
*** Bug 79047 has been marked as a duplicate of this bug. ***
Updated•22 years ago
|
QA Contact: rakeshmishra → trix
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
•