#include <glib.h>
#include <stdio.h>

typedef struct {
	int     vertical_split;
	int     mouse_follow;
	int     cursor_size;
	guint32 cursor_color;
	float   cursor_scale_factor;
} str;

static str globals = { 
			   0.0,
			   0.0,
			   0.0,
			   0.0,
			   0.0
};

static GOptionEntry entries[] = 
{
	{"vertical", 'v', 0, G_OPTION_ARG_NONE, &globals.vertical_split, "split screen vertically (if target display = source display)", NULL},
{"mouse-follow", 'm', 0, G_OPTION_ARG_NONE, &globals.mouse_follow, "track mouse movements", NULL},
	{"cursor-size", 0, 0, G_OPTION_ARG_INT, &globals.cursor_size, "cursor size to use (overrides cursor-scale-factor)", NULL},
	{"cursor-color", 0, 0, G_OPTION_ARG_INT64, &globals.cursor_color, "cursor color (applied to \'black\' pixels", NULL},
	{"cursor-scale-factor", 0, 0, G_OPTION_ARG_DOUBLE, &globals.cursor_scale_factor, "cursor scale factor", NULL},
  { NULL }
};

int 
main (int argc, char *argv[])
{
  GError *error = NULL;
  GOptionContext *context;

  context = g_option_context_new ("- test GOption");
  g_option_context_add_main_entries (context, entries, "main options");
  g_option_context_set_ignore_unknown_options (context, TRUE);
  //g_option_context_add_group (context, gtk_get_option_group (TRUE));
  int successful = g_option_context_parse (context, &argc, &argv, NULL);

   if (!successful) {
  	printf("DEBUG: == Parsing not successful ==\n");
  	printf("DEBUG: argv = %s \n", *argv);
  } 

  printf("DEBUG: -v is %i \n", globals.vertical_split);
  printf("DEBUG: -m is %i \n", globals.mouse_follow);
  printf("DEBUG: cursor_scale_factor = %f \n", globals.cursor_scale_factor);
  printf("DEBUG: cursor_size = %i \n", globals.cursor_size);
  printf("DEBUG: cursor_color = %i \n", globals.cursor_color);

  return 0;
}
