MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / handle_xlib_event

Method handle_xlib_event

cube/cube.cpp:3246–3279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3244}
3245
3246void Demo::handle_xlib_event(const XEvent *event) {
3247 switch (event->type) {
3248 case ClientMessage:
3249 if ((Atom)event->xclient.data.l[0] == xlib_wm_delete_window) {
3250 quit = true;
3251 }
3252 break;
3253 case KeyPress:
3254 switch (event->xkey.keycode) {
3255 case 0x9: // Escape
3256 quit = true;
3257 break;
3258 case 0x71: // left arrow key
3259 spin_angle -= spin_increment;
3260 break;
3261 case 0x72: // right arrow key
3262 spin_angle += spin_increment;
3263 break;
3264 case 0x41: // space bar
3265 pause = !pause;
3266 break;
3267 }
3268 break;
3269 case ConfigureNotify:
3270 if (((int32_t)width != event->xconfigure.width) || ((int32_t)height != event->xconfigure.height)) {
3271 width = event->xconfigure.width;
3272 height = event->xconfigure.height;
3273 resize();
3274 }
3275 break;
3276 default:
3277 break;
3278 }
3279}
3280
3281template <>
3282void Demo::run<WsiPlatform::xlib>() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected