parent
d53fcf53f8
commit
80ab9f12b4
|
@ -453,7 +453,7 @@ static bool
|
||||||
write_action(struct xkb_keymap *keymap, struct buf *buf,
|
write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
union xkb_action *action, const char *prefix, const char *suffix)
|
union xkb_action *action, const char *prefix, const char *suffix)
|
||||||
{
|
{
|
||||||
const char *type = NULL;
|
const char *type;
|
||||||
const char *args = NULL;
|
const char *args = NULL;
|
||||||
|
|
||||||
if (!prefix)
|
if (!prefix)
|
||||||
|
@ -461,23 +461,18 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
if (!suffix)
|
if (!suffix)
|
||||||
suffix = "";
|
suffix = "";
|
||||||
|
|
||||||
|
type = ActionTypeText(action->any.type);
|
||||||
|
|
||||||
switch (action->any.type) {
|
switch (action->any.type) {
|
||||||
case XkbSA_SetMods:
|
case XkbSA_SetMods:
|
||||||
if (!type)
|
|
||||||
type = "SetMods";
|
|
||||||
case XkbSA_LatchMods:
|
case XkbSA_LatchMods:
|
||||||
if (!type)
|
|
||||||
type = "LatchMods";
|
|
||||||
case XkbSA_LockMods:
|
case XkbSA_LockMods:
|
||||||
if (!type)
|
|
||||||
type = "LockMods";
|
|
||||||
if (action->mods.flags & XkbSA_UseModMapMods)
|
if (action->mods.flags & XkbSA_UseModMapMods)
|
||||||
args = "modMapMods";
|
args = "modMapMods";
|
||||||
else
|
else
|
||||||
args = get_mod_mask_text(keymap, action->mods.real_mods,
|
args = get_mod_mask_text(keymap, action->mods.real_mods,
|
||||||
action->mods.vmods);
|
action->mods.vmods);
|
||||||
write_buf(buf, "%s%s(modifiers=%s%s%s)%s",
|
write_buf(buf, "%s%s(modifiers=%s%s%s)%s", prefix, type, args,
|
||||||
prefix, type, args,
|
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->any.type != XkbSA_LockGroup &&
|
||||||
(action->mods.flags & XkbSA_ClearLocks)) ?
|
(action->mods.flags & XkbSA_ClearLocks)) ?
|
||||||
",clearLocks" : "",
|
",clearLocks" : "",
|
||||||
|
@ -488,16 +483,9 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_SetGroup:
|
case XkbSA_SetGroup:
|
||||||
if (!type)
|
|
||||||
type = "SetGroup";
|
|
||||||
case XkbSA_LatchGroup:
|
case XkbSA_LatchGroup:
|
||||||
if (!type)
|
|
||||||
type = "LatchGroup";
|
|
||||||
case XkbSA_LockGroup:
|
case XkbSA_LockGroup:
|
||||||
if (!type)
|
write_buf(buf, "%s%s(group=%s%d%s%s)%s", prefix, type,
|
||||||
type = "LockGroup";
|
|
||||||
write_buf(buf, "%s%s(group=%s%d%s%s)%s",
|
|
||||||
prefix, type,
|
|
||||||
(!(action->group.flags & XkbSA_GroupAbsolute) &&
|
(!(action->group.flags & XkbSA_GroupAbsolute) &&
|
||||||
action->group.group > 0) ? "+" : "",
|
action->group.group > 0) ? "+" : "",
|
||||||
(action->group.flags & XkbSA_GroupAbsolute) ?
|
(action->group.flags & XkbSA_GroupAbsolute) ?
|
||||||
|
@ -512,13 +500,11 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_Terminate:
|
case XkbSA_Terminate:
|
||||||
write_buf(buf, "%sTerminate()%s", prefix,
|
write_buf(buf, "%s%s()%s", prefix, type, suffix);
|
||||||
suffix);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_MovePtr:
|
case XkbSA_MovePtr:
|
||||||
write_buf(buf, "%sMovePtr(x=%s%d,y=%s%d%s)%s",
|
write_buf(buf, "%s%s(x=%s%d,y=%s%d%s)%s", prefix, type,
|
||||||
prefix,
|
|
||||||
(!(action->ptr.flags & XkbSA_MoveAbsoluteX) &&
|
(!(action->ptr.flags & XkbSA_MoveAbsoluteX) &&
|
||||||
action->ptr.x >= 0) ? "+" : "",
|
action->ptr.x >= 0) ? "+" : "",
|
||||||
action->ptr.x,
|
action->ptr.x,
|
||||||
|
@ -529,14 +515,8 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
suffix);
|
suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_PtrBtn:
|
|
||||||
if (!type)
|
|
||||||
type = "PtrBtn";
|
|
||||||
case XkbSA_LockPtrBtn:
|
case XkbSA_LockPtrBtn:
|
||||||
if (!type) {
|
switch (action->btn.flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
|
||||||
type = "LockPtrBtn";
|
|
||||||
switch (action->btn.flags &
|
|
||||||
(XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
|
|
||||||
case XkbSA_LockNoUnlock:
|
case XkbSA_LockNoUnlock:
|
||||||
args = ",affect=lock";
|
args = ",affect=lock";
|
||||||
break;
|
break;
|
||||||
|
@ -553,10 +533,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
args = ",affect=both";
|
args = ",affect=both";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
case XkbSA_PtrBtn:
|
||||||
else {
|
|
||||||
args = NULL;
|
|
||||||
}
|
|
||||||
write_buf(buf, "%s%s(button=", prefix, type);
|
write_buf(buf, "%s%s(button=", prefix, type);
|
||||||
if (action->btn.button > 0 && action->btn.button <= 5)
|
if (action->btn.button > 0 && action->btn.button <= 5)
|
||||||
write_buf(buf, "%d", action->btn.button);
|
write_buf(buf, "%d", action->btn.button);
|
||||||
|
@ -570,7 +547,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_SetPtrDflt:
|
case XkbSA_SetPtrDflt:
|
||||||
write_buf(buf, "%sSetPtrDflt(", prefix);
|
write_buf(buf, "%s%s(", prefix, type);
|
||||||
if (action->dflt.affect == XkbSA_AffectDfltBtn)
|
if (action->dflt.affect == XkbSA_AffectDfltBtn)
|
||||||
write_buf(buf, "affect=button,button=%s%d",
|
write_buf(buf, "affect=button,button=%s%d",
|
||||||
(!(action->dflt.flags & XkbSA_DfltBtnAbsolute) &&
|
(!(action->dflt.flags & XkbSA_DfltBtnAbsolute) &&
|
||||||
|
@ -580,7 +557,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_SwitchScreen:
|
case XkbSA_SwitchScreen:
|
||||||
write_buf(buf, "%sSwitchScreen(screen=%s%d,%ssame)%s", prefix,
|
write_buf(buf, "%s%s(screen=%s%d,%ssame)%s", prefix, type,
|
||||||
(!(action->screen.flags & XkbSA_SwitchAbsolute) &&
|
(!(action->screen.flags & XkbSA_SwitchAbsolute) &&
|
||||||
action->screen.screen >= 0) ? "+" : "",
|
action->screen.screen >= 0) ? "+" : "",
|
||||||
action->screen.screen,
|
action->screen.screen,
|
||||||
|
@ -590,14 +567,9 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
|
|
||||||
/* Deprecated actions below here */
|
/* Deprecated actions below here */
|
||||||
case XkbSA_SetControls:
|
case XkbSA_SetControls:
|
||||||
if (!type)
|
|
||||||
type = "SetControls";
|
|
||||||
case XkbSA_LockControls:
|
case XkbSA_LockControls:
|
||||||
if (!type)
|
write_buf(buf, "%s%s(controls=%s)%s", prefix, type,
|
||||||
type = "LockControls";
|
get_control_mask_text(action->ctrls.ctrls), suffix);
|
||||||
write_buf(buf, "%s%s(controls=%s)%s",
|
|
||||||
prefix, type, get_control_mask_text(action->ctrls.ctrls),
|
|
||||||
suffix);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_ISOLock:
|
case XkbSA_ISOLock:
|
||||||
|
@ -613,8 +585,8 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
case XkbSA_XFree86Private:
|
case XkbSA_XFree86Private:
|
||||||
default:
|
default:
|
||||||
write_buf(buf,
|
write_buf(buf,
|
||||||
"%sPrivate(type=0x%02x,data[0]=0x%02x,data[1]=0x%02x,data[2]=0x%02x,data[3]=0x%02x,data[4]=0x%02x,data[5]=0x%02x,data[6]=0x%02x)%s",
|
"%s%s(type=0x%02x,data[0]=0x%02x,data[1]=0x%02x,data[2]=0x%02x,data[3]=0x%02x,data[4]=0x%02x,data[5]=0x%02x,data[6]=0x%02x)%s",
|
||||||
prefix, action->any.type, action->any.data[0],
|
prefix, type, action->any.type, action->any.data[0],
|
||||||
action->any.data[1], action->any.data[2],
|
action->any.data[1], action->any.data[2],
|
||||||
action->any.data[3], action->any.data[4],
|
action->any.data[3], action->any.data[4],
|
||||||
action->any.data[5], action->any.data[6],
|
action->any.data[5], action->any.data[6],
|
||||||
|
|
42
src/text.c
42
src/text.c
|
@ -211,27 +211,27 @@ FileTypeText(enum xkb_file_type type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *actionTypeNames[XkbSA_NumActions] = {
|
static const char *actionTypeNames[XkbSA_NumActions] = {
|
||||||
"NoAction", /* XkbSA_NoAction */
|
[XkbSA_NoAction] = "NoAction",
|
||||||
"SetMods", /* XkbSA_SetMods */
|
[XkbSA_SetMods] = "SetMods",
|
||||||
"LatchMods", /* XkbSA_LatchMods */
|
[XkbSA_LatchMods] = "LatchMods",
|
||||||
"LockMods", /* XkbSA_LockMods */
|
[XkbSA_LockMods] = "LockMods",
|
||||||
"SetGroup", /* XkbSA_SetGroup */
|
[XkbSA_SetGroup] = "SetGroup",
|
||||||
"LatchGroup", /* XkbSA_LatchGroup */
|
[XkbSA_LatchGroup] = "LatchGroup",
|
||||||
"LockGroup", /* XkbSA_LockGroup */
|
[XkbSA_LockGroup] = "LockGroup",
|
||||||
"MovePtr", /* XkbSA_MovePtr */
|
[XkbSA_MovePtr] = "MovePtr",
|
||||||
"PtrBtn", /* XkbSA_PtrBtn */
|
[XkbSA_PtrBtn] = "PtrBtn",
|
||||||
"LockPtrBtn", /* XkbSA_LockPtrBtn */
|
[XkbSA_LockPtrBtn] = "LockPtrBtn",
|
||||||
"SetPtrDflt", /* XkbSA_SetPtrDflt */
|
[XkbSA_SetPtrDflt] = "SetPtrDflt",
|
||||||
"ISOLock", /* XkbSA_ISOLock */
|
[XkbSA_ISOLock] = "ISOLock",
|
||||||
"Terminate", /* XkbSA_Terminate */
|
[XkbSA_Terminate] = "Terminate",
|
||||||
"SwitchScreen", /* XkbSA_SwitchScreen */
|
[XkbSA_SwitchScreen] = "SwitchScreen",
|
||||||
"SetControls", /* XkbSA_SetControls */
|
[XkbSA_SetControls] = "SetControls",
|
||||||
"LockControls", /* XkbSA_LockControls */
|
[XkbSA_LockControls] = "LockControls",
|
||||||
"ActionMessage", /* XkbSA_ActionMessage */
|
[XkbSA_ActionMessage] = "ActionMessage",
|
||||||
"RedirectKey", /* XkbSA_RedirectKey */
|
[XkbSA_RedirectKey] = "RedirectKey",
|
||||||
"DeviceBtn", /* XkbSA_DeviceBtn */
|
[XkbSA_DeviceBtn] = "DeviceBtn",
|
||||||
"LockDeviceBtn", /* XkbSA_LockDeviceBtn */
|
[XkbSA_LockDeviceBtn] = "LockDeviceBtn",
|
||||||
"DeviceValuator" /* XkbSA_DeviceValuator */
|
[XkbSA_DeviceValuator] = "DeviceValuator"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
Loading…
Reference in New Issue