fcitx/fcitx-rime — pull request #12 by lotem (2013-07-05 12:51:49+00:00)
Title: Rime reads bitmask FcitxKeyState_CapsLock to detect whether caps lock is on

Chances are that Caps Lock has been turned on even before the IME was loaded.

The following code shows how Rime makes use of bitmask kLockMask (1 << 1), as attached to XK_CapsLock key event, to synchronize IME state with hardware Caps Lock LED state:

https://github.com/lotem/librime/blob/0bf138da08593475a909f14bc9857dd360768a3f/src/gear/ascii_composer.cc#L115