process all X11 event waiting in the queue in the same cycle v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 05 Dec 2023 22:55:25 +0100
branchv_0
changeset 20 0899e966993e
parent 19 262828ae9682
child 21 bcc53967ab3c
process all X11 event waiting in the queue in the same cycle avoid so called glitches after continuous key press or X11 tunelled through SSH
Shark.cpp
shaders/default.frag
--- a/Shark.cpp	Mon Dec 04 21:03:53 2023 +0100
+++ b/Shark.cpp	Tue Dec 05 22:55:25 2023 +0100
@@ -311,6 +311,7 @@
 					logOutput << "trace: no pending X11 event" << std::endl;
 					break;
 				}
+process_x11_event:
 				XWindowAttributes gwa;
 				XNextEvent(dpy, &xev);
 
@@ -380,6 +381,7 @@
 				} else {
 					std::cout << "XEvent: type=" << xev.type << std::endl;
 				}
+				if (XPending(dpy)) goto process_x11_event;
 			} else if (epoll[epollEvent].data.fd == STDIN_FILENO) {
 				int epollFD = epoll[epollEvent].data.fd;
 				logOutput << "other event: fd=" << epollFD << " data=";
--- a/shaders/default.frag	Mon Dec 04 21:03:53 2023 +0100
+++ b/shaders/default.frag	Tue Dec 05 22:55:25 2023 +0100
@@ -16,4 +16,5 @@
 	// fColor *= vec4(0.8, 1., 0.2, 1.);
 
 	// if (fColor.a < 0.1) discard;
+	// Pretty, pretty, pretty, pretty, Peggy Sue
 }