void fs_ml_toggle_fullscreen(void) { if (!is_video_thread()) { fs_log("Posting toggle video event\n"); post_video_event(FS_ML_VIDEO_EVENT_TOGGLE_FULLSCREEN); return; } fs_ml_set_fullscreen(!fs_ml_fullscreen()); }
void fs_ml_activate_window_switcher(void) { if (!is_video_thread()) { post_video_event(FS_ML_VIDEO_EVENT_ACTIVATE_WINDOW_SWITCHER); return; } fs_ml_activate_window_switcher_impl(); }
void fs_ml_set_input_grab(bool grab) { if (!is_video_thread()) { post_video_event(grab ? FS_ML_VIDEO_EVENT_GRAB_INPUT : FS_ML_VIDEO_EVENT_UNGRAB_INPUT); /* FIXME: Not really, yet */ g_has_input_grab = grab ? 1 : 0; return; } SDL_SetWindowGrab(g_fs_ml_window, grab ? SDL_TRUE : SDL_FALSE); SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE); if (fs_ml_cursor_allowed()) fs_ml_show_cursor(!grab, 1); g_has_input_grab = grab ? 1 : 0; }
void fs_ml_set_fullscreen(bool fullscreen) { if (!is_video_thread()) { if (fullscreen) { fs_log("Posting enable fullscreen event\n"); post_video_event(FS_ML_VIDEO_EVENT_ENABLE_FULLSCREEN); } else { fs_log("Posting disable fullscreen event\n"); post_video_event(FS_ML_VIDEO_EVENT_DISABLE_FULLSCREEN); } return; } if (fullscreen == g_fs_emu_video_fullscreen) return; if (g_fs_emu_video_fullscreen_mode == FULLSCREEN_WINDOW) { fs_emu_warning("Cannot toggle fullscreen with fullscreen-mode=window"); return; } int display_index = 0; SDL_DisplayMode mode; memset(&mode, 0, sizeof(SDL_DisplayMode)); if (SDL_GetDesktopDisplayMode(display_index, &mode) == 0) { SDL_SetWindowDisplayMode(g_fs_ml_window, &mode); } int flags = 0; if (fullscreen) { if (g_fs_emu_video_fullscreen_mode == FULLSCREEN_DESKTOP) flags = SDL_WINDOW_FULLSCREEN_DESKTOP; else flags = SDL_WINDOW_FULLSCREEN; } SDL_SetWindowFullscreen(g_fs_ml_window, flags); g_fs_emu_video_fullscreen = fullscreen; }