Keyboard Input Manipulation Delay

Official forum for open source FreePIE discussion and development.
Post Reply
DrDim
One Eyed Hopeful
Posts: 24
Joined: Mon Jan 05, 2015 4:33 am

Keyboard Input Manipulation Delay

Post by DrDim »

Hi!

I've noticed the following quirk using FreePIE:

Using following code:

Code: Select all

import time
if starting:
	mtrigger = False
	ktrigger = False
	timer = 0
	strigger = 0
	SpaceUpTimer = 0

#mapper
if mouse.getButton(1) != mtrigger:
	mtrigger = not mtrigger
	keyboard.setKey(Key.Space, mtrigger)

#timer to measure duration when space is lifted
if keyboard.getKeyDown(Key.Space) != ktrigger:
	ktrigger = not ktrigger
	if not ktrigger:
		strigger = 1
		timer = time.time()
	if ktrigger and strigger:
		SpaceUpTimer = time.time() - timer
	
diagnostics.watch(keyboard.getKeyDown(Key.Space))
diagnostics.watch(SpaceUpTimer)
Using this, if you press the right mouse button you will toggle the space keyboard key.

Now if you hold the space keyboard key when running the script and press RMB during that, the space key will lift for 0.01 to 0.05 seconds. Just a small blib.

But if you hold the RMB, then hold space and then release RMB while still holding space, the key is lifted for 0.1 to 0.5 seconds before it realizes that it'S actually pressed. Very noticable duration.

Why is that and is there a way to prioritize the actual keyboard inputs instead of the virtual ones?
Post Reply

Return to “FreePIE”