int main(int argc, char **argv) { struct options_st opt = { 0, 0, 0, 0, NULL, 1 }; #ifdef DEBUG dbg_init(); #endif process_options(argc, argv, &opt); setverbosity(opt.verbose); #ifdef DEBUG dbg_setdebug(opt.debug); char *subsys[] = { "default", "gui", "opengl", "world", NULL }; dbg_msetsubsysnames(subsys); if (opt.mdebug != NULL) dbg_parsearg(opt.mdebug); #endif gui_init(opt.width, opt.height, opt.fullscreen); gui_loop(); gui_finish(); }
int main() { pixbuf_t *icon1 = parse_png("/usr/share/icons/browser48.png"); pixbuf_t *icon2 = parse_png("/usr/share/icons/edit48.png"); pixbuf_t *icon3 = parse_png("/usr/share/icons/qonsole48.png"); pixbuf_t *icon4 = parse_png("/usr/share/icons/cpanel48.png"); pixbuf_t *icon5 = parse_png("/usr/share/icons/poweroff48.png"); window_t *win; iconview_t *iconview; /* allocate a window */ win = window_alloc("Quafios Launcher", /* title */ 465, /* width */ 100, /* height */ -2, /* x (center) */ -2, /* y (center) */ 0xFFC0C0C0, /* bg color */ "/usr/share/icons/launcher16.png" /* iconfile */); /* allocate iconview */ iconview = iconview_alloc(5, 48, 48, win->pixbuf->width, win->pixbuf->height, 0); /* insert iconview */ window_insert(win, iconview, 0, 0); /* insert icons */ iconview_insert(iconview, icon1, "Home"); iconview_insert(iconview, icon2, "Editor"); iconview_insert(iconview, icon3, "Qonsole"); iconview_insert(iconview, icon4, "Settings"); iconview_insert(iconview, icon5, "Turn off"); /* initialize events */ iconview->double_click = launch; /* redraw on the window */ iconview_redraw(iconview); /* loop */ gui_loop(); /* done */ return 0; }
int main(void) { gui *g; widget *w, *c1, *c2, *l, *plot, *tl; int tlcol; g = gui_init(); c1 = new_container(g, VERTICAL); c2 = new_container(g, HORIZONTAL); l = new_label(g, "this is a good label"); widget_add_child(g, c2, l, 0); l = new_label(g, "this is another good label"); widget_add_child(g, c2, l, -1); l = new_label(g, "OH! WHAT A LABEL!"); widget_add_child(g, c1, l, -1); widget_add_child(g, c1, c2, 0); plot = new_xy_plot(g, 100, 100, "xy plot test", 30); #if 0 c2 = new_container(g, HORIZONTAL); widget_add_child(g, c2, plot, -1); widget_add_child(g, c1, c2, -1); #else widget_add_child(g, c1, plot, -1); #endif tlcol = new_color(g, "#ddf"); tl = new_textlist(g, 300, 10, tlcol); widget_add_child(g, c1, tl, -1); textlist_add(g, tl, "hello", -1, FOREGROUND_COLOR); textlist_add(g, tl, "world", -1, FOREGROUND_COLOR); w = new_toplevel_window(g, 500, 400, "test window"); widget_add_child(g, w, c1, 0); gui_loop(g); return 0; }
int main(int argc, char **argv) { command_switch(argc, argv); signal(SIGQUIT, sighandler); signal(SIGTERM, sighandler); signal(SIGINT, sighandler); /* 初始化 OXIM */ oxim_init(); gui_init(&oxim_core); xim_init(&oxim_core); ReloadPanel(&oxim_core); gui_loop(&oxim_core); return 0; }
NOEXPORT void WINAPI service_main(DWORD argc, LPTSTR* argv) { (void)argc; /* squash the unused parameter warning */ (void)argv; /* squash the unused parameter warning */ tls_alloc(NULL, NULL, "service"); /* new thread-local storage */ /* initialise service status */ serviceStatus.dwServiceType=SERVICE_WIN32; serviceStatus.dwCurrentState=SERVICE_STOPPED; serviceStatus.dwControlsAccepted=0; serviceStatus.dwWin32ExitCode=NO_ERROR; serviceStatus.dwServiceSpecificExitCode=NO_ERROR; serviceStatus.dwCheckPoint=0; serviceStatus.dwWaitHint=0; serviceStatusHandle= RegisterServiceCtrlHandler(SERVICE_NAME, control_handler); if(serviceStatusHandle) { /* service is starting */ serviceStatus.dwCurrentState=SERVICE_START_PENDING; SetServiceStatus(serviceStatusHandle, &serviceStatus); /* running */ serviceStatus.dwControlsAccepted|= (SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN); serviceStatus.dwCurrentState=SERVICE_RUNNING; SetServiceStatus(serviceStatusHandle, &serviceStatus); gui_loop(); /* service was stopped */ serviceStatus.dwCurrentState=SERVICE_STOP_PENDING; SetServiceStatus(serviceStatusHandle, &serviceStatus); /* service is now stopped */ serviceStatus.dwControlsAccepted&= (DWORD)~(SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN); serviceStatus.dwCurrentState=SERVICE_STOPPED; SetServiceStatus(serviceStatusHandle, &serviceStatus); } }
int main(int argc, char **argv) #endif { if (gui_init(argc, argv) != 0) return -1; gui_signal_connect("on_menulist_clicked" , on_menulist_clicked); gui_signal_connect("on_setlanguage_clicked", on_setlanguage_clicked); gui_signal_connect("on_MainWindow_keypress", on_MainWindow_keypress); #ifndef WIN32 if (argc > 1) i18n_set_language(argv[1]); else #endif i18n_set_language("chinese"); gui_loop(); gui_release(); return 0; }
int main() { /* initialize the font */ font_init(); /* initialize timer */ timer_init(); /* allocate a window */ win = window_alloc("Qonsole", /* title */ font_width*80, /* width */ font_height*25, /* height */ -1, /* x (random) */ -1, /* y (random) */ 0xFF000000, /* bg color */ "/usr/share/icons/qonsole16.png" /* iconfile */); /* initialize window event handlers */ win->press = pstty_press; /* initialize pstty */ pstty_init(); /* execute the shell */ exec_shell("/bin/rash"); /* set receiver */ set_receiver(pstty_event); /* loop */ gui_loop(); /* done */ return 0; }
static void *gui_thread(void *_g) { gui *g = _g; gui_loop(g); return NULL; }
static void *gui_thread(void *g) { gui_loop(g); exit(0); }
int WINAPI WinMain(HINSTANCE this_instance, HINSTANCE prev_instance, #ifdef _WIN32_WCE LPWSTR lpCmdLine, #else LPSTR lpCmdLine, #endif int nCmdShow) { TCHAR stunnel_exe_path[MAX_PATH]; LPTSTR c; #ifndef _WIN32_WCE LPTSTR errmsg; #endif (void)prev_instance; /* squash the unused parameter warning */ (void)lpCmdLine; /* squash the unused parameter warning */ (void)nCmdShow; /* squash the unused parameter warning */ tls_init(); /* initialize thread-local storage */ ghInst=this_instance; gui_cmdline(); /* setup global cmdline structure */ GetModuleFileName(0, stunnel_exe_path, MAX_PATH); #ifndef _WIN32_WCE /* find previous instances of the same executable */ if(!cmdline.service && !cmdline.install && !cmdline.uninstall && !cmdline.reload && !cmdline.reopen && !cmdline.start && !cmdline.stop) { EnumWindows(enum_windows, (LPARAM)stunnel_exe_path); if(cmdline.exit) return 1; /* in case EnumWindows didn't find a previous instance */ } #endif /* set current working directory and engine path */ c=_tcsrchr(stunnel_exe_path, TEXT('\\')); /* last backslash */ if(c) { /* found */ *c=TEXT('\0'); /* truncate the program name */ c=_tcsrchr(stunnel_exe_path, TEXT('\\')); /* previous backslash */ if(c && !_tcscmp(c+1, TEXT("bin"))) *c=TEXT('\0'); /* truncate "bin" */ } #ifndef _WIN32_WCE if(!SetCurrentDirectory(stunnel_exe_path)) { errmsg=str_tprintf(TEXT("Cannot set directory to %s"), stunnel_exe_path); message_box(errmsg, MB_ICONERROR); str_free(errmsg); return 1; } /* try to enter the "config" subdirectory, ignore the result */ SetCurrentDirectory(TEXT("config")); #endif _tputenv(str_tprintf(TEXT("OPENSSL_ENGINES=%s\\engines"), stunnel_exe_path)); if(initialize_winsock()) return 1; #ifndef _WIN32_WCE if(cmdline.service) /* "-service" must be processed before "-install" */ return service_initialize(); if(cmdline.install) return service_install(); if(cmdline.uninstall) return service_uninstall(); if(cmdline.start) return service_start(); if(cmdline.stop) return service_stop(); if(cmdline.reload) return service_user(SIGNAL_RELOAD_CONFIG); if(cmdline.reopen) return service_user(SIGNAL_REOPEN_LOG); #endif return gui_loop(); }
int WINAPI WinMain(HINSTANCE this_instance, HINSTANCE prev_instance, #ifdef _WIN32_WCE LPWSTR lpCmdLine, #else LPSTR lpCmdLine, #endif int nCmdShow) { LPSTR command_line; char *c, stunnel_exe_path[MAX_PATH]; #ifndef _WIN32_WCE char *errmsg; #endif (void)prev_instance; /* skip warning about unused parameter */ (void)nCmdShow; /* skip warning about unused parameter */ str_init(); /* initialize per-thread string management */ ghInst=this_instance; #ifdef _WIN32_WCE command_line=tstr2str(lpCmdLine); #else command_line=lpCmdLine; #endif parse_cmdline(command_line); /* setup global cmdline structure */ GetModuleFileName(0, stunnel_exe_path, MAX_PATH); #ifndef _WIN32_WCE /* find previous instances of the same executable */ if(!cmdline.service && !cmdline.install && !cmdline.uninstall && !cmdline.start && !cmdline.stop) { EnumWindows(enum_windows, (LPARAM)stunnel_exe_path); if(cmdline.exit) return 0; /* in case EnumWindows didn't find a previous instance */ } #endif /* set current working directory and engine path */ c=strrchr(stunnel_exe_path, '\\'); /* last backslash */ if(c) /* found */ c[1]='\0'; /* truncate program name */ #ifndef _WIN32_WCE if(!SetCurrentDirectory(stunnel_exe_path)) { errmsg=str_printf("Cannot set directory to %s", stunnel_exe_path); message_box(errmsg, MB_ICONERROR); str_free(errmsg); return 1; } #endif _putenv_s("OPENSSL_ENGINES", stunnel_exe_path); if(initialize_winsock()) return 1; #ifndef _WIN32_WCE if(cmdline.service) /* "-service" must be processed before "-install" */ return service_initialize(); if(cmdline.install) return service_install(command_line); if(cmdline.uninstall) return service_uninstall(); if(cmdline.start) return service_start(); if(cmdline.stop) return service_stop(); #endif return gui_loop(); }