state: fix bad EFFECTIVE check in *_is_active()
authorRan Benita <ran234@gmail.com>
Wed, 3 Oct 2012 17:41:22 +0000 (19:41 +0200)
committerRan Benita <ran234@gmail.com>
Sat, 6 Oct 2012 19:41:58 +0000 (21:41 +0200)
commit1a6b1e07881976b8972742fc9e404dc0830a79b7
tree5219a971af4d3cde1fed16e97cbd38fdf8554697
parentfe1faa143e6a5d1dd423a33f7bc0aaf792b8fc40
state: fix bad EFFECTIVE check in *_is_active()

This is a regression introduced in ed78fbcb30888cbfc6cd00.
XKB_STATE_EFFECTIVE is just a OR of the other states, so using & here is
completely wrong. So test/state shows for example:
    dumping state for LCtrl down:
            group English (US) (0): effective depressed latched locked
            mod Control (2): depressed latched locked
    dumping state for LCtrl + RAlt down:
            group English (US) (0): effective depressed latched locked
            mod Control (2): depressed latched locked
            mod Mod1 (3): depressed latched locked
    dumping state for RAlt down:
            group English (US) (0): effective depressed latched locked
            mod Mod1 (3): depressed latched locked
    dumping state for Caps Lock:
            group English (US) (0): effective depressed latched locked
            mod Lock (1): depressed latched locked
            led Caps Lock (0): active
    dumping state for Alt-Shift-+
            group English (US) (0): effective depressed latched locked
            mod Shift (0): depressed latched locked
            mod Mod1 (3): depressed latched locked
which is bogus.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/state.c
test/state.c