From f33b4a4efe2ff90451df5fe2d35321c5aa7d28fd Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 17 Jun 2010 23:02:23 +1200 Subject: [PATCH] move options to gtk-app.h, so new implementations can share them --- gtk-app.c | 23 ----------------------- gtk-app.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/gtk-app.c b/gtk-app.c index 8a0b43d..6e0bf8b 100644 --- a/gtk-app.c +++ b/gtk-app.c @@ -269,29 +269,6 @@ set_up_window(GMainLoop *loop, GtkWidget *window, int screen_no){ } -static GOptionEntry entries[] = -{ - { "fake-source", 0, 0, G_OPTION_ARG_NONE, &option_fake, - "use videotestsrc, not v4l2src (mostly won't work)", NULL }, - { "full-screen", 'f', 0, G_OPTION_ARG_NONE, &option_fullscreen, "run full screen", NULL }, - { "fps", 'p', 0, G_OPTION_ARG_INT, &option_fps, "speed (Frames per second)", "FPS" }, - { "screens", 's', 0, G_OPTION_ARG_INT, &option_screens, "Use this many screens", "S" }, - { "first-screen", 0, 0, G_OPTION_ARG_INT, &option_first_screen, "Start with this screen", "S" }, - { "debug", 'd', 0, G_OPTION_ARG_INT, &option_debug, "Save screen's debug images in /tmp", "SCREEN" }, - { "timer", 't', 0, G_OPTION_ARG_INT, &option_timer, "Log frame times in /tmp/timer.log", "SCREEN" }, - { "serial-calibration", 'c', 0, G_OPTION_ARG_NONE, &option_serial, - "calibrate projections one at a time, not together", NULL }, - { "reload", 'r', 0, G_OPTION_ARG_FILENAME_ARRAY, &option_reload, - "load calibration data from FILE (one per screen)", "FILE" }, - { "save", 'S', 0, G_OPTION_ARG_FILENAME_ARRAY, &option_save, - "save calibration data to FILE (one per screen)", "FILE" }, - { "avi", 'a', 0, G_OPTION_ARG_FILENAME, &option_avi, - "save mjpeg video to FILE", "FILE" }, - // { "overlay", 'o', 0, G_OPTION_ARG_NONE, &option_overlay, "Use some kind of overlay", NULL }, - { NULL, 0, 0, 0, NULL, NULL, NULL } -}; - - gint main (gint argc, gchar *argv[]) { //initialise threads before any gtk stuff (because not using gtk_init) diff --git a/gtk-app.h b/gtk-app.h index a169680..982d74f 100644 --- a/gtk-app.h +++ b/gtk-app.h @@ -2,6 +2,9 @@ #define HEIGHT 600 //#define FPS 20 +#define QUOTE_(x) #x +#define QUOTE(x) QUOTE_(x) + static gboolean option_fake = FALSE; static gboolean option_fullscreen = FALSE; static gint option_debug = -1; @@ -18,6 +21,31 @@ static char *option_avi = NULL; #define MAX_SCREENS 2 +static GOptionEntry entries[] = +{ + { "fake-source", 0, 0, G_OPTION_ARG_NONE, &option_fake, + "use videotestsrc, not v4l2src (mostly won't work)", NULL }, + { "full-screen", 'f', 0, G_OPTION_ARG_NONE, &option_fullscreen, "run full screen", NULL }, + { "fps", 'p', 0, G_OPTION_ARG_INT, &option_fps, + "speed (Frames per second, multiple of 5 <= 30)", "FPS" }, + { "screens", 's', 0, G_OPTION_ARG_INT, &option_screens, "Use this many screens, (max " + QUOTE(MAX_SCREENS) ")", "S" }, + { "first-screen", 0, 0, G_OPTION_ARG_INT, &option_first_screen, "Start with this screen", "S" }, + { "debug", 'd', 0, G_OPTION_ARG_INT, &option_debug, "Save screen's debug images in /tmp", "SCREEN" }, + { "timer", 't', 0, G_OPTION_ARG_INT, &option_timer, "Log frame times in /tmp/timer.log", "SCREEN" }, + { "serial-calibration", 'c', 0, G_OPTION_ARG_NONE, &option_serial, + "calibrate projections one at a time, not together", NULL }, + { "reload", 'r', 0, G_OPTION_ARG_FILENAME_ARRAY, &option_reload, + "load calibration data from FILE (one per screen)", "FILE" }, + { "save", 'S', 0, G_OPTION_ARG_FILENAME_ARRAY, &option_save, + "save calibration data to FILE (one per screen)", "FILE" }, + { "avi", 'a', 0, G_OPTION_ARG_FILENAME, &option_avi, + "save mjpeg video to FILE", "FILE" }, + // { "overlay", 'o', 0, G_OPTION_ARG_NONE, &option_overlay, "Use some kind of overlay", NULL }, + { NULL, 0, 0, 0, NULL, NULL, NULL } +}; + + typedef struct windows_s { int realised; int requested; -- 2.11.4.GIT