SimpleEvent SimpleWindow::event() {
SimpleEvent se;
+ KeySym mykey;
if(XPending(_display) > 0) {
break;
case KeyPress:
- KeySym mykey;
+ se.type = SimpleEvent::KEY_PRESS;
mykey = XkbKeycodeToKeysym(_display,
event.xkey.keycode, 0,
event.xkey.state & ShiftMask ? 1 : 0);
-
- se.type = SimpleEvent::KEY_PRESS;
strncpy(se.key, XKeysymToString(mykey), (sizeof(se.key)/sizeof(char) - 1));
-
break;
case KeyRelease:
- KeySym mykey;
+ se.type = SimpleEvent::KEY_RELEASE;
mykey = XkbKeycodeToKeysym(_display,
event.xkey.keycode, 0,
event.xkey.state & ShiftMask ? 1 : 0);
-
- se.type = SimpleEvent::KEY_RELEASE;
strncpy(se.key, XKeysymToString(mykey), (sizeof(se.key)/sizeof(char) - 1));
break;
default:
se.type = SimpleEvent::UNDEFINED;
break;
+
}
} else se.type = SimpleEvent::NO_EVENT;
return se;