Pragmatically Disable Hotcorners w/ C++?

blueshogun96

macrumors regular
Original poster
Nov 24, 2012
105
0
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.
 

blueshogun96

macrumors regular
Original poster
Nov 24, 2012
105
0
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
 

Senor Cuete

macrumors 6502
Nov 9, 2011
274
12
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
Are GLUT windows templates stored in resource files? Does GLUT give you access to the window objects and their attributes?
 

blueshogun96

macrumors regular
Original poster
Nov 24, 2012
105
0
Are GLUT windows templates stored in resource files? Does GLUT give you access to the window objects and their attributes?
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
 

Senor Cuete

macrumors 6502
Nov 9, 2011
274
12
Googling GLUT, and GLUT window management, it looks like in order to make it cross-platform, they gave you very limited GUI functionality.
 

robvas

macrumors 68030
Mar 29, 2009
2,801
372
USA
http://apple.stackexchange.com/questions/110175/how-can-i-temporarily-disable-hot-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.

 

blueshogun96

macrumors regular
Original poster
Nov 24, 2012
105
0
Googling GLUT, and GLUT window management, it looks like in order to make it cross-platform, they gave you very limited GUI functionality.
Unfortunately yes. At least with Windows there's a function called GetActiveWindow(). Is there an equivalent for Mac?

Shogun.
 

blueshogun96

macrumors regular
Original poster
Nov 24, 2012
105
0
http://apple.stackexchange.com/questions/110175/how-can-i-temporarily-disable-hot-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.
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.
 

cqexbesd

macrumors regular
Jun 4, 2009
158
24
Germany
Last edited:

blueshogun96

macrumors regular
Original poster
Nov 24, 2012
105
0
There exists the scripting bridge for this very purpose.

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/Introduction/Introduction.html#//apple_ref/doc/uid/TP40006104-CH1-DontLinkElementID_18

Never tried from C++ but accessing Cocoa classes from C++ I'm sure is already covered elsewhere.
Awesome. Unfortunately, the script seems to change from one version of MacOS to the next. But let's give it a try.

Shogun.