make SDL_SetTextInputRect take a pointer to const

The documentation doesn't state that the argument is ever modified,
and no implementation does so currently.
This is a non-breaking change to guarantee as much to callers.
This commit is contained in:
rohlem 2022-07-04 16:38:05 +02:00 committed by Sam Lantinga
parent 51f75b8b30
commit b085c18251
22 changed files with 25 additions and 25 deletions

View file

@ -303,7 +303,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
*
* \sa SDL_StartTextInput
*/
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect);
/**
* Check whether the platform has screen keyboard support.

View file

@ -424,7 +424,7 @@ SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
}
void
SDL_Fcitx_UpdateTextRect(SDL_Rect *rect)
SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
{
SDL_Window *focused_win = NULL;
SDL_SysWMinfo info;

View file

@ -32,7 +32,7 @@ extern void SDL_Fcitx_Quit(void);
extern void SDL_Fcitx_SetFocus(SDL_bool focused);
extern void SDL_Fcitx_Reset(void);
extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect);
extern void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect);
extern void SDL_Fcitx_PumpEvents(void);
#endif /* SDL_fcitx_h_ */

View file

@ -639,7 +639,7 @@ SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
}
void
SDL_IBus_UpdateTextRect(SDL_Rect *rect)
SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
{
SDL_Window *focused_win;
SDL_SysWMinfo info;

View file

@ -45,7 +45,7 @@ extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 st
/* Update the position of IBus' candidate list. If rect is NULL then this will
just reposition it relative to the focused window's new position. */
extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect);
extern void SDL_IBus_UpdateTextRect(const SDL_Rect *window_relative_rect);
/* Checks DBus for new IBus events, and calls SDL_SendKeyboardText /
SDL_SendEditingText for each event it finds */

View file

@ -28,7 +28,7 @@ typedef void (*_SDL_IME_Quit)(void);
typedef void (*_SDL_IME_SetFocus)(SDL_bool);
typedef void (*_SDL_IME_Reset)(void);
typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32, Uint8 state);
typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *);
typedef void (*_SDL_IME_UpdateTextRect)(const SDL_Rect *);
typedef void (*_SDL_IME_PumpEvents)(void);
static _SDL_IME_Init SDL_IME_Init_Real = NULL;
@ -136,7 +136,7 @@ SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
}
void
SDL_IME_UpdateTextRect(SDL_Rect *rect)
SDL_IME_UpdateTextRect(const SDL_Rect *rect)
{
if (SDL_IME_UpdateTextRect_Real)
SDL_IME_UpdateTextRect_Real(rect);

View file

@ -32,7 +32,7 @@ extern void SDL_IME_Quit(void);
extern void SDL_IME_SetFocus(SDL_bool focused);
extern void SDL_IME_Reset(void);
extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state);
extern void SDL_IME_UpdateTextRect(SDL_Rect *rect);
extern void SDL_IME_UpdateTextRect(const SDL_Rect *rect);
extern void SDL_IME_PumpEvents(void);
#endif /* SDL_ime_h_ */

View file

@ -260,7 +260,7 @@ SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_StartTextInput,(void),(),)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputActive,(void),(),return)
SDL_DYNAPI_PROC(void,SDL_StopTextInput,(void),(),)
SDL_DYNAPI_PROC(void,SDL_SetTextInputRect,(SDL_Rect *a),(a),)
SDL_DYNAPI_PROC(void,SDL_SetTextInputRect,(const SDL_Rect *a),(a),)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenKeyboardShown,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return)

View file

@ -307,7 +307,7 @@ struct SDL_VideoDevice
/* Text input */
void (*StartTextInput) (_THIS);
void (*StopTextInput) (_THIS);
void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
void (*SetTextInputRect) (_THIS, const SDL_Rect *rect);
void (*ClearComposition) (_THIS);
SDL_bool (*IsTextInputShown) (_THIS);

View file

