Re:NSTouchBar API Reference
by cyrus_ on Thursday October 27, 2016 @09:19PM
(#12812155)
Unless the OS is rendering the bar off-screen even when there isn't a hardware bar, you could trivially determine whether there is a bar by having the code that controls the bar set a flag / send a message.
[ Parent
| on HN ]
Re:NSTouchBar API Reference
by colejohnson66 on Friday October 28, 2016 @02:32AM
(#12813591)
I sounds to me that it works like an interface. You call function `doFoo()` and if there's a foobar, the OS does foo. If there isn't a foobar, the method does nothing (but both return STATUS_FOO_SUCCESS).
For the touch bar, you aren't doing the actual rendering; the OS is. Only the OS knows if there's a touch bar, so without a kext or something, it seems there's no way for you to know if the touch bar exists.
Rendering and uploading something (or sending some messages to the touch bar controller; or queuing messages to the touch bar) probably takes a tiny bit longer than
if(!touchbar) return MAKE_SUCCESS_GREAT_AGAIN;
But then again maybe the user space component just doesn't have that conditional.