int amiga_init(void) { printf("UAE: Initializing core derived from %s\n", UAE_BASE_VERSION); write_log("UAE: Initializing core derived from %s\n", UAE_BASE_VERSION); uae_register_main_thread(); uae_time_init(); /* #ifdef DEBUG_SYNC g_sync_debug_file = fopen("sync.log", "wb"); #endif */ // clock sync base is 1000000 (microseconds) syncbase = 1000000; // clock sync base is 10000 (tenths of milliseconds) //syncbase = 10000; filesys_host_init(); romlist_init(); clipboard_init(); return 1; }
void gnm_init (void) { static gboolean inited = FALSE; if (inited) return; inited = TRUE; libgoffice_init (); _gnm_register_resource (); if (gdk_screen_get_default ()) { /* Only when we have a gui. */ gtk_icon_theme_add_resource_path (gtk_icon_theme_get_default (), "/org/gnumeric/gnumeric/icons"); } gnm_register_ui_files (); go_plugin_service_define ("function_group", &gnm_plugin_service_function_group_get_type); go_plugin_service_define ("ui", &gnm_plugin_service_ui_get_type); go_plugin_service_define ("solver", &gnm_plugin_service_solver_get_type); go_plugin_loader_module_register_version ("gnumeric", GNM_VERSION_FULL); g_object_new (GNM_APP_TYPE, NULL); mathfunc_init (); gnm_style_init (); gnm_conf_init (); gnm_color_init (); gnm_font_init (); /* requires config */ value_init (); parse_util_init (); _gnm_expr_init (); gnm_sheet_cell_init (); clipboard_init (); dependent_types_init (); gnm_rendered_value_init (); functions_init (); print_init (); gnm_autofill_init (); sheet_objects_init (); _gnm_hlink_init (); /* The statically linked in file formats */ gnm_xml_sax_read_init (); gnm_xml_sax_write_init (); stf_init (); /* Make sure that images will be displayed with the correct resolution, see #628472 */ go_image_set_default_dpi (gnm_app_display_dpi_get (TRUE), gnm_app_display_dpi_get (FALSE)); }
int main (int argc, const char **argv) { #ifdef WIN32 { // set the console to accept escape sequences (Win10+) HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); if (console != INVALID_HANDLE_VALUE) { DWORD consoleMode = 0; GetConsoleMode(console, &consoleMode); consoleMode |= 4; // ENABLE_VIRTUAL_TERMINAL_PROCESSING; but that isn't available in our current SDK target SetConsoleMode(console, consoleMode); } } #endif int exit_code = EXIT_SUCCESS; try { // Experiment with floating point masks. // #ifdef FE_NOMASK_ENV // feenableexcept(FE_INVALID); // feenableexcept(FE_DIVBYZERO | FE_INVALID); // #endif bgl = new BackgroundLoader(); size_t winid = gfx_init(cb); debug_drawer = new BulletDebugDrawer(ogre_sm); // FIXME: hack #ifdef WIN32 mouse = new MouseDirectInput8(winid); bool use_dinput = getenv("GRIT_DINPUT")!=NULL; keyboard = use_dinput ? (Keyboard *)new KeyboardDirectInput8(winid) : (Keyboard *)new KeyboardWinAPI(winid); #else mouse = new MouseX11(winid); keyboard = new KeyboardX11(winid); #endif clipboard_init(); physics_init(); net_init(); core_option_init(); streamer_init(); navigation_init(); // audio_init(getenv("GRIT_AUDIO_DEV")); audio_init(NULL); std::vector<std::string> args; for (int i=0 ; i<argc ; i++) { args.push_back(argv[i]); } try { const char *init_file = getenv("GRIT_INIT"); if (init_file == nullptr) init_file = "/system/init.lua"; init_lua(init_file, args, core_L); } catch (Exception &e) { CERR << "Fatal error: " << e << std::endl; exit_code = EXIT_FAILURE; } // Lua returns - we quit. CVERB << "Shutting down Lua net subsystem..." << std::endl; net_shutdown(core_L); navigation_shutdown(); object_all_del(core_L); // Will remove all demands from background loader. CVERB << "Shutting down Lua graphics subsystem..." << std::endl; gfx_shutdown_lua(core_L); CVERB << "Shutting down Background Loader..." << std::endl; bgl->shutdown(); CVERB << "Shutting down Mouse & Keyboard..." << std::endl; if (mouse) delete mouse; if (keyboard) delete keyboard; CVERB << "Shutting down clipboard..." << std::endl; clipboard_shutdown(); CVERB << "Shutting down Lua VM..." << std::endl; if (core_L) shutdown_lua(core_L); CVERB << "Shutting down audio subsystem..." << std::endl; audio_shutdown(); //close AL device CVERB << "Shutting down physics subsystem..." << std::endl; physics_shutdown(); CVERB << "Shutting down the physics debug drawer..." << std::endl; if (debug_drawer) delete debug_drawer; CVERB << "Shutting down the Graphics subsystem..." << std::endl; gfx_shutdown(); delete bgl; } catch (Exception &e) { std::cerr << "TOP LEVEL ERROR: " << e << std::endl; return EXIT_FAILURE; } return exit_code; }
void *thread_Xvent_process (void * arg) { Window root_windows; XEvent ev; primary_atom = XInternAtom(display, "PRIMARY", False); clipboard_atom = XInternAtom(display, "CLIPBOARD", False); targets_atom = XInternAtom(display, "TARGETS", False); timestamp_atom = XInternAtom(display, "TIMESTAMP", False); format_string_atom = XInternAtom(display, "STRING", False); format_utf8_string_atom = XInternAtom(display, "UTF8_STRING", False); format_unicode_atom = XInternAtom(display, "text/unicode", False); format_file_gnome_atom = XInternAtom(display, "x-special/gnome-copied-files", False); format_file_text_uri_list_atom = XInternAtom(display, "text/uri-list", False); xrdp_clipboard = XInternAtom(display,"XRDP_CLIPBOARD", False); clipboard_init(&clipboard, 3); clipboard_add_format_support(&clipboard, format_utf8_string_atom); clipboard_add_format_support(&clipboard, format_file_gnome_atom); clipboard_add_format_support(&clipboard, format_file_text_uri_list_atom); root_windows = DefaultRootWindow(display); log_message(l_config, LOG_LEVEL_DEBUG, "cliprdr[thread_Xvent_process]: " "Windows root ID : %i", (int)root_windows); wclip = XCreateSimpleWindow(display, root_windows,1,1,1,1,1,1,0); XSelectInput(display, wclip, PropertyChangeMask); log_message(l_config, LOG_LEVEL_DEBUG, "cliprdr[thread_Xvent_process]: " "Begin the event loop "); while (running) { XNextEvent (display, &ev); switch (ev.type) { case SelectionClear : log_message(l_config, LOG_LEVEL_DEBUG, "cliprdr[thread_Xvent_process]: " "XSelectionClearEvent"); cliprdr_clear_selection(&ev); break; case SelectionRequest : log_message(l_config, LOG_LEVEL_DEBUG, "cliprdr[thread_Xvent_process]: " "XSelectionRequestEvent"); cliprdr_process_selection_request(&ev); break; case SelectionNotify : log_message(l_config, LOG_LEVEL_DEBUG, "cliprdr[thread_Xvent_process]: " "SelectionNotify"); cliprdr_get_clipboard(&ev); break; case ClientMessage: break; default: log_message(l_config, LOG_LEVEL_DEBUG, "cliprdr[thread_Xvent_process]: " "event type : %i", ev.type); break; } } clipboard_release(&clipboard); pthread_exit (0); }
/* returns error */ static int APP_CC process_message_channel_setup(struct stream *s) { int num_chans; int index; int rv; struct chan_item *ci; g_num_chan_items = 0; g_cliprdr_index = -1; g_rdpsnd_index = -1; g_rdpdr_index = -1; g_rail_index = -1; g_cliprdr_chan_id = -1; g_rdpsnd_chan_id = -1; g_rdpdr_chan_id = -1; g_rail_chan_id = -1; g_drdynvc_chan_id = -1; LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup:")); in_uint16_le(s, num_chans); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: num_chans %d", num_chans)); for (index = 0; index < num_chans; index++) { ci = &(g_chan_items[g_num_chan_items]); g_memset(ci->name, 0, sizeof(ci->name)); in_uint8a(s, ci->name, 8); in_uint16_le(s, ci->id); in_uint16_le(s, ci->flags); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags)); g_writeln("process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags); if (g_strcasecmp(ci->name, "cliprdr") == 0) { g_cliprdr_index = g_num_chan_items; g_cliprdr_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpsnd") == 0) { g_rdpsnd_index = g_num_chan_items; g_rdpsnd_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpdr") == 0) { g_rdpdr_index = g_num_chan_items; g_rdpdr_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rail") == 0) { g_rail_index = g_num_chan_items; g_rail_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "drdynvc") == 0) { g_drdynvc_index = g_num_chan_items; // LK_TODO use this g_drdynvc_chan_id = ci->id; // LK_TODO use this } else { LOG(10, ("other %s", ci->name)); } g_num_chan_items++; } rv = send_channel_setup_response_message(); if (g_cliprdr_index >= 0) { clipboard_init(); fuse_init(); } if (g_rdpsnd_index >= 0) { sound_init(); } if (g_rdpdr_index >= 0) { dev_redir_init(); } if (g_rail_index >= 0) { rail_init(); } if (g_drdynvc_index >= 0) { g_memset(&g_dvc_channels[0], 0, sizeof(g_dvc_channels)); drdynvc_init(); } return rv; }
/* returns error */ static int APP_CC process_message_channel_setup(struct stream *s) { int num_chans; int index; int rv; struct chan_item *ci; struct chan_out_data *cod; struct chan_out_data *old_cod; g_num_chan_items = 0; g_cliprdr_index = -1; g_rdpsnd_index = -1; g_rdpdr_index = -1; g_rail_index = -1; g_cliprdr_chan_id = -1; g_rdpsnd_chan_id = -1; g_rdpdr_chan_id = -1; g_rail_chan_id = -1; g_drdynvc_chan_id = -1; LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup:")); in_uint16_le(s, num_chans); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: num_chans %d", num_chans)); for (index = 0; index < num_chans; index++) { ci = &(g_chan_items[g_num_chan_items]); g_memset(ci->name, 0, sizeof(ci->name)); in_uint8a(s, ci->name, 8); in_uint16_le(s, ci->id); /* there might be leftover data from last session after reconnecting so free it */ if (ci->head != 0) { cod = ci->head; while (1) { free_stream(cod->s); old_cod = cod; cod = cod->next; g_free(old_cod); if (ci->tail == old_cod) { break; } } } ci->head = 0; ci->tail = 0; in_uint16_le(s, ci->flags); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags)); g_writeln("process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags); if (g_strcasecmp(ci->name, "cliprdr") == 0) { g_cliprdr_index = g_num_chan_items; g_cliprdr_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpsnd") == 0) { g_rdpsnd_index = g_num_chan_items; g_rdpsnd_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpdr") == 0) { g_rdpdr_index = g_num_chan_items; g_rdpdr_chan_id = ci->id; } /* disabled for now */ else if (g_strcasecmp(ci->name, "rail") == 0) { g_rail_index = g_num_chan_items; g_rail_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "drdynvc") == 0) { g_drdynvc_index = g_num_chan_items; // LK_TODO use this g_drdynvc_chan_id = ci->id; // LK_TODO use this } else { LOG(10, ("other %s", ci->name)); } g_num_chan_items++; } rv = send_channel_setup_response_message(); if (g_cliprdr_index >= 0) { clipboard_init(); xfuse_init(); } if (g_rdpsnd_index >= 0) { sound_init(); } if (g_rdpdr_index >= 0) { dev_redir_init(); xfuse_init(); } if (g_rail_index >= 0) { rail_init(); } if (g_drdynvc_index >= 0) { g_memset(&g_dvc_channels[0], 0, sizeof(g_dvc_channels)); drdynvc_init(); } return rv; }