@ -4259,7 +4259,7 @@ SDL_StopTextInput(void)
}
void
SDL_SetTextInputRect(SDL_Rect *rect)
SDL_SetTextInputRect(const SDL_Rect *rect)
{
if (_this && _this->SetTextInputRect) {
_this->SetTextInputRect(_this, rect);

View file

@ -374,7 +374,7 @@ Android_StopTextInput(_THIS)
}
void
Android_SetTextInputRect(_THIS, SDL_Rect *rect)
Android_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;

View file

@ -31,6 +31,6 @@ extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window * window);
extern void Android_StartTextInput(_THIS);
extern void Android_StopTextInput(_THIS);
extern void Android_SetTextInputRect(_THIS, SDL_Rect *rect);
extern void Android_SetTextInputRect(_THIS, const SDL_Rect *rect);
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -29,7 +29,7 @@ extern void Cocoa_QuitKeyboard(_THIS);
extern void Cocoa_StartTextInput(_THIS);
extern void Cocoa_StopTextInput(_THIS);
extern void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect);
extern void Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect);
extern void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed);

View file

@ -40,12 +40,12 @@
SDL_Rect _inputRect;
}
- (void)doCommandBySelector:(SEL)myselector;
- (void)setInputRect:(SDL_Rect *)rect;
- (void)setInputRect:(const SDL_Rect *)rect;
@end
@implementation SDLTranslatorResponder
- (void)setInputRect:(SDL_Rect *)rect
- (void)setInputRect:(const SDL_Rect *)rect
{
_inputRect = *rect;
}
@ -514,7 +514,7 @@ Cocoa_StopTextInput(_THIS)
}}
void
Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect)
Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata;

View file

@ -87,5 +87,5 @@ SDL_bool UIKit_HasScreenKeyboardSupport(_THIS);
void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window);
void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window);
SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window);
void UIKit_SetTextInputRect(_THIS, SDL_Rect *rect);
void UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect);
#endif

View file

@ -547,7 +547,7 @@ UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window)
}
void
UIKit_SetTextInputRect(_THIS, SDL_Rect *rect)
UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
if (!rect) {
SDL_InvalidParamError("rect");

View file

@ -108,7 +108,7 @@ Wayland_StopTextInput(_THIS)
}
void
Wayland_SetTextInputRect(_THIS, SDL_Rect *rect)
Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
SDL_VideoData *driverdata = _this->driverdata;

View file

@ -34,7 +34,7 @@ extern int Wayland_InitKeyboard(_THIS);
extern void Wayland_QuitKeyboard(_THIS);
extern void Wayland_StartTextInput(_THIS);
extern void Wayland_StopTextInput(_THIS);
extern void Wayland_SetTextInputRect(_THIS, SDL_Rect *rect);
extern void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect);
extern SDL_bool Wayland_HasScreenKeyboardSupport(_THIS);
#endif /* SDL_waylandkeyboard_h_ */

View file

@ -235,7 +235,7 @@ WIN_StopTextInput(_THIS)
}
void
WIN_SetTextInputRect(_THIS, SDL_Rect *rect)
WIN_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
HIMC himc = 0;

View file

@ -31,7 +31,7 @@ extern void WIN_ResetDeadKeys(void);
extern void WIN_StartTextInput(_THIS);
extern void WIN_StopTextInput(_THIS);
extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect);
extern void WIN_SetTextInputRect(_THIS, const SDL_Rect *rect);
extern void WIN_ClearComposition(_THIS);
extern SDL_bool WIN_IsTextInputShown(_THIS);

View file

@ -526,7 +526,7 @@ X11_StopTextInput(_THIS)
}
void
X11_SetTextInputRect(_THIS, SDL_Rect *rect)
X11_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
if (!rect) {
SDL_InvalidParamError("rect");

View file

@ -28,7 +28,7 @@ extern void X11_UpdateKeymap(_THIS);
extern void X11_QuitKeyboard(_THIS);
extern void X11_StartTextInput(_THIS);
extern void X11_StopTextInput(_THIS);
extern void X11_SetTextInputRect(_THIS, SDL_Rect *rect);
extern void X11_SetTextInputRect(_THIS, const SDL_Rect *rect);
extern KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group);
#endif /* SDL_x11keyboard_h_ */