Closed Bug 238264 Opened 21 years ago Closed 21 years ago

Mozilla doesn't use GetKeyState according to spec

Categories

(Core Graveyard :: GFX: Win32, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file)

The MSDN docs state that on Windows the sign bit 15 of the 16-bit short return value from GetKeyState determines the pressed state of the key. However Mozilla uses bit 7 for some reason.
Attached patch Proposed patchSplinter Review
Assignee: win32 → neil.parkwaycc.co.uk
Status: NEW → ASSIGNED
Attachment #144506 - Flags: review?(ere)
http://lxr.mozilla.org/seamonkey/source/embedding/tests/mfcembed/BrowserView.cpp#458 doesn't look right either but I'll let Adam figure out what he wants there...
Comment on attachment 144506 [details] [diff] [review] Proposed patch I've seen a few examples where 0x80 is used (such as http://mech.math.msu.su/~vfnik/WinApi/g/getkeystate.html). I'm not sure why, but it's definitely wrong according to any recent documentation. Anyway, better to do it right. r=ere
Attachment #144506 - Flags: review?(ere) → review+
Attachment #144506 - Flags: superreview?(rbs)
Comment on attachment 144506 [details] [diff] [review] Proposed patch sr=rbs Apparently the confusion is because people think that 'short' is 8 bit, whereas it is 16 bit instead, and they meant to test 0x8000. I checked another MSDN document which stated clearly that: "The GetKeyState() function returns a number indicating the current state of a specific key at the time the DLL call is made. A negative number indicates that the key is pressed, a positive number indicates that the key is not pressed."
Attachment #144506 - Flags: superreview?(rbs) → superreview+
Comment on attachment 144506 [details] [diff] [review] Proposed patch Seeking approval for this low-risk Windows-specific correctness patch.
Attachment #144506 - Flags: approval1.7?
Hmm... it looks like that quote comes from KB article 108357.
Comment on attachment 144506 [details] [diff] [review] Proposed patch a=asa (on behalf of drivers) for checkin to 1.7
Attachment #144506 - Flags: approval1.7? → approval1.7+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Cool. Every time I looked at that code I thought that it couldn't be right.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: