News for hackers. Stuff that matters.
Re:Comments by a developer inside the Windows Media Player s... by jackewiehose on Saturday September 26, 2020 @07:56PM (#24603107)
> Why?

Because of the reported bug in this example (which I also encountered quite often):

- user hits ESCAPE

- my window gets key-down/ESCAPE and closes itself

- your window (which happens to be the next in the focus-order) gets key-up/ESCAPE and closes itself

> I also like being able to hold the key down to cue up a command and then at the right time, pull my hand away to execute crisply

Ok, but if your window wants to support this behavior (which is not very common) you have to watch for key-up AND key-down like the bug-report suggests.

Re:Comments by a developer inside the Windows Media Player s... by cortesoft on Saturday September 26, 2020 @08:05PM (#24603147)
What if the OS only sent key-up events to a window if it also received the corresponding key-down event?
Re:Comments by a developer inside the Windows Media Player s... by dmurray on Saturday September 26, 2020 @08:37PM (#24603290)
Then you'd lose useful functionality like dragging a file from your file manager to an application window to open it there.
Re:Comments by a developer inside the Windows Media Player s... by efreak on Saturday September 26, 2020 @10:12PM (#24603654)
That's your mouse button, not a keyboard key. Although modifier keys occasionally are used, what's important here is the state of those keys (ctrl for copy, shift/alt or whatever for shortcut); nothing happens when you release them.
Re:Comments by a developer inside the Windows Media Player s... by dmurray on Sunday September 27, 2020 @06:02AM (#24605534)
You can do it with arrow keys, too. I remember doing this all the time back on Windows 3.1 and I'm sure it's still used now especially by people with disabilities.

Anyway, there's a way to fix this: send a reference to the key-down event when you send the key-up event. Then the receiving window can determine if it cares about it or not. If this is a security hole, send a reference to the window where the key-up event was sent instead.

Re:Comments by a developer inside the Windows Media Player s... by jackewiehose on Saturday September 26, 2020 @08:14PM (#24603188)
Then we wouldn't have this conversation.