Binding to Capslock Key (OSX Control Problems)
by Charlie Sibbach · in Torque Game Engine · 02/20/2009 (8:31 am) · 4 replies
Specifically, there seems to be a problem doing this on OSX. On Linux, capslock works like every other key; I have reports that the Windows version is also working correctly. However, my control system is completely screwy on OSX- same code, different results. I'm not getting any response from the Capslock key at all- I've bound it to GlobalActionMap, and my normal action map, and no change. The shift keys seem to be the same, haven't tried the other control keys.
I'm also having a problem on OSX where if I lockMouse(true) and cursorOff() in the console, everything works (mouse control), but as soon as I hide the console, bam, it's broken (mouse unlocked, cursor showing, no mouse control). I'm using the capslock key to swap between two ActionMaps (mouseMap.push(); keyboardMap.pop(); mouseMap.pop(); keyboardMap.push();), which works fine on Linux and Windows, but the same code is broken on OSX. Is there any documented problems with OSX bindings that you can point me to?
Any ideas are appreciated!
PS: On a separate note, is there any way to make sure that the state of the capslock light is synchronized? Right now, I get a pair of mouseDown/mouseUp events when they hit capslock, and I have no way that I know about to make sure that I'm in a certain mode when capslock is on. For what I'm doing, I want to use a certain ActionMap when capslock is "on" (the light on the keyboard is on, system thinks it's in capslock mode), and another when it is "off". As far as I can tell, there's no way to tell what mode it's currently in, it's just another key.
I'm also having a problem on OSX where if I lockMouse(true) and cursorOff() in the console, everything works (mouse control), but as soon as I hide the console, bam, it's broken (mouse unlocked, cursor showing, no mouse control). I'm using the capslock key to swap between two ActionMaps (mouseMap.push(); keyboardMap.pop(); mouseMap.pop(); keyboardMap.push();), which works fine on Linux and Windows, but the same code is broken on OSX. Is there any documented problems with OSX bindings that you can point me to?
Any ideas are appreciated!
PS: On a separate note, is there any way to make sure that the state of the capslock light is synchronized? Right now, I get a pair of mouseDown/mouseUp events when they hit capslock, and I have no way that I know about to make sure that I'm in a certain mode when capslock is on. For what I'm doing, I want to use a certain ActionMap when capslock is "on" (the light on the keyboard is on, system thinks it's in capslock mode), and another when it is "off". As far as I can tell, there's no way to tell what mode it's currently in, it's just another key.
#2
As for the main problem, I am pretty darn certain that OSX does not register the modifier keys separately from the other keys. Shift, control, option, capslock, etc, do NOT work by themselves on TGE for OSX, but they do (at least capslock does) on the other platforms. Very annoying, but for now I'm just rebinding to Enter and avoiding those keys. It's really too bad, though, because those usually registered independently from the other keys that do register, so that the keyboard could pick up 5 or 6 keypressed simultaneously instead of 2.
02/21/2009 (3:54 pm)
So, I figured out why the cursor kept popping up when it shouldn't; "noCursor = true;" had been removed from the PlayGui at some point in time (the Canvas checks for this property on all the root GUIs, it must be set on all of them or the cursor comes on every time it checks). Not sure why this was working on the other platforms; I may have had bad data- on the other platforms they could cycle their controls with capslock and that probably cleared up the problem without them even noticing.As for the main problem, I am pretty darn certain that OSX does not register the modifier keys separately from the other keys. Shift, control, option, capslock, etc, do NOT work by themselves on TGE for OSX, but they do (at least capslock does) on the other platforms. Very annoying, but for now I'm just rebinding to Enter and avoiding those keys. It's really too bad, though, because those usually registered independently from the other keys that do register, so that the keyboard could pick up 5 or 6 keypressed simultaneously instead of 2.
#3
07/05/2009 (4:49 pm)
This problem still seems to be occuring, I thought I'd bump this older thread rather than making a new one. We took a few months off from the project but we're back on it now. Can anybody confirm Mac modifier key problems?
#4
10/16/2009 (2:18 am)
Yes, I've been noticing this as well.
Torque Owner Charlie Sibbach
In any case, still a problem, still totally wierd. Are there known OSX problems with control bindings?
I just went into a fresh starter.fps, and added this to default.bind.cs:
moveMap.bind(keyboard, capslock, capslockEcho); moveMap.bind(keyboard, shift, capslockEcho); //moveMap.bind(keyboard, shift, capslockEcho); moveMap.bind(keyboard, alt, capslockEcho); //moveMap.bind(keyboard, ralt, capslockEcho); moveMap.bind(keyboard, control, capslockEcho); //moveMap.bind(keyboard, rcontrol, capslockEcho); moveMap.bind(keyboard, c, capslockEcho); function capslockEcho(%val) { if (%val) echo("Capslock pressed!"); else echo("Capslock Released!"); }Nothing except the bind to the C key made a difference. Does the Mac simply not register modifier keys unless another key has been pressed? Is there any way to change this?