int OSX_Mouse_Init(void) { if (cur_mdata) OSX_Mouse_Shutdown(); cur_mdata = new struct osx_mouse_data(); if (!cur_mdata) return -1; cur_mdata->mouse_mutex = SDL_CreateMutex(); if (!cur_mdata->mouse_mutex) { delete cur_mdata; cur_mdata = NULL; return -1; } SDL_Thread *thread = SDL_CreateThread(OSX_Mouse_Thread, "OSX_Mouse_Thread", cur_mdata); if (!thread) { SDL_DestroyMutex(cur_mdata->mouse_mutex); delete cur_mdata; cur_mdata = NULL; return -1; } SDL_DetachThread(thread); return 0; }
void IN_Shutdown(void) { IN_DeactivateMouse(); // btw we trying de init this in video shutdown too... #ifdef __APPLE__ OSX_Mouse_Shutdown(); // Safe to call, will just return if it's not running #endif mouseinitialized = false; }