diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 44c732e0fb..9751046979 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -898,6 +898,7 @@ void SDL_QuitMouse(void) } SDL_SetRelativeMouseMode(SDL_FALSE); SDL_ShowCursor(); + SDL_PenQuit(); if (mouse->def_cursor) { SDL_SetDefaultCursor(NULL); diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index 655d729d56..e3f55482f7 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -829,6 +829,19 @@ void SDL_PenInit(void) #endif } +void SDL_PenQuit(void) +{ + SDL_DelHintCallback(SDL_HINT_PEN_NOT_MOUSE, + SDL_PenUpdateHint, &pen_mouse_emulation_mode); + + SDL_DelHintCallback(SDL_HINT_PEN_DELAY_MOUSE_BUTTON, + SDL_PenUpdateHint, &pen_delay_mouse_button_mode); +#ifndef SDL_THREADS_DISABLED + SDL_DestroyMutex(SDL_pen_access_lock); + SDL_pen_access_lock = NULL; +#endif +} + SDL_bool SDL_PenPerformHitTest(void) { return pen_mouse_emulation_mode == PEN_MOUSE_EMULATE; diff --git a/src/events/SDL_pen_c.h b/src/events/SDL_pen_c.h index 0488d5d92f..70b1b7fefd 100644 --- a/src/events/SDL_pen_c.h +++ b/src/events/SDL_pen_c.h @@ -331,6 +331,11 @@ extern int SDL_SendPenWindowEvent(Uint64 timestamp, SDL_PenID instance_id, SDL_W */ extern void SDL_PenInit(void); +/** + * De-initialises the pen subsystem. + */ +extern void SDL_PenQuit(void); + #endif /* SDL_pen_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/test/testautomation_pen.c b/test/testautomation_pen.c index d200656603..d9a6ef2a28 100644 --- a/test/testautomation_pen.c +++ b/test/testautomation_pen.c @@ -54,6 +54,7 @@ #define SDL_SendPenWindowEvent SDL_SUT_SendPenWindowEvent #define SDL_PenPerformHitTest SDL_SUT_PenPerformHitTest #define SDL_PenInit SDL_SUT_PenInit +#define SDL_PenQuit SDL_SUT_PenQuit /* ================= Mock API ================== */