Bug 1247 : ALT key event is called constantly when switching windows with ALT+TAB
Last modified: 2010-02-18 05:43




Status:
RESOLVED
Resolution:
INVALID -
Priority:
P2
Severity:
normal

 

Reporter:
Mista
Assigned To:
fry

Attachment Type Created Size Actions
This is a minimal example of the bug. application/octet-stream 2009-05-20 03:50 123 bytes

Description:   Opened: 2009-05-19 08:01
Processing 1.0.3, all operating systems.

When switching from a running application to another window by pressing
ALT+TAB, the ALT key event is constantly called in the application window
although it is in the background.
This continues until you switch back to the application window and hit the
ALT key once.
I have observed this behavior under Windows, Linux and Mac, although the
latter is not really affected since under Mac usually the cmd key is used
to switch windows.
I don't know whether this is a Processing bug or an issue of the operating
systems.
However, a minimal example would be:
[quote]
int count = 0;

void draw(){
if(keyPressed && keyCode==ALT){
println("Alt was pressed: "+count);
count++;
}}

[/quote]

Start this, switch to another window and count should be increased
continuously.

Best,
Sascha.
Additional Comment #1 From Mista 2009-05-20 03:50
edit]
This is a minimal example of the bug.

Start this application from within the PDE and switch to another window by
pressing ALT+Tab. The number should keep on increasing.
Additional Comment #2 From fry 2009-05-20 07:35
k, i suspect this is an os/java issue that we can't do anything about, but
i'll take a look when i get a chance.
Additional Comment #3 From fry 2010-02-17 19:58
looked into this, it's simply the correct behavior. you're just seeing the
key repeat kicking in. if you hold down any key for a certain amount of
time, you'll get multiple keyPressed() events. with alt-tab on windows,
you're holding down ALT, which kicks in the repeat.
Additional Comment #4 From Mista 2010-02-18 01:58
I am not sure if that is the intended behavior, because, at least in my
case, the ALT key event was repeatedly called even if I immediately
released the ALT key after switching windows.
And it continued calling the ALT key although I did not press any button
afterwards.


> looked into this, it's simply the correct behavior. you're just
seeing the
> key repeat kicking in. if you hold down any key for a certain amount of
> time, you'll get multiple keyPressed() events. with alt-tab on windows,
> you're holding down ALT, which kicks in the repeat.
>
>
Additional Comment #5 From fry 2010-02-18 05:43
The bottom line is that the event is what we're getting from Java, or the
OS. If you feel it's a bug, you can file a report at http://bugs.sun.com/