Pragmatically Disable Hotcorners w/ C++?

Discussion in 'Mac Programming' started by blueshogun96, Oct 5, 2016.

  1. blueshogun96 macrumors regular

    blueshogun96

    Joined:
    Nov 24, 2012
    #1
    I've written a cross platform game that uses [free]glut for a faux fullscreen mode. Since the controls are completely mouse controlled, it's easy to hit one of the hot corners and cause the window to be taken out of focus or off the screen altogether. This was embarrassing when I took my game to a coding competition and users would sometimes hit a hotcorner unknowingly causing them to get confused.

    Can they be pragmatically and temporarily disabled through code? Preferrably C++ or Obj-C. I've done some searching, and haven't found anything so far. Any ideas?

    Thanks,

    shogun.
     
  2. Senor Cuete macrumors regular

    Joined:
    Nov 9, 2011
    #2
    You could change the options for the window in its .xib file.
     
  3. blueshogun96 thread starter macrumors regular

    blueshogun96

    Joined:
    Nov 24, 2012
    #3
    What if my game doesn't use a .xib file? GLUT takes care of all the windowing stuff for me so I don't believe I have access to that.

    Shogun
     
  4. Senor Cuete macrumors regular

    Joined:
    Nov 9, 2011
    #4
    Are GLUT windows templates stored in resource files? Does GLUT give you access to the window objects and their attributes?
     
  5. blueshogun96 thread starter macrumors regular

    blueshogun96

    Joined:
    Nov 24, 2012
    #5
    With GLUT (at least in freeglut), the window is generated purely through code. Afaik, I cannot see any way to access the window objects.

    Shogun
     
  6. Senor Cuete macrumors regular

    Joined:
    Nov 9, 2011
    #6
    Googling GLUT, and GLUT window management, it looks like in order to make it cross-platform, they gave you very limited GUI functionality.
     
  7. robvas macrumors 68020

    Joined:
    Mar 29, 2009
    Location:
    USA
    #7
    http://apple.stackexchange.com/ques...corners-when-playing-games-or-other-such-full

    This is a quite old question, but I stumbled on it looking for the same thing (although on ML). The script looks interesting, but it's a bit far-fetched for me, I was looking for something simpler and preferably without add-ons.

    This is what I found and works for me: in the hot corner's pref pane, hold Command, Option, Control and/or Shift after clicking a drop down list of a hot corner and you can add one or any combination of the modifier keys to a hot corner trigger. This way, they only work if and when you hold that(those) key(s) which you probably won't during a game, or any full screen app.

    I'm pretty sure this works on all OS X versions.

     
  8. blueshogun96 thread starter macrumors regular

    blueshogun96

    Joined:
    Nov 24, 2012
    #8
    Unfortunately yes. At least with Windows there's a function called GetActiveWindow(). Is there an equivalent for Mac?

    Shogun.
     
  9. blueshogun96 thread starter macrumors regular

    blueshogun96

    Joined:
    Nov 24, 2012
    #9
    Helpful, but unfortunately, not a direct pragmatic solution. Unless there's a way I can execute that script from C++ code? If that's possible then I could likely create a customized solution that way.

    Shogun.
     
  10. cqexbesd, Oct 8, 2016
    Last edited: Oct 10, 2016

    cqexbesd macrumors regular

    Joined:
    Jun 4, 2009
    #10
  11. jaduff46 macrumors regular

    jaduff46

    Joined:
    Mar 3, 2010
    Location:
    Northern NJ
  12. blueshogun96 thread starter macrumors regular

    blueshogun96

    Joined:
    Nov 24, 2012
    #12

Share This Page