cocoa: Make keyboard grab function return an int

This commit is contained in:
Frank Praznik
2024-03-06 15:53:24 -05:00
parent f8cb3c742d
commit 53896c9e44
2 changed files with 3 additions and 2 deletions

View File

@@ -31,6 +31,6 @@ extern void Cocoa_StartTextInput(SDL_VideoDevice *_this);
extern void Cocoa_StopTextInput(SDL_VideoDevice *_this); extern void Cocoa_StopTextInput(SDL_VideoDevice *_this);
extern int Cocoa_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect); extern int Cocoa_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect);
extern void Cocoa_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed); extern int Cocoa_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
#endif /* SDL_cocoakeyboard_h_ */ #endif /* SDL_cocoakeyboard_h_ */

View File

@@ -467,11 +467,12 @@ typedef enum
extern CGSConnection _CGSDefaultConnection(void); extern CGSConnection _CGSDefaultConnection(void);
extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection connection, CGSGlobalHotKeyOperatingMode mode); extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection connection, CGSGlobalHotKeyOperatingMode mode);
void Cocoa_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed) int Cocoa_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed)
{ {
#ifdef SDL_MAC_NO_SANDBOX #ifdef SDL_MAC_NO_SANDBOX
CGSSetGlobalHotKeyOperatingMode(_CGSDefaultConnection(), grabbed ? CGSGlobalHotKeyDisable : CGSGlobalHotKeyEnable); CGSSetGlobalHotKeyOperatingMode(_CGSDefaultConnection(), grabbed ? CGSGlobalHotKeyDisable : CGSGlobalHotKeyEnable);
#endif #endif
return 0;
} }
#endif /* SDL_VIDEO_DRIVER_COCOA */ #endif /* SDL_VIDEO_DRIVER_COCOA */