Example #1
0
static void
DarwinUpdateModifiers(int pressed,                    // KeyPress or KeyRelease
                      int flags)                      // modifier flags that have changed
{
    int *f;
    int key;

    /* Capslock is special.  This mask is the state of capslock (on/off),
     * not the state of the button.  Hopefully we can find a better solution.
     */
    if (NX_ALPHASHIFTMASK & flags) {
        DarwinPressModifierKey(KeyPress, NX_MODIFIERKEY_ALPHALOCK);
        DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK);
    }

    for (f = darwin_x11_modifier_mask_list; *f; f++)
        if (*f & flags && *f != NX_ALPHASHIFTMASK) {
            key = DarwinModifierNXMaskToNXKey(*f);
            if (key == -1)
                ErrorF("DarwinUpdateModifiers: Unsupported NXMask: 0x%x\n",
                       *f);
            else
                DarwinPressModifierKey(pressed, key);
        }
}
Example #2
0
/*
 * DarwinPressModifierMask
 *  Press or release the given modifier key, specified by its mask.
 */
static void DarwinPressModifierMask(
    xEvent *xe,     // must already have type, time and mouse location
    int mask)       // one of NX_*MASK constants
{
    int key = DarwinModifierNXMaskToNXKey(mask);

    if (key != -1) {
        int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
        if (keycode != 0) {
            xe->u.u.detail = keycode + MIN_KEYCODE;
            (*darwinEventQueue.pKbd->processInputProc)(xe,
                            (DeviceIntPtr)darwinEventQueue.pKbd, 1);
        }
    }
}