int main (int argc, char **argv) { if (argc == 2 && 0 == g_strcmp0(argv[1], "-d")) g_setenv("G_MESSAGES_DEBUG", "all", FALSE); if (is_livecd()){ dde_session_register(); return 0; } if (is_application_running("com.deepin.dde.guide")) { g_warning("another instance of application dde-guide is running...\n"); return 0; } else { singleton("com.deepin.dde.guide"); } init_i18n (); gtk_init (&argc, &argv); g_log_set_default_handler((GLogFunc)log_to_file, "dde-guide"); if (!guide_is_debug()){ struct DisplayInfo rect_screen; update_screen_info(&rect_screen); widget_move_by_rect(get_container(),rect_screen); listen_monitors_changed_signal(G_CALLBACK(monitors_changed_cb),NULL); } GtkWidget *webview = d_webview_new_with_uri (GET_HTML_PATH("guide")); gtk_container_add (GTK_CONTAINER(get_container()), GTK_WIDGET (webview)); g_signal_connect(webview, "draw", G_CALLBACK(erase_background), NULL); gtk_widget_realize (get_container()); gtk_widget_realize (webview); GdkWindow* gdkwindow = gtk_widget_get_window (get_container()); if (!guide_is_debug()) gdk_window_set_override_redirect (gdkwindow, TRUE); gtk_widget_show_all (get_container()); gtk_main (); return 0; }
int main(int argc, char* argv[]) { init_i18n(); gtk_init(&argc, &argv); GtkWidget* container = create_web_container(TRUE, TRUE); gtk_window_set_wmclass(GTK_WINDOW(container), "dde-launcher", "DDELauncher"); set_default_theme("Deepin"); set_desktop_env_name("GNOME"); GtkWidget *webview = d_webview_new_with_uri(GET_HTML_PATH("dominant_color")); gtk_container_add(GTK_CONTAINER(container), GTK_WIDGET(webview)); g_signal_connect (container , "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect(webview, "draw", G_CALLBACK(clear_bg), NULL); monitor_resource_file("dominant_color", webview); gtk_widget_show_all(container); gtk_main(); return 0; }
int main(int argc, char *argv[]) { fs_uae_argc = argc; fs_uae_argv = argv; fs_set_argv(argc, argv); #ifdef WITH_CEF cef_init(argc, argv); #endif char **arg; arg = argv + 1; while (arg && *arg) { if (strcmp(*arg, "--list-joysticks") == 0) { list_joysticks(); exit(0); } else if (strcmp(*arg, "--list-devices") == 0) { list_joysticks(); exit(0); } else if (strcmp(*arg, "--version") == 0) { printf("%s\n", PACKAGE_VERSION); exit(0); } else if (strcmp(*arg, "--help") == 0) { printf(COPYRIGHT_NOTICE, PACKAGE_VERSION, OS_NAME_2, ARCH_NAME_2); printf(EXTRA_HELP_TEXT); exit(0); } arg++; } fs_init(); int error = fs_data_init("fs-uae", "fs-uae.dat"); if (error) { printf("WARNING: error (%d) loading fs-uae.dat\n", error); } fs_set_prgname("fs-uae"); fs_set_application_name("Amiga Emulator"); amiga_set_log_function(log_to_libfsemu); //result = parse_options(argc, argv); printf(COPYRIGHT_NOTICE, PACKAGE_VERSION, OS_NAME_2, ARCH_NAME_2); fs_log(COPYRIGHT_NOTICE, PACKAGE_VERSION, OS_NAME_2, ARCH_NAME_2); char *current_dir = g_get_current_dir(); fs_log("current directory is %s\n", current_dir); g_free(current_dir); amiga_init(); #if 0 // FIXME: disabling fullscreen spaces must be done before // SDL_INIT_VIDEO, but we need to check config to see if this should // be done, and we initialize SDL early to check for config file // (catch 22)... // FIXME: check fullscreen_spaces option SDL_SetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, "0"); #endif #ifdef MACOSX SDL_Init(SDL_INIT_EVERYTHING); SDL_PumpEvents(); SDL_Event event; fs_log("OS X: Check for pending SDL_DROPFILE event\n"); while (SDL_PollEvent(&event)) { fs_log("Got SDL event 0x%x\n", event.type); if (event.type == SDL_DROPFILE) { if (event.drop.file != NULL) { g_fs_uae_config_file_path = strdup(event.drop.file); } SDL_free(event.drop.file); } } #endif // skip first entry arg = argv + 1; if (g_fs_uae_config_file_path == NULL) { while (arg && *arg) { const gchar *test_path = *arg; if (test_path && fs_path_exists(test_path)) { if (check_extension(test_path, ".fs-uae")) { g_fs_uae_config_file_path = g_strdup(test_path); } else if (check_extension(test_path, ".conf")) { g_fs_uae_config_file_path = g_strdup(test_path); } else if (check_extension(test_path, ".adf")) { g_fs_uae_disk_file_path = g_strdup(test_path); } else if (check_extension(test_path, ".ipf")) { g_fs_uae_disk_file_path = g_strdup(test_path); } else if (check_extension(test_path, ".dms")) { g_fs_uae_disk_file_path = g_strdup(test_path); } } arg++; } } /* Parse options first, in case base_dir, logging options etc is * specified on the command line. */ fs_config_parse_options(argc - 1, argv + 1); fs_log("\n"); fs_log(LOG_LINE); fs_log("libfsemu init\n"); fs_log(LOG_LINE); fs_log("\n"); fs_emu_path_set_expand_function(fs_uae_expand_path); fs_emu_init_overlays(overlay_names); fs_emu_init(); // then load the config file load_config_file(); init_i18n(); if (g_fs_uae_disk_file_path) { fs_config_set_string(OPTION_FLOPPY_DRIVE_0, g_fs_uae_disk_file_path); g_warn_about_missing_config_file = 0; } if (g_warn_about_missing_config_file) { fs_emu_warning(_("No configuration file was found")); } fs_log("\n"); fs_log(LOG_LINE); fs_log("fs-uae init\n"); fs_log(LOG_LINE); fs_log("\n"); configure_logging(fs_config_get_const_string("log")); fs_emu_set_state_check_function(amiga_get_state_checksum); fs_emu_set_rand_check_function(amiga_get_rand_checksum); // force creation of some recommended default directories fs_uae_kickstarts_dir(); fs_uae_configurations_dir(); fs_uae_init_path_resolver(); fs_uae_plugins_init(); // must be called early, before fs_emu_init -affects video output fs_uae_configure_amiga_model(); // force creation of state directories //fs_uae_flash_memory_dir(); //fs_uae_save_states_dir(); //fs_uae_floppy_overlays_dir(); fs_uae_state_dir(); const char *controllers_dir = fs_uae_controllers_dir(); if (controllers_dir) { fs_emu_set_controllers_dir(controllers_dir); } const char *logs_dir = fs_uae_logs_dir(); if (logs_dir) { char *log_file; log_file = g_build_filename(logs_dir, "FS-UAE.log", NULL); if (fs_path_exists(log_file)) { g_unlink(log_file); } g_free(log_file); log_file = g_build_filename(logs_dir, "FS-UAE.log.txt", NULL); if (fs_path_exists(log_file)) { g_unlink(log_file); } g_free(log_file); log_file = g_build_filename(logs_dir, "Emulator.log.txt", NULL); if (fs_path_exists(log_file)) { g_unlink(log_file); } g_free(log_file); log_file = g_build_filename(logs_dir, "fs-uae.log.txt", NULL); fs_config_set_log_file(log_file); g_free(log_file); } fs_config_set_string_if_unset("themes_dir", fs_uae_themes_dir()); fs_emu_set_pause_function(pause_function); //fs_uae_init_input(); fs_emu_init_2(FS_EMU_INIT_EVERYTHING); // we initialize the recording module either it is used or not, so it // can delete state-specific recordings (if necessary) when states are // saved fs_uae_init_recording(); int deterministic_mode = 0; const char* record_file = fs_config_get_const_string("record"); if (record_file) { fs_log("record file specified: %s, forcing deterministic mode\n", record_file); deterministic_mode = 1; fs_uae_enable_recording(record_file); } else { fs_log("not running in record mode\n"); } if (fs_emu_netplay_enabled() || fs_config_get_boolean(OPTION_DETERMINISTIC) == 1) { deterministic_mode = 1; } if (deterministic_mode) { amiga_set_deterministic_mode(); } if (logs_dir) { if (fs_emu_netplay_enabled()) { char *sync_log_file = g_build_filename(logs_dir, "Synchronization.log", NULL); amiga_set_synchronization_log_file(sync_log_file); free(sync_log_file); } } #ifdef FS_EMU_DRIVERS fs_emu_audio_stream_options **options = fs_emu_audio_alloc_stream_options(2); options[0]->frequency = fs_emu_audio_output_frequency(); /* 12 * 2352 is CDDA_BUFFERS * 2352 (blkdev_cdimage.cpp) */ options[1]->buffer_size = 12 * 2352; // begin playing with only one buffer queued options[1]->min_buffers = 1; fs_emu_audio_configure(options); amiga_set_audio_buffer_size(options[0]->buffer_size); fs_emu_audio_free_stream_options(options); #else // this stream is for paula output and drive clicks // FIXME: could mix drive clicks in its own stream instead, -might // give higher quality mixing fs_emu_audio_stream_options options; options.struct_size = sizeof(fs_emu_audio_stream_options); fs_emu_init_audio_stream_options(&options); options.frequency = fs_emu_audio_output_frequency(); fs_emu_init_audio_stream(0, &options); amiga_set_audio_buffer_size(options.buffer_size); // this stream is for CD audio output (CDTV/CD32) fs_emu_init_audio_stream_options(&options); // 12 * 2352 is CDDA_BUFFERS * 2352 (blkdev_cdimage.cpp) options.buffer_size = 12 * 2352; // begin playing with only one buffer queued options.min_buffers = 1; fs_emu_init_audio_stream(1, &options); #endif amiga_set_audio_callback(audio_callback_function); amiga_set_cd_audio_callback(audio_callback_function); amiga_set_event_function(event_handler); amiga_set_led_function(led_function); amiga_on_update_leds(on_update_leds); amiga_set_media_function(media_function); amiga_set_init_function(on_init); if (fs_config_get_boolean(OPTION_JIT_COMPILER) == 1) { amiga_init_jit_compiler(); } #ifdef WITH_LUA amiga_init_lua(fs_emu_acquire_lua, fs_emu_release_lua); amiga_init_lua_state(fs_emu_get_lua_state()); fs_uae_init_lua_state(fs_emu_get_lua_state()); #endif if (fs_emu_get_video_format() == FS_EMU_VIDEO_FORMAT_RGBA) { amiga_set_video_format(AMIGA_VIDEO_FORMAT_RGBA); } else if (fs_emu_get_video_format() == FS_EMU_VIDEO_FORMAT_BGRA) { amiga_set_video_format(AMIGA_VIDEO_FORMAT_BGRA); } else if (fs_emu_get_video_format() == FS_EMU_VIDEO_FORMAT_R5G6B5) { amiga_set_video_format(AMIGA_VIDEO_FORMAT_R5G6B5); } else if (fs_emu_get_video_format() == FS_EMU_VIDEO_FORMAT_R5G5B5A1) { amiga_set_video_format(AMIGA_VIDEO_FORMAT_R5G5B5A1); } else { fs_emu_warning("Unsupported video format requested"); } amiga_add_rtg_resolution(672, 540); amiga_add_rtg_resolution(960, 540); amiga_add_rtg_resolution(672 * 2, 540 * 2); amiga_add_rtg_resolution(fs_emu_get_windowed_width(), fs_emu_get_windowed_height()); amiga_add_rtg_resolution(fs_emu_get_fullscreen_width(), fs_emu_get_fullscreen_height()); fs_uae_init_video(); //fs_uae_init_keyboard(); fs_uae_init_mouse(); fs_uae_configure_menu(); fs_emu_run(main_function); fs_log("fs-uae shutting down, fs_emu_run returned\n"); if (g_rmdir(fs_uae_state_dir()) == 0) { fs_log("state dir %s was removed because it was empty\n", fs_uae_state_dir()); } else { fs_log("state dir %s was not removed (non-empty)\n", fs_uae_state_dir()); } fs_log("end of main function\n"); cleanup_old_files(); #ifdef WITH_CEF cef_destroy(); #endif return 0; }
int main (int argc, char **argv) { if (argc == 2 && 0 == g_strcmp0(argv[1], "-d")) g_setenv("G_MESSAGES_DEBUG", "all", FALSE); if (is_application_running(SHUTDOWN_ID_NAME)) { g_warning("another instance of application dosd is running...\n"); return 0; } singleton(SHUTDOWN_ID_NAME); check_version(); init_i18n (); gtk_init (&argc, &argv); input_argv = argv; gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new (GDK_LEFT_PTR)); container = create_web_container (FALSE, TRUE); gtk_window_set_decorated (GTK_WINDOW (container), FALSE); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (container), TRUE); gtk_window_set_skip_pager_hint (GTK_WINDOW (container), TRUE); gtk_window_set_keep_above (GTK_WINDOW (container), TRUE); gtk_window_set_position (GTK_WINDOW (container), GTK_WIN_POS_CENTER_ALWAYS); gtk_window_resize (GTK_WINDOW (container), width,height); gtk_widget_set_events (GTK_WIDGET (container), gtk_widget_get_events (GTK_WIDGET (container)) | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_EXPOSURE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK ); GtkWidget *webview = d_webview_new_with_uri (CHOICE_HTML_PATH); gtk_container_add (GTK_CONTAINER(container), GTK_WIDGET (webview)); gtk_widget_realize (container); gtk_widget_realize (webview); /* style_context = gtk_widget_get_style_context(webview);*/ /*gtk_style_context_add_class(style_context,GTK_STYLE_CLASS_OSD);*/ /*gtk_style_context_add_class(style_context,GTK_STYLE_PROPERTY_BORDER_RADIUS);*/ /*cairo_t *cr;*/ /*cairo_surface_t *surface;*/ /*surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);*/ /*cr = cairo_create(surface);*/ /*[>cairo_set_source_rgba (cr, 1, 0, 0, 0.80);<]*/ /*[>cairo_fill (cr);<]*/ /*gtk_render_background(style_context,cr,radius,radius,width,height);*/ /*[>gtk_style_context_set_background(style_context,gdkwindow);<]*/ /*gtk_style_context_restore(style_context);*/ /*[>cairo_destory(cr);<]*/ /*[>cairo_surface_write_to_png(surface,"gtkbackground.png");<]*/ /*[>cairo_surface_destory(surface);<]*/ GdkWindow* gdkwindow = gtk_widget_get_window (container); GdkRGBA rgba = { 0, 0, 0, 0.0 }; gdk_window_set_background_rgba (gdkwindow, &rgba); gdk_window_set_opacity (gdkwindow, 0.7); gdk_window_set_keep_above (gdkwindow, TRUE); osd_set_focus(FALSE); /*gdk_window_show(gdkwindow);*/ /*gtk_widget_show_all (container);*/ gtk_main (); return 0; }
int main (int argc, char **argv) { /* if (argc == 2 && 0 == g_strcmp0(argv[1], "-d")) */ g_setenv("G_MESSAGES_DEBUG", "all", FALSE); if (is_application_running(SHUTDOWN_ID_NAME)) { g_warning("another instance of application shutdown is running...\n"); return 0; } singleton(SHUTDOWN_ID_NAME); //remove option -f parse_cmd_line (&argc, &argv); check_version(); init_i18n (); gtk_init (&argc, &argv); gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new (GDK_LEFT_PTR)); container = create_web_container (FALSE, TRUE); ensure_fullscreen (container); gtk_window_set_decorated (GTK_WINDOW (container), FALSE); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (container), TRUE); gtk_window_set_skip_pager_hint (GTK_WINDOW (container), TRUE); /*gtk_window_set_keep_above (GTK_WINDOW (container), TRUE);*/ gtk_window_fullscreen (GTK_WINDOW (container)); gtk_widget_set_events (GTK_WIDGET (container), gtk_widget_get_events (GTK_WIDGET (container)) | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_EXPOSURE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); webview = d_webview_new_with_uri (SHUTDOWN_HTML_PATH); gtk_container_add (GTK_CONTAINER(container), GTK_WIDGET (webview)); /*g_signal_connect (container, "show", G_CALLBACK (show_cb), NULL);*/ /*g_signal_connect (webview, "focus-out-event", G_CALLBACK( focus_out_cb), NULL);*/ gtk_widget_realize (container); gtk_widget_realize (webview); GdkWindow* gdkwindow = gtk_widget_get_window (container); GdkRGBA rgba = { 0, 0, 0, 0.0 }; gdk_window_set_background_rgba (gdkwindow, &rgba); gdk_window_set_skip_taskbar_hint (gdkwindow, TRUE); gdk_window_set_cursor (gdkwindow, gdk_cursor_new(GDK_LEFT_PTR)); /*gdk_window_set_override_redirect (gdkwindow, TRUE);*/ /*select_popup_events ();*/ /*gdk_window_add_filter (NULL, (GdkFilterFunc)xevent_filter, gdkwindow);*/ dde_bg_g_settings = g_settings_new(SCHEMA_ID); set_background(gtk_widget_get_window(webview), dde_bg_g_settings, gdk_screen_width(), gdk_screen_height()); grab = gs_grab_new (); gtk_widget_show_all (container); gdk_window_focus (gtk_widget_get_window (container), 0); gdk_window_stick (gdkwindow); gtk_main (); return 0; }