/*********************************************************************** * process_attach */ static BOOL process_attach(void) { SessionAttributeBits attributes; OSStatus status; status = SessionGetInfo(callerSecuritySession, NULL, &attributes); if (status != noErr || !(attributes & sessionHasGraphicAccess)) return FALSE; setup_options(); if ((thread_data_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE; macdrv_err_on = ERR_ON(macdrv); if (macdrv_start_cocoa_app(GetTickCount64())) { ERR("Failed to start Cocoa app main loop\n"); return FALSE; } set_app_icon(); macdrv_clipboard_process_attach(); return TRUE; }
int main(int argc, char *argv[]) { printf("mpflow - Copyright (C) 2009 Walter de Jong <*****@*****.**>\n"); get_options(argc, argv); if (lock_program() == -1) { printf("another instance of mpflow is already running\n"); return 1; } init_mpd(); /* init app */ SDK_init(); create_window(); set_app_icon(); init_gl(); draw_startup(); /* only a border */ /* note that the order of init_() functions here is important (!) */ init_textures(); init_text(); init_covers(); init_events(); init_widget_covers(); init_widget_about(); init_widget_aboutbutton(); init_widget_titlebar(); main_widget = &w_titlebar; prepare_widgets(); draw(); for(;;) { SDK_handle_events(); move_covers(); if (!moving) SDL_WaitEvent(NULL); else SDK_sleep(FRAME_DELAY); } exit_program(0); return 0; }
/****************************************************************************** * MAIN function ******************************************************************************/ int main ( int argc, char **argv ) { trace_main = TRACE_MAIN; XtAppContext app; m_init(); XtSetLanguageProc (NULL, NULL, NULL); XawInitializeWidgetSet(); /* -- Intialize Toolkit creating the application shell */ Widget appShell = XtOpenApplication (&app, APP_NAME, /* resources: can be set from argv */ options, XtNumber(options), &argc, argv, fallback_resources, sessionShellWidgetClass, NULL, 0 ); load_icon(XtDisplay(appShell)); // load_icon_default(); /* -- Enable Editres support */ XtAddEventHandler(appShell, (EventMask) 0, True, _XEditResCheckMessages, NULL); XtAddCallback( appShell, XtNdieCallback, quit_cb, NULL ); /* -- not parsed options are removed by XtOpenApplication the only entry left should be the program name */ if (argc != 1) { m_destruct(); syntax(); exit(1); } TopLevel = appShell; /* -- Register all application specific callbacks and widget classes */ RegisterApplication ( appShell ); /* -- Register all Athena and Public widget classes, CBs, ACTs */ XpRegisterAll ( app ); /* -- Create widget tree below toplevel shell using Xrm database */ WcWidgetCreation ( appShell ); /* -- Get application resources and widget ptrs */ XtGetApplicationResources( appShell, (XtPointer)&CWRI, CWRI_CONFIG_RES, XtNumber(CWRI_CONFIG_RES), (ArgList)0, 0 ); InitializeApplication(appShell); /* -- Realize the widget tree and enter the main application loop */ XtRealizeWidget ( appShell ); /* -- Set Icon for Window */ set_app_icon(appShell); grab_window_quit( appShell ); XtAppMainLoop ( app ); /* use XtAppSetExitFlag */ XtDestroyWidget(appShell); m_destruct(); return EXIT_SUCCESS; }