Shift press more then 5 times

Hey, I just added a shift command to alow users to run faster, but when I did I totally forgot on windows you end up bring the hot key command if you press it a few times. Is there a way to disable that in game? I don’t care if uses use it, but I woudn’t want it poping up if their in a game and that takes them out of full screen.

I don’t know of any way to disable that in-game. If someone knows better than me, I’d love to hear about it.

David

Hi. Windows ‘sticky keys’. Extremely handy tool…
I would not bother with it. Every game I have ever played has no function to shut it off, so I suggest leaving it to the user to disable the function. No problem with this nice sticky keys feature; they would be able to shut it off by pressing shift and f1 for 5 seconds. :laughing:

I know a lot of games made by steam uses the shift key to run faster. So there has to be a way to shut it off / disable it. I’ll do a little research to see if I can find anything. I wont be able to add it, so if drwr won’t mind adding it to the new build or a future build would be nice.

I know of a hack to get it to work, but there comes a problem if panda was to crash before resetting… just need to edit the reg:

HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys
"Flags"="506"

Note, numbers may change for different OS versions. 510 to turn it back on.

And of course you can have a “if” to know if you need to change it or not, so you’r not going in there for nothing.

I hope I did not annoy you.
annoyances.org/exec/forum/winxp/t1011734484

According to one of the forum users, holding the shift key for more then 8 seconds disables sticky keys. You might try simulate a 8 second lasting shift press and see if it works…

You’re not annoying me… lol.

Sorry, I think you have me wrong by what I mean by disabling it. I mean keep it from going off. I don’t mind if users have it on, but I want to disable it from poping up if the user press the shift key to many times. Holding the key or the 8 second just turns it back off, not disable the sticky command. or from what I understand

The hack above should work if panda 3d does ok with its clean up. For example, my program has a big try and except around it, so if the program crash hard, it’ll still report the error back to the server for me to look at. Also, I even broke that down more, so if something didn’t load just right, like a model is missing, the game simples reports the error back to server and skips that part of the code by giving back default information to help keep it going.

It’s been a while since I worked on Windows, but if I remember correctly you need to tap shift fast enough to make this “sticky keys” thing come up. So disabling it is not needed to make shift the run-key (which it is in almost every FPP/TPP game), as long as the player doesn’t press it enough times in a raw in a short enough time. But I might be wrong - I just always disable the thing the first time it pops up.

Interesting !I played with sticky keys to see when it 's activated.
when I press shift 5 times in a row WITHOUT touching any other key, it’s activated.
BUT when i press another key in the middle of pressing shift, it doesn’t.
A simple way to prevend sticky keys to popup, would be to simulate ‘some key press’ after a shift key press event.

Moving the mouse between your shift presses works too.

I am not really positive about this, but i believe that sticky keys will activate when you shift+arrow key several times.
I think that i used that in VLC to framestep movie or something like that and got that annoying pop up…

After playing around with it. I still can’t seem to get it right. I tried passing a key via SendKeys.SendKeys("^",turn_off_numlock=True), but to no luck there.

It seems to work with the keyboard, so it has do with the way the keys are passed. So if I am right, you should be able to capture the keys before the os can act with them, no? (It’ll have to be done with C++; not sure if python can even react to win commands.)

Also I notice when playing around with the verital keyboard on windows, it passes both shifts at onces. So when you click on shift there 5 times, nothing seems to happen… maybe that could be a work around? Again tho, not sure how you go about passing both at once.

The idea is not to intercept keys before the OS can, but ‘adding’ a keystroke in between the shifts.

That should work in my opinion.
Usually, a keystoke is sended to a window. Let’s hope sticky keys is not listening on some ‘hardware level’… Don’t even know if that exists.

How did you implement the sendkeys ?
It should send a keystroke, when a shift-key event occurs.

It’s been implemented for Pirates months ago.
You can disable stickey keys in Windows by adding this to your Config.prc

disable-sticky-keys 1

Doesn’t work for panda yet. Maybe in next version?

Enge, I have it so when the user press the key the key is sent at the same time.

if user press shift:
  if k == True:
    SendKeys.SendKeys("^",turn_off_numlock=True)
    other things
    k = False

if user releases shift:
  if k == False:
    SendKeys.SendKeys("^",turn_off_numlock=True)
    other things
    k = True

Right, seems like it will be included in version 1.7.0.
You can grab it from the CVS though.

I can wait. Not that big of a deal, but I thought I ask if there was a way around it cause people on windows will have this problem come up. Good to see they had the same thought I did, lol.

I wounder how they went about fixing the issue tho.

Not going to look at the CVS to find out tho… had my share of problems with that in the past XD.

Thanks for the heads up tho. :smiley:

I used DirectX’s function to turn off sticky keys.
Check this out:
msdn.microsoft.com/en-us/library/ee416808(VS.85.aspx

Ahaha, neat, I thought using some sorta hook would work :slight_smile: Nice to see I was right ^^. Only down side is I’m using the open GL…; is it going to be cross compatiable?

Also… I remember back in my C++ days…windows had a way to do the hooking from its own labs… would that not be a better of doing it?

Update…
Yea I was right… here some post I found…
msdn.microsoft.com/en-us/library/ms644990(VS.85.aspx
msdn.microsoft.com/en-us/library/ms644985(VS.85.aspx
msdn.microsoft.com/en-us/library/ms644967(VS.85.aspx

And I think with this way, we can break it down even to what short keys can or can not work for more control.

Works only for NT +, but with a little code we can test for the NT mark…

          if os.name in ("nt", "dos", "ce"):
            time.sleep(.01)

Sorry don’t remember/know the C++ of that would be…