Commit d3997824 authored by Cedric Roux's avatar Cedric Roux

add option -no-gui to disable GUI entirely for textlog

(no more event selector)
parent 23ec84ef
...@@ -60,7 +60,8 @@ void usage(void) ...@@ -60,7 +60,8 @@ void usage(void)
" by default, all is off\n" " by default, all is off\n"
" -p <port> use given port (default %d)\n" " -p <port> use given port (default %d)\n"
" -x GUI output\n" " -x GUI output\n"
" -debug-gui active GUI debug logs\n", " -debug-gui activate GUI debug logs\n"
" -no-gui disable GUI entirely\n",
DEFAULT_REMOTE_PORT DEFAULT_REMOTE_PORT
); );
exit(1); exit(1);
...@@ -121,6 +122,7 @@ int main(int n, char **v) ...@@ -121,6 +122,7 @@ int main(int n, char **v)
gui *g; gui *g;
int gui_mode = 0; int gui_mode = 0;
view *out; view *out;
int gui_active = 1;
on_off_name = malloc(n * sizeof(char *)); if (on_off_name == NULL) abort(); on_off_name = malloc(n * sizeof(char *)); if (on_off_name == NULL) abort();
on_off_action = malloc(n * sizeof(int)); if (on_off_action == NULL) abort(); on_off_action = malloc(n * sizeof(int)); if (on_off_action == NULL) abort();
...@@ -141,9 +143,12 @@ int main(int n, char **v) ...@@ -141,9 +143,12 @@ int main(int n, char **v)
{ on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=0; continue; } { on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=0; continue; }
if (!strcmp(v[i], "-x")) { gui_mode = 1; continue; } if (!strcmp(v[i], "-x")) { gui_mode = 1; continue; }
if (!strcmp(v[i], "-debug-gui")) { gui_logd = 1; continue; } if (!strcmp(v[i], "-debug-gui")) { gui_logd = 1; continue; }
if (!strcmp(v[i], "-no-gui")) { gui_active = 0; continue; }
usage(); usage();
} }
if (gui_active == 0) gui_mode = 0;
if (database_filename == NULL) { if (database_filename == NULL) {
printf("ERROR: provide a database file (-d)\n"); printf("ERROR: provide a database file (-d)\n");
exit(1); exit(1);
...@@ -157,8 +162,10 @@ int main(int n, char **v) ...@@ -157,8 +162,10 @@ int main(int n, char **v)
h = new_handler(database); h = new_handler(database);
if (gui_active) {
g = gui_init(); g = gui_init();
new_thread(gui_thread, g); new_thread(gui_thread, g);
}
if (gui_mode) { if (gui_mode) {
widget *w, *win; widget *w, *win;
...@@ -198,6 +205,7 @@ int main(int n, char **v) ...@@ -198,6 +205,7 @@ int main(int n, char **v)
if (is_on[l]) if (is_on[l])
if (write(s, &l, sizeof(int)) != sizeof(int)) abort(); if (write(s, &l, sizeof(int)) != sizeof(int)) abort();
if (gui_active)
setup_event_selector(g, database, s, is_on); setup_event_selector(g, database, s, is_on);
/* read messages */ /* read messages */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment