开发者

set/get fn-lock for a macos application

Does anybody know a way to set/get the fn-lock from an application so you don't have to press the 'fn' key to get F1, F2, etc. on a macbook or apple keyboard? I want to have it always on for my application but keep the standard behavior in the rest of the 开发者_开发问答system.


This answer is pure speculation, but bear with me.

A possible scenario: the keyboard itself generates different low-level scan codes depending on whether the fn key is pressed. For the sake of argument, let's assume the following:

   F1: 0x01
fn-F1: 0x02

These low-level scan codes are sent over the bus to the keyboard driver. The keyboard driver checks to see whether the "Use F keys as standard function keys" preference is set and, if so, swaps scan codes before forwarding them on to the application. So, the keyboard driver would do this mapping:

                  F1: 0x01
               fn-F1: 0x02
"Use F keys" &    F1: 0x02
"Use F keys" & fn-F1: 0x01

If that's the case, you might just want to see if the "use all F keys as standard function keys" preference is set and, if it is, re-swap the scan codes before you process them. In other words, you would undo the work that the keyboard driver did. Perhaps this is your original question.

Look into it, though; I could be wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