Mod Archive Forums

Music Production => MilkyTracker => Tracking => MilkyTracker Feature Requests => Topic started by: syphus on October 08, 2011, 04:09:15

Title: OS X: Right-Cmd and Right-Opt keys!
Post by: syphus on October 08, 2011, 04:09:15
I'm just creating this thread as somewhere for any pertinent discussion to take place...but I've got the ball rolling on this issue by getting in touch with the Renoise team (who have figured out how to use these keys under OS X to control pattern-play/song-play in Renoise) and asking them if they're willing to share some code snippets with Milky chaps. They say yes and Deltafire has said he'll get in touch with them to discuss it - great news!

Anyway, assuming the secrets can be gleaned and incorporated into MilkyTracker, either by df or pailes, this thread will probably just be for comments or bug reports. Mods - feel free to move it around accordingly as this situation (hopefully) develops.

For anyone unfamiliar with the issue, it's nightmarishly difficult - for some reason - to map stuff to the Apple keyboard's Right-Cmd (applekey) and Right-Opt (alt) keys, which is a great shame for MilkyTracker as workflow under Windows and Linux is made so much smoother when your right thumb can be used to whack those PLAY!!!LOLZ!! buttons, just like in FastTracker, ProTracker, etc. Maybe it's because Apple really don't want you to use them for any non Apple-sanctioned functions, but whatever the reason, it doesn't really matter as the Renoise crew managed to figure it out a few years ago. Great that they're happy to share the trade secret though \o/
Title: Re: OS X: Right-Cmd and Right-Opt keys!
Post by: Deltafire on November 04, 2011, 20:28:23
Just been researching this, there is no easy way to obtain unique key-codes for the left/right modifier keys on OSX.  The difficult way is to create a new HID manager for the keyboard device, and setup a callback to handle input events; which sounds a lot easier than it is!

Some references for anyone feeling brave:

Introduction to Working With HID Class Device Interfaces (http://developer.apple.com/library/mac/#documentation/devicedrivers/conceptual/HID/intro/intro.html#//apple_ref/doc/uid/TP40000970-CH202-SW1)
IOHIDManager.h (http://developer.apple.com/library/mac/#documentation/Darwin/Reference/IOKit/IOHIDManager_h/index.html)
New HID Manager APIs for Mac OS X version 10.5 (http://developer.apple.com/library/mac/#technotes/tn2187/_index.html)
Virtual Awesome's HID manager interface (http://code.google.com/p/virtualawesome/source/browse/trunk/VirtualAwesome/addons/vaMice/libs/manymouse/macosx_hidmanager.c?r=4)