Add documentation and cleanup previous PR
This commit is contained in:
parent
777b9eb68e
commit
d5448e6902
@ -140,14 +140,17 @@ sub-field for the shifted key, like this::
|
|||||||
Modifiers
|
Modifiers
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
This protocol supports four modifier keys, :kbd:`shift, alt, ctrl and super`.
|
This protocol supports six modifier keys, :kbd:`shift, alt, ctrl, super, hyper
|
||||||
Here super is either the *Windows/Linux* key or the *Cmd* key on mac keyboards.
|
and meta`. Here :kbd:`super` is either the *Windows/Linux* key or the *Cmd* key on
|
||||||
Modifiers are encoded as a bit field with::
|
mac keyboards. :kbd:`hyper` and :kbd:`meta` are typically present only on X11
|
||||||
|
based systems with special XKB rules. Modifiers are encoded as a bit field with::
|
||||||
|
|
||||||
shift 0b1 (1)
|
shift 0b1 (1)
|
||||||
alt 0b10 (2)
|
alt 0b10 (2)
|
||||||
ctrl 0b100 (4)
|
ctrl 0b100 (4)
|
||||||
super 0b1000 (8)
|
super 0b1000 (8)
|
||||||
|
hyper 0b10000 (16)
|
||||||
|
meta 0b100000 (32)
|
||||||
|
|
||||||
In the escape code, the modifier value is encoded as a decimal number which is
|
In the escape code, the modifier value is encoded as a decimal number which is
|
||||||
``1 + actual modifiers``. So to represent :kbd:`shift` only, the value would be ``1 +
|
``1 + actual modifiers``. So to represent :kbd:`shift` only, the value would be ``1 +
|
||||||
|
|||||||
7
glfw/xkb_glfw.c
vendored
7
glfw/xkb_glfw.c
vendored
@ -317,6 +317,7 @@ glfw_xkb_update_x11_keyboard_id(_GLFWXKBData *xkb) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
glfw_xkb_update_masks(_GLFWXKBData *xkb) {
|
glfw_xkb_update_masks(_GLFWXKBData *xkb) {
|
||||||
|
// See https://github.com/kovidgoyal/kitty/pull/3430 for discussion
|
||||||
bool succeeded = false;
|
bool succeeded = false;
|
||||||
unsigned used_bits = 0; /* To avoid using the same bit twice */
|
unsigned used_bits = 0; /* To avoid using the same bit twice */
|
||||||
XkbDescPtr xkb_ptr = XkbGetMap( _glfw.x11.display, XkbVirtualModsMask | XkbVirtualModMapMask, XkbUseCoreKbd );
|
XkbDescPtr xkb_ptr = XkbGetMap( _glfw.x11.display, XkbVirtualModsMask | XkbVirtualModMapMask, XkbUseCoreKbd );
|
||||||
@ -367,7 +368,8 @@ glfw_xkb_update_masks(_GLFWXKBData *xkb) {
|
|||||||
S(super, XKB_MOD_NAME_LOGO);
|
S(super, XKB_MOD_NAME_LOGO);
|
||||||
}
|
}
|
||||||
#undef S
|
#undef S
|
||||||
debug( "Modifier indices alt:%d super:%d hyper:%d meta:%d num>ock:%d\n", xkb->altIdx, xkb->superIdx, xkb->hyperIdx, xkb->metaIdx, xkb->numLockIdx );
|
debug("Modifier indices alt:%d super:%d hyper:%d meta:%d numlock:%d\n",
|
||||||
|
xkb->altIdx, xkb->superIdx, xkb->hyperIdx, xkb->metaIdx, xkb->numLockIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -378,7 +380,8 @@ glfw_xkb_update_masks(_GLFWXKBData *xkb) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
glfw_xkb_update_masks(_GLFWXKBData *xkb) {
|
glfw_xkb_update_masks(_GLFWXKBData *xkb) {
|
||||||
/* Should find better solution under evdev or wayland */
|
// Should find better solution under Wayland
|
||||||
|
// See https://github.com/kovidgoyal/kitty/pull/3430 for discussion
|
||||||
|
|
||||||
#define S( a ) xkb->a##Idx = XKB_MOD_INVALID; xkb->a##Mask = 0
|
#define S( a ) xkb->a##Idx = XKB_MOD_INVALID; xkb->a##Mask = 0
|
||||||
S(hyper); S(meta);
|
S(hyper); S(meta);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user