Search Unity

Windows Sticky Keys prompt

Discussion in 'General Discussion' started by ArachnidAnimal, May 15, 2019.

  1. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,825
    The Windows sticky keys have caused more issues and problems for people that anything good it has ever done for anyone.
    When running a Unity game fullscreen, and if the "Do you want to enable sticky keys?" prompt appears, the game will become unresponsive and hang.
    This means I can't reliably use modifier keys for QTEs if this issue is going to happen.
    The player would have to know how to permanently disable the prompt from appearing when pressing shift key too quickly.
    Anyone else run into this issue?
     
  2. - allow people to rebind the keys used in your game
    - windows 7 audience is shrinking, will disappear soon
    - windows 7 users, who have trouble with the sticky keys, probably already disabled them long before your game
    - you may include instructions in case people need to disable the accessibility feature, do not do it for yourself

    (IMHO)
     
    wccrawford, Joe-Censored and Socrates like this.
  3. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Mashing Shift key for a QTE is probably not a good idea.
     
    AnomalusUndrdog likes this.
  4. Having a QTE is not a good idea.
     
    Socrates, bluescrn and xVergilx like this.
  5. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    QTE or otherwise, if you use shift for anything significant in your game there will be players who press it enough to get the Sticky Keys prompt. If that crashes the game then that's a problem.

    Are we talking about an actual crash here, or just losing focus?
     
  6. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,825
    It was reported by the testing person ( who was the one that assigned the shift key to the QTE action in the game settings) that the error was the classing app hang error:
    "Game.exe is not responding..."
    As soon as windows displays the "Do you want to turn on sticky keys?" message.
    The message automatically causes the game to loose focus when the message is displayed.
     
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Sticky keys are in win10 too
     
    xVergilx likes this.
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Just tell the use to turn off the sticky keys prompt.

    I can't imagine the overlap between users who actually use sticky keys and those who play video games is very large.
     
  9. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I use GYHJ instead of AWSD which is at the center of the keyboard so i dont bothe with disable that since its on default
     
  10. Wow, I use w10 since first came out but never saw it. :D Although it's possible it picked up the setting from Windows 7 and I turned off in Windows 7 ages ago.
     
    AndersMalmgren likes this.
  11. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,825
  12. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    How do you trigger it to come up in Windows 10? I've mashed my shift key a whole bunch and it's not coming up. I don't remember turning it off, though maybe I did that ages ago and my Windows profile has just remembered it forever?

    (Edit: Removed my references to the off-topic stuff.)
     
    Last edited: May 19, 2019
  13. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Somehow I accidentally used broom on the rampant and personal OT argument that took place. So sticky keys, right or wrong, they're a problem.

    As a gamer I did need to disable the feature but we can't depend on anyone but FPS elites doing so. It's generally a fantastic idea to not use shift for default keyboard layouts. Allow the binding of it but don't supply as default.

    Also it may be worth going a little further and having a small popup box saying "This key may conflict with Windows Sticky Keys" after it is bound, so players know to expect it.

    As for the crashing, report a bug because it should never crash. Ever, from sticky keys. And you can quote me, so it's a bug. Worst thing that should occur is the app is minimised and the dialog for sticky keys asking to be turned on would be on the desktop in front of the user.

    As you already warned the user at this point they can quickly assert control over the situation and return to the game.
     
  14. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,182
    Better yet only warn them if it happens to be enabled. Below is some code from Stack Overflow that was simplified (and fixed because it was broken) as well as a link to the original code if anyone wants to do more than just check sticky keys.

    If I can find the time I might go back and expand it to support all of them.

    https://stackoverflow.com/questions/734618/disabling-accessibility-shortcuts-in-net-application

    Code (csharp):
    1. using System.Runtime.InteropServices;
    2. using UnityEngine;
    3.  
    4. public class StickyKeys : MonoBehaviour
    5. {
    6.     public void Start()
    7.     {
    8.         Debug.Log(WindowsHelperAccessibilityKeys.GetStickyKeys());
    9.     }
    10.  
    11.     public class WindowsHelperAccessibilityKeys
    12.     {
    13.         [DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = false)]
    14.         private static extern bool SystemParametersInfo(uint action, uint param, ref SKEY vparam, uint init);
    15.  
    16.         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
    17.         public struct SKEY
    18.         {
    19.             public uint cbSize;
    20.             public uint dwFlags;
    21.         }
    22.  
    23.         private static uint SKEYSize = sizeof(uint) * 2;
    24.  
    25.         public static bool GetStickyKeys()
    26.         {
    27.             SKEY StickyKeyParams = new SKEY { cbSize = SKEYSize, dwFlags = 0 };
    28.             SystemParametersInfo(0x003A, SKEYSize, ref StickyKeyParams, 0);
    29.  
    30.             return IsBitSet(StickyKeyParams.dwFlags, 0);
    31.         }
    32.  
    33.         private static bool IsBitSet(uint value, int position)
    34.         {
    35.             return (value & (1 << position)) != 0;
    36.         }
    37.     }
    38. }
     
    Last edited: May 17, 2019
  15. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    you take that back.
     
    xVergilx likes this.
  16. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    It's on its last legs. Dropped around 7% market share in the last year alone, and that's going to drop pretty precipitously as new computers come out (laptops are huge right now, so drivers are a serious concern). I'd say that there's probably 3-5 years left of Windows 7 being in any way relevant.

    Which sucks, because my Windows 8/8.1/10 experience has been a F***ing nightmare and no Linux version is even at Win7 levels yet.
     
    grobonom, xVergilx and Ony like this.
  17. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I like windows 10 a lot! I've got it super minimalist and its behaving itself so touch wood, bit of chanting and that.
    Grabs coat.
     
    xVergilx, Ryiah and Ony like this.
  18. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    I am hoping to migrate to Linux on my dev system as soon as it's viable. We use Windows 7 on our main dev machines, and have a few additional test systems (Windows 10, Mac, etc.), but I like to work in Win7.

    I really don't want to go to Windows 10, so yeah, it would be super nice if Linux could at least handle what I need it to handle. My son has used Linux for years, and is always on me to switch over, but he's not as much of a hardline developer so he doesn't really understand my not being able to switch.
     
    Ryiah likes this.
  19. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,182
    Same. I've been planning a migration to Linux for the past few years, and with all the improvements we've had to hardware (AMD's Zen 2 is bringing an affordable 16C/32T CPU) and software (all of the new compatibility layers and Steam Proton) it will be happening very soon. I'll continue to run Windows but only within a virtual machine.

    Windows 10 is excellent once you've configured it to only install updates when you want it to.
     
    Ony and hippocoder like this.
  20. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Fun fact: that's actually getting to be impossible if you don't own Pro. Services trick doesn't work anymore, blocking it with external tools don't work anymore, and blocking it at the router level is a crapshoot because there's a billion update servers it pulls from and it doesn't use an uncommon protocol or anything.
     
    Ony and Ryiah like this.
  21. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I got lucky and managed that right away somehow in a vague mist of paranoid clicking.
     
    Ony likes this.