Losing focus and mouse clicks

Hello, I’ve this program (which prints the number of clicks inside the window):

import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText
t, n = OnscreenText(), 0
def printClick(): global n; t.setText( str( n ) ); n += 1
base.accept( 'mouse1', printClick )

I’m on Maverik Meerkat, Panda 1.7.2. If I launch it and lose the focus of the window with mouse clicks (as instance, if I click on the window of another application, or change the current desktop using the mouse) then, when I click again in the window, it works.

But, if I do the same operations using shortcuts (ALT-TAB to change the application, CTRL-ALT-arrows to change the desktop) then the following clicks in the window are not catched.

Does it happen only on my machine? Am I doing anything wrong? Thank you!

This is because panda never receives the Alt(Ctrl)-up signal(signal that says - Alt(Ctrl) button is not pressed anymore).

The easiest solution is to press the Alt(Ctrl) key again. :unamused:

Thank you!