summaryrefslogtreecommitdiff
path: root/pugl_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-30 20:37:54 +0000
committerDavid Robillard <d@drobilla.net>2012-04-30 20:37:54 +0000
commit1365dd607f51217017f6de4c7246626a6fdd07e8 (patch)
tree6e7718c7858f5fe11cba3faae899fd388b10fb05 /pugl_test.c
parent91a4fea4672c54d84bd3e46422e32636351c8053 (diff)
Add puglIgnoreKeyRepeat and implement on X11.
Add proper command line options for pugl_test.
Diffstat (limited to 'pugl_test.c')
-rw-r--r--pugl_test.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/pugl_test.c b/pugl_test.c
index da58b78..6eeed1a 100644
--- a/pugl_test.c
+++ b/pugl_test.c
@@ -19,6 +19,7 @@
*/
#include <stdio.h>
+#include <string.h>
#include "pugl/pugl.h"
@@ -135,8 +136,26 @@ onClose(PuglView* view)
int
main(int argc, char** argv)
{
- bool resizable = argc > 1;
- PuglView* view = puglCreate(0, "Pugl Test", 512, 512, resizable);
+ bool ignoreKeyRepeat = false;
+ bool resizable = false;
+ for (int i = 1; i < argc; ++i) {
+ if (!strcmp(argv[i], "-h")) {
+ printf("USAGE: %s [OPTIONS]...\n\n"
+ " -h Display this help\n"
+ " -i Ignore key repeat\n"
+ " -r Resizable window\n", argv[0]);
+ return 0;
+ } else if (!strcmp(argv[i], "-i")) {
+ ignoreKeyRepeat = true;
+ } else if (!strcmp(argv[i], "-r")) {
+ resizable = true;
+ } else {
+ fprintf(stderr, "Unknown option: %s\n", argv[i]);
+ }
+ }
+
+ PuglView* view = puglCreate(0, "Pugl Test", 512, 512, resizable);
+ puglIgnoreKeyRepeat(view, ignoreKeyRepeat);
puglSetKeyboardFunc(view, onKeyboard);
puglSetMotionFunc(view, onMotion);
puglSetMouseFunc(view, onMouse);