aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl_x11.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-22 09:18:54 +0200
committerDavid Robillard <d@drobilla.net>2019-07-24 01:02:52 +0200
commitb0ddcbba56b8fc6f1576553c805b5dc7185773e4 (patch)
treed438f7060e4600e89a427a94c5343d7d49d4bb1f /pugl/pugl_x11.c
parent84834d6d8c120df10b0ebed6295294bedddcd757 (diff)
downloadpugl-b0ddcbba56b8fc6f1576553c805b5dc7185773e4.tar.gz
pugl-b0ddcbba56b8fc6f1576553c805b5dc7185773e4.tar.bz2
pugl-b0ddcbba56b8fc6f1576553c805b5dc7185773e4.zip
Simplify modifier translation code
Diffstat (limited to 'pugl/pugl_x11.c')
-rw-r--r--pugl/pugl_x11.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index 97c3351..bd9de42 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -285,14 +285,12 @@ translateKey(PuglView* view, XEvent* xevent, PuglEventKey* event)
}
static uint32_t
-translateModifiers(unsigned xstate)
+translateModifiers(const unsigned xstate)
{
- uint32_t state = 0;
- state |= (xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0;
- state |= (xstate & ControlMask) ? PUGL_MOD_CTRL : 0;
- state |= (xstate & Mod1Mask) ? PUGL_MOD_ALT : 0;
- state |= (xstate & Mod4Mask) ? PUGL_MOD_SUPER : 0;
- return state;
+ return (((xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0) |
+ ((xstate & ControlMask) ? PUGL_MOD_CTRL : 0) |
+ ((xstate & Mod1Mask) ? PUGL_MOD_ALT : 0) |
+ ((xstate & Mod4Mask) ? PUGL_MOD_SUPER : 0));
}
static PuglEvent