summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drm-atomic.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drm-atomic.c b/drm-atomic.c
index d748772..0f04268 100644
--- a/drm-atomic.c
+++ b/drm-atomic.c
@@ -23,6 +23,7 @@
#include <assert.h>
#include <errno.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -257,6 +258,17 @@ static int atomic_run(const struct gbm *gbm, const struct egl *egl)
egl->eglDestroySyncKHR(egl->display, kms_fence);
}
+ /* Check for user input: */
+ struct pollfd fdset[] = { {
+ .fd = STDIN_FILENO,
+ .events = POLLIN,
+ } };
+ ret = poll(fdset, ARRAY_SIZE(fdset), 0);
+ if (ret > 0) {
+ printf("user interrupted!\n");
+ return 0;
+ }
+
/*
* Here you could also update drm plane layers if you want
* hw composition