Comment 178 for bug 36812

Created attachment 69198
LockMods can lock another group

This patch follows a different route: It extends modifier locking, rather than changing how group lock works. Extending has the advantage that the previous behaviour is maintained, and the patch does not violate the X Keyboard Protocol Specification. Extending modifier locking rather than group locking has the advantage that we do not need the "Kludge" of the other patch, as we can pass the modifiers that we want to set, rather then relying on heuristics.

The disadvantage over the existing patch is that we must change the keymap.

Here are three examples. The left alt key is to switch to the next layout when it is pressed and released before any other key is pressed.

    key <LALT> {
        repeat= No,
        type= "TWO_LEVEL",
        symbols[Group1]= [ Alt_L, Meta_L ],
 actions[Group1]= [ Private(type=3,data[0]=1,data[1]=8,data[2]=8,data[3]=0,data[4]=0,data[5]=0,data[6]=1),
                    Private(type=3,data[0]=1,data[1]=8,data[2]=8,data[3]=0,data[4]=0,data[5]=0,data[6]=1) ]
    };

Similarly, shifting group with Shift+Right Alt (where Shift is pressed first):