void window_action(Task* tsk, int action) { if (!tsk) return; int desk; switch (action) { case CLOSE: set_close(tsk->win); break; case TOGGLE: set_active(tsk->win); break; case ICONIFY: XIconifyWindow(server.dsp, tsk->win, server.screen); break; case TOGGLE_ICONIFY: if (task_active && tsk->win == task_active->win) XIconifyWindow(server.dsp, tsk->win, server.screen); else set_active(tsk->win); break; case SHADE: window_toggle_shade(tsk->win); break; case MAXIMIZE_RESTORE: window_maximize_restore(tsk->win); break; case MAXIMIZE: window_maximize_restore(tsk->win); break; case RESTORE: window_maximize_restore(tsk->win); break; case DESKTOP_LEFT: if (tsk->desktop == 0) break; desk = tsk->desktop - 1; windows_set_desktop(tsk->win, desk); if (desk == server.desktop) set_active(tsk->win); break; case DESKTOP_RIGHT: if (tsk->desktop == (uint32_t)server.nb_desktop) break; desk = tsk->desktop + 1; windows_set_desktop(tsk->win, desk); if (desk == server.desktop) set_active(tsk->win); break; case NEXT_TASK: { Task* tsk1; tsk1 = next_task(find_active_task(tsk, task_active)); set_active(tsk1->win); } break; case PREV_TASK: { Task* tsk1; tsk1 = prev_task(find_active_task(tsk, task_active)); set_active(tsk1->win); } } }
/* start a cli with <name> as a prompt, and optionally run the <initscript> file */ void enter_cli(const char *name, const char *initscript) { global_logfp = NULL; //progname = name; //we use the supplied *name instead. readline_init(); set_init(); if (initscript != NULL) { int rv=command_file(initscript); switch (rv) { case CMD_OK: /* script was succesful, start a normal CLI afterwards */ break; case CMD_FAILED: printf("Problem with file %s\n", initscript); // fallthrough, yes default: case CMD_EXIT: set_close(); return; } } else { /* print banner only if running without an initscript */ printf("%s: %s version %s\n", name, projname, PACKAGE_VERSION); printf("%s: Type HELP for a list of commands\n", name); printf("%s: Type SCAN to start ODBII Scan\n", name); printf("%s: Then use MONITOR to monitor real-time data\n", name); printf("%s: **** IMPORTANT : this is beta software ! Use at your own risk.\n", name); printf("%s: **** Remember, \"debug all -1\" displays all debugging info.\n", name); } if (rc_file() != CMD_EXIT) { printf("\n"); /* And go start CLI */ instream = stdin; (void)do_cli(root_cmd_table, name, 0, NULL); } set_close(); }