27 Mar 2003
(updated 27 Mar 2003 at 09:35 UTC) »
Mac OS X & Proprietary Softwares
i've been playing around with mac os 10.2 lately. it's a nice os,
though it's baroque in places (natuerlich). and while drawin is open
(and i read through the scheduler sources for fun), the above-ground
parts are not.
i also got a music app as well (which cost nearly
1/2 of what the new dual g4 did...(replacements are being worked on and yes i've donated work and money to them)). it's interesting that in paying for
non-free software, instead of getting good, personal support, open
channels of communication with the developers, and information about
what plans are happening for future products, you get no source, bad
support, no flexibility, and no information.
in fact you get to
plug-in a usb key thingy (DONGLE!) and punch in a bunch of numbers and
then register and punch in a bunch more numbers, to show that you have
what it takes to own their software. (although, there are certainly
versions available without these features). but i'm sure i don't have
to work hard to convince anyone here of the evils (or at least
inconveniences) of proprietary software.
i also tried figuring out how to hook the cmd-tab (alt-tab) key so
that i could write an application to fix the stupid way OS X does
window switching (alt-tab switches between applications, alt-`
switches between multiple windows of a single application (they don't
show up on alt-tab)). there are a few apps out there that sort of
fix this behaviour but not to my liking.
first, i looked for a documented method. it doesn't appear that any
exists though. then i figured i'd see what Dock.app does (well first
i had to figure out that Dock.app was the one hooking alt-tab).
interesting library calls included CPSRegisterForKey, CGSSetHotKey,
and CGSSetHotKeyEnabled. i looked for documentation for those, but
apparently they are private and undocumented.
when this happens in normal situations the next step of course is
to fetch the source and look at the library's implementation.
i couldn't find a disassembler (no objdump(1) installed) so i broke
out gdb, set (sat?) a few breakpoints, and started single stepping
through the CPSRegisterForKey code to try to figure out the parameters
and how they're used. eventually, i figure out it's 'OSError
CPSRegisterForKey(ProcessSerNum * psn, SInt32 specialkeycodeEnum)' (
in this case the keycode is 1 iirc (up to 5)). well dandy. i
finally get that returning 0 (success!), (you have to kill the dock),
and then tried the standard way of doing Carbon/Cocoa hotkeys. but no
luck...it seems the specialkeys are filtered earlier on.
the next step is (of course) to figure out how to use CGSSetHotKey
what a spectacularly unmitigated useless waste of time.