From: Francois Fleuret Date: Fri, 26 Aug 2016 06:20:26 +0000 (+0200) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=18b655f5e908b7a57709b9dec9f00428ed339839;p=universe.git Update. --- diff --git a/simple_window.cc b/simple_window.cc index 7fee9c2..2864168 100644 --- a/simple_window.cc +++ b/simple_window.cc @@ -156,6 +156,7 @@ int SimpleWindow::file_descriptor() { SimpleEvent SimpleWindow::event() { SimpleEvent se; + KeySym mykey; if(XPending(_display) > 0) { @@ -186,29 +187,25 @@ SimpleEvent SimpleWindow::event() { 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;