Closed Bug 463802 Opened 16 years ago Closed 16 years ago

"keyup" event for Ctrl key not dispatched when focusing the Ctrl+Tab panel

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.1b3

People

(Reporter: dao, Assigned: smichaud)

References

Details

(Keywords: fixed1.9.1, platform-parity, Whiteboard: [See comment 19 fo verification steps])

Attachments

(2 files, 1 obsolete file)

The keypress event for Tab (with event.ctrlKey == true) opens the Ctrl+Tab panel. Releasing the Ctrl key should close it again. This doesn't happen if focus was moved to the panel. This can be tested with the patch in bug 463799.
Flags: blocking1.9.1?
I'm afraid I don't understand.

Could you give a more detailed description (and STR)?
STR:
With the patch in bug 463799, hit Ctrl+Tab, release Tab, release Ctrl.

Expected:
Different tab selected

Actual:
No different tab selected and the Ctrl+Tab panel stays open. (At least, that used to be the case, see e.g. the last paragraph of bug 436304 comment 77.)
blocking1.9.1+ for now, we need to sort this out
Flags: blocking1.9.1? → blocking1.9.1+
Blocks: 465076
No longer blocks: 463799
Blocks: 463799
No longer blocks: 465076
Flags: blocking1.9.1+ → blocking1.9.1?
Flags: blocking1.9.1? → blocking1.9.1+
Keywords: pp
Assignee: joshmoz → smichaud
Attached patch Fix (obsolete) — Splinter Review
Turns out this *is* a Cocoa widgets bug ... or at least that it's
triggered by one.  Here's a patch that fixes it.

The keyboard modifier state is global (not per-view or per-window).
So the variable that stores the previous modifier state should also be
global.

Prior to my patch, mLastModifierState was per-ChildView.  But the
ChildView that has the keyboard focus when the Control key is first
pressed is different from the ChildView that has the keyboard focus
when the Control key is released (after the Tab key has been pressed
and released).  So the value of mLastModifierState (for the currently
focused ChildView) is '0' when the Control key is released, when it
should be 0x00040000 (== NSControlKeyMask).  This means
fireKeyEventForFlagsChanged doesn't get called when the Control key is
released.

A tryserver build of this patch plus the patch for bug 463799 will
follow in a bit.
Attachment #352331 - Flags: review?(joshmoz)
Comment on attachment 352331 [details] [diff] [review]
Fix

Masayuki, it seems you're the last one who touched this code.  So I'm
also asking you to review my patch.
Attachment #352331 - Flags: review?(masayuki)
Attachment #352331 - Flags: review?(masayuki) → review+
Comment on attachment 352331 [details] [diff] [review]
Fix

Looks ok for now... However, should not we initialize sLastModifierStat at every application activating time?

E.g., if Ctrl or something is down on another application and switched the active application to us by mouse click, then, we cannot handle the Ctrl keyup event correctly. But it's really rare case, and it can be separated to another bug.
(In reply to comment #7)

> However, should not we initialize sLastModifierStat at every
> application activating time?

Good point.  But if flagsChanged: is called (by the OS) on a ChildView
when the browser isn't active, we might not have to explicitly set
sLastModifierState when the browser becomes active.

I'll look into this further (later this afternoon).
Here's another patch that incorporates Masayuki's suggestion ... which
wasn't difficult.

There's still one (very minor) problem:  If you hold down the Option
key while making Firefox active (by left-clicking on a browser
window), gLastModifierState gets set to '0' in [AppShellDelegate
applicationDidBecomeActive:] (instead of to 0x00080000 as it should).
This is presumably some kind of OS bug.  But I don't think it matters
(I can't think of a scenario where it does matter).
Attachment #352331 - Attachment is obsolete: true
Attachment #352331 - Flags: review?(joshmoz)
Attachment #352437 - Flags: review?(masayuki)
Attachment #352437 - Flags: review?(joshmoz)
(Following up comment #8)

> But if flagsChanged: is called (by the OS) on a ChildView when the
> browser isn't active,

Forgot to mention that I did some tests and never saw [ChildView
flagsChanged:] called while the browser was inactive.
A tryserver build of my rev1 patch plus the patch for bug 463799 will
follow in several hours.  The Mac tryserver is a bit slooooow today.
Comment on attachment 352437 [details] [diff] [review]
Fix rev1 (follow Masayuki's suggestion)

Great!
Attachment #352437 - Flags: review?(masayuki) → review+
Attachment #352437 - Flags: review?(joshmoz) → review+
Attachment #352437 - Flags: superreview?(roc)
Attachment #352437 - Flags: superreview?(roc) → superreview+
Landed on mozilla-central

http://hg.mozilla.org/mozilla-central/rev/4497c86397f4
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Hi Steven: Since this is plussed for 3.1, when will it get checked into that branch? I am just back from PTO and trying to figure out the workflow for these types of bugs.
I'm hoping to do that right now, Marcia :-)
I don't see a way how to verify the fix. The STR from comment 0 are also working with a 081215 trunk nightly. Do we have another STR which are more visible?
Target Milestone: --- → mozilla1.9.2a1
Target Milestone: mozilla1.9.2a1 → mozilla1.9.1b3
(In reply to comment #18)

Unfortunately, this bug's STR (from comment #2) only "works" in a
build that also has the patch for bug 463799.

So to see this bug (unfixed) you'll need to create a build with the
patch for bug 463799 but without this bug's patch.
Anyone up to the verifying task? :p
Keywords: verifyme
Whiteboard: [See comment 19 fo verification steps]
mass remove verifyme requests greater than 4 months old
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: