MacOSX 10.6 has a method setWantsRestingTouches with a default of No, but I'd like to somehow change the default to YES. (Otherwise, I'd have to request developers of each app I use to make this a settable preference and invoke that method accordingly.)
Is there some conventional way to translate from a method name to a global preference?
While many apps expose user preferences that may be set via 'defaults write ...' shell command, is there开发者_如何学运维 something similar but for the various methods provided by Apple?
(Apologies for not being an ObjC coder yet, so I'm likely phrasing the questions improperly.)
Specifically, I'm interested in re-introducing the trackpad option to DISABLE "Ignore accidental trackpad input" that went away late into 10.5.x when unibody macbooks were introduced. The developer docs indicate that setWantsRestingTouches method and isResting property of NSTouch class are the hooks for resolving this behavior on an app-specific level. I'm aiming for a deeper level than that.
Thanks!
Is there some conventional way to translate from a method name to a global preference?
No.
Furthermore, the wantsRestingTouches
is not even an app-level preference, unfortunately. It's a view-level preference. Views are the various components you see inside a window; many objects are themselves views, and each of them has wantsRestingTouches
setting.
So it's not that a developer can easily turn wantsRestingTouches
to YES
globally, either. (Well in a sense you can, but you don't really want to do that.)
Are you really sure you want to do that? With draconian Apple, it's sometimes a good approach to just give up and live with it if the mothership thinks it's a good way. (In this case, doing away with this particular option.) With each OS X update, some features were thrown out, and many people shed tears and many loudly complained, but usually it didn't change the overlord's mind. And hacking a system becomes more and more difficult as each version of OS X locks down many doors. But in a few years, people eventually get used to the new system.
That said, there's a way to do that, but that involves a lot of steps.
- Understand how to perform method swizzling, see here
- Write a code which modifies
init
methods ofNSView
so that it doessetWantsRestingTouches:YES
- Inject it using the
osax
trick, see here. There's a wrapper around it called SIMBL
I don't write one for you. Rather, if you really, really want to do that, it's a nice opportunity for you to learn the deep tricks of OS X and Objective-C. So, be patient, be willing to learn and have fun!
精彩评论