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_grab_input(int grab, int immediate) { //printf("fs_ml_grab_input %d %d\n", grab, immediate); if (immediate) { #ifdef USE_SDL2 SDL_SetWindowGrab(g_fs_ml_window, grab ? SDL_TRUE : SDL_FALSE); SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE); #else SDL_WM_GrabInput(grab ? SDL_GRAB_ON : SDL_GRAB_OFF); #endif if (fs_ml_cursor_allowed()) { fs_ml_show_cursor(!grab, 1); } } else { post_video_event(grab ? FS_ML_VIDEO_EVENT_GRAB_INPUT : FS_ML_VIDEO_EVENT_UNGRAB_INPUT); } g_has_input_grab = grab ? 1 : 0; }