summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2014-08-08 12:59:51 -0700
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-08-19 12:19:16 +0300
commit4fb8491e1bc12c2da08ab1beeb6781ba5771c507 (patch)
tree34006a93a723135b33275ddf4bc2a057e56c5822
parent61917c84e3fcbb71da806a5e94a82916d77e18b1 (diff)
downloadweston-4fb8491e1bc12c2da08ab1beeb6781ba5771c507.tar.gz
weston-eventdemo --help works
Also defaults to printing all events if you specify none. Removed incorrect "-0" switch which would turn on one of them.
-rw-r--r--clients/eventdemo.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/clients/eventdemo.c b/clients/eventdemo.c
index 5ec68296..50a9cb42 100644
--- a/clients/eventdemo.c
+++ b/clients/eventdemo.c
@@ -373,13 +373,13 @@ static const struct weston_option eventdemo_options[] = {
{ WESTON_OPTION_INTEGER, "max-width", 0, &width_max },
{ WESTON_OPTION_INTEGER, "max-height", 0, &height_max },
{ WESTON_OPTION_BOOLEAN, "no-border", 'b', &noborder },
- { WESTON_OPTION_BOOLEAN, "log-redraw", '0', &log_redraw },
- { WESTON_OPTION_BOOLEAN, "log-resize", '0', &log_resize },
- { WESTON_OPTION_BOOLEAN, "log-focus", '0', &log_focus },
- { WESTON_OPTION_BOOLEAN, "log-key", '0', &log_key },
- { WESTON_OPTION_BOOLEAN, "log-button", '0', &log_button },
- { WESTON_OPTION_BOOLEAN, "log-axis", '0', &log_axis },
- { WESTON_OPTION_BOOLEAN, "log-motion", '0', &log_motion },
+ { WESTON_OPTION_BOOLEAN, "log-redraw", 0, &log_redraw },
+ { WESTON_OPTION_BOOLEAN, "log-resize", 0, &log_resize },
+ { WESTON_OPTION_BOOLEAN, "log-focus", 0, &log_focus },
+ { WESTON_OPTION_BOOLEAN, "log-key", 0, &log_key },
+ { WESTON_OPTION_BOOLEAN, "log-button", 0, &log_button },
+ { WESTON_OPTION_BOOLEAN, "log-axis", 0, &log_axis },
+ { WESTON_OPTION_BOOLEAN, "log-motion", 0, &log_motion },
};
/**
@@ -392,8 +392,32 @@ main(int argc, char *argv[])
struct display *d;
struct eventdemo *e;
- parse_options(eventdemo_options,
- ARRAY_LENGTH(eventdemo_options), &argc, argv);
+ if (parse_options(eventdemo_options,
+ ARRAY_LENGTH(eventdemo_options), &argc, argv) > 1) {
+ unsigned k;
+ printf("Usage: %s [OPTIONS]\n\n", argv[0]);
+ for (k = 0; k < ARRAY_LENGTH(eventdemo_options); k++) {
+ const struct weston_option* p = &eventdemo_options[k];
+ if (p->name) {
+ printf(" --%s", p->name);
+ if (p->type != WESTON_OPTION_BOOLEAN)
+ printf("=VALUE");
+ putchar('\n');
+ }
+ if (p->short_name) {
+ printf(" -%c", p->short_name);
+ if (p->type != WESTON_OPTION_BOOLEAN)
+ printf("VALUE");
+ putchar('\n');
+ }
+ }
+ return 1;
+ }
+
+ if (!log_redraw && !log_resize && !log_focus && !log_key &&
+ !log_button && !log_axis && !log_motion)
+ log_redraw = log_resize = log_focus = log_key =
+ log_button = log_axis = log_motion = 1;
/* Connect to the display and have the arguments parsed */
d = display_create(&argc, argv);