aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-03-10 23:31:27 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-03-13 21:24:52 +0100
commit25db7413afabc3ece4702e95ae289468898c930d (patch)
tree74bcf5b6969e8ee30c80774550dbebb1465b678c /nx-X11/programs/Xserver/hw/nxagent
parent13a7c4a7335a6695ede3f2f3a58a06479ea9a6a2 (diff)
downloadnx-libs-25db7413afabc3ece4702e95ae289468898c930d.tar.gz
nx-libs-25db7413afabc3ece4702e95ae289468898c930d.tar.bz2
nx-libs-25db7413afabc3ece4702e95ae289468898c930d.zip
Keystroke.c: Simplify read_binding_from_xmlnode
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
index 281fec243..6346962c8 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
@@ -167,6 +167,7 @@ static Bool modifier_matches(unsigned int mask, int compare_alt_meta, unsigned i
static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystrokeMap *ret)
{
+ /* init the struct to have proper values in case not all attributes are found */
struct nxagentSpecialKeystrokeMap newkm = {
.stroke = KEYSTROKE_END_MARKER,
.modifierMask = 0,
@@ -204,24 +205,24 @@ static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystr
}
else if (strcmp((char *)attr->name, "key") == 0)
{
- if (strcmp((char *)attr->children->content, "0") != 0 && strcmp((char *)attr->children->content, "false") != 0)
- newkm.keysym = XStringToKeysym((char *)attr->children->content);
-
+ newkm.keysym = XStringToKeysym((char *)attr->children->content);
continue;
}
-
- /* ignore attributes with value="0" or "false", everything else is interpreted as true */
- if (strcmp((char *)attr->children->content, "0") == 0 || strcmp((char *)attr->children->content, "false") == 0)
- continue;
-
- if (strcmp((char *)attr->name, "Mod1") == 0) { newkm.modifierMask |= Mod1Mask; }
- else if (strcmp((char *)attr->name, "Mod2") == 0) { newkm.modifierMask |= Mod2Mask; }
- else if (strcmp((char *)attr->name, "Mod3") == 0) { newkm.modifierMask |= Mod3Mask; }
- else if (strcmp((char *)attr->name, "Mod4") == 0) { newkm.modifierMask |= Mod4Mask; }
- else if (strcmp((char *)attr->name, "Control") == 0) { newkm.modifierMask |= ControlMask; }
- else if (strcmp((char *)attr->name, "Shift") == 0) { newkm.modifierMask |= ShiftMask; }
- else if (strcmp((char *)attr->name, "Lock") == 0) { newkm.modifierMask |= LockMask; }
- else if (strcmp((char *)attr->name, "AltMeta") == 0) { newkm.modifierAltMeta = True; }
+ else
+ {
+ /* ignore attributes with value="0" or "false", everything else is interpreted as true */
+ if (strcmp((char *)attr->children->content, "0") == 0 || strcmp((char *)attr->children->content, "false") == 0)
+ continue;
+
+ if (strcmp((char *)attr->name, "Mod1") == 0) { newkm.modifierMask |= Mod1Mask; }
+ else if (strcmp((char *)attr->name, "Mod2") == 0) { newkm.modifierMask |= Mod2Mask; }
+ else if (strcmp((char *)attr->name, "Mod3") == 0) { newkm.modifierMask |= Mod3Mask; }
+ else if (strcmp((char *)attr->name, "Mod4") == 0) { newkm.modifierMask |= Mod4Mask; }
+ else if (strcmp((char *)attr->name, "Control") == 0) { newkm.modifierMask |= ControlMask; }
+ else if (strcmp((char *)attr->name, "Shift") == 0) { newkm.modifierMask |= ShiftMask; }
+ else if (strcmp((char *)attr->name, "Lock") == 0) { newkm.modifierMask |= LockMask; }
+ else if (strcmp((char *)attr->name, "AltMeta") == 0) { newkm.modifierAltMeta = True; }
+ }
}
if (newkm.stroke != KEYSTROKE_END_MARKER && newkm.keysym != NoSymbol)