From ff3329d071dd43d2e2d1b6cb0653c1f42872aad2 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 21 Sep 2024 00:15:06 +0300
Subject: [PATCH 49/49] sdl: Make textinput_handler to take a const parameter

See RM #886

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-sdl2/gui_main.c    | 2 +-
 client/gui-sdl2/gui_main.h    | 2 +-
 client/gui-sdl2/widget_edit.c | 4 ++--
 client/gui-sdl3/gui_main.c    | 2 +-
 client/gui-sdl3/gui_main.h    | 2 +-
 client/gui-sdl3/widget_edit.c | 4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/client/gui-sdl2/gui_main.c b/client/gui-sdl2/gui_main.c
index 282402dcdf..33308b8d9b 100644
--- a/client/gui-sdl2/gui_main.c
+++ b/client/gui-sdl2/gui_main.c
@@ -603,7 +603,7 @@ Uint16 gui_event_loop(void *data,
                       void (*loop_action)(void *data),
                       Uint16 (*key_down_handler)(SDL_Keysym key, void *data),
                       Uint16 (*key_up_handler)(SDL_Keysym key, void *data),
-                      Uint16 (*textinput_handler)(char *text, void *data),
+                      Uint16 (*textinput_handler)(const char *text, void *data),
                       Uint16 (*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_motion_handler)(SDL_TouchFingerEvent *touch_event,
diff --git a/client/gui-sdl2/gui_main.h b/client/gui-sdl2/gui_main.h
index 0be422163e..dd2d2a6d41 100644
--- a/client/gui-sdl2/gui_main.h
+++ b/client/gui-sdl2/gui_main.h
@@ -117,7 +117,7 @@ int FilterMouseMotionEvents(void *data, SDL_Event *event);
 Uint16 gui_event_loop(void *data, void (*loop_action)(void *data),
                       Uint16 (*key_down_handler)(SDL_Keysym key, void *data),
                       Uint16 (*key_up_handler)(SDL_Keysym key, void *data),
-                      Uint16 (*textinput_handler)(char *text, void *data),
+                      Uint16 (*textinput_handler)(const char *text, void *data),
                       Uint16 (*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_motion_handler)(SDL_TouchFingerEvent *touch_event,
diff --git a/client/gui-sdl2/widget_edit.c b/client/gui-sdl2/widget_edit.c
index 73e2e3b8b4..9096c48f6e 100644
--- a/client/gui-sdl2/widget_edit.c
+++ b/client/gui-sdl2/widget_edit.c
@@ -586,7 +586,7 @@ static Uint16 edit_key_down(SDL_Keysym key, void *data)
 /**********************************************************************//**
   Handle textinput strings coming to the edit widget
 **************************************************************************/
-static Uint16 edit_textinput(char *text, void *data)
+static Uint16 edit_textinput(const char *text, void *data)
 {
   struct text_edit *edt = (struct text_edit *)data;
   struct utf8_char *input_chain_tmp;
@@ -598,7 +598,7 @@ static Uint16 edit_textinput(char *text, void *data)
     int sum = 128 + 64;
     int addition = 32;
 
-    /* add new element of chain (and move cursor right) */
+    /* Add new element of chain (and move cursor right) */
     if (edt->input_chain != edt->begin_text_chain) {
       input_chain_tmp = edt->input_chain->prev;
       edt->input_chain->prev = fc_calloc(1, sizeof(struct utf8_char));
diff --git a/client/gui-sdl3/gui_main.c b/client/gui-sdl3/gui_main.c
index 1f875ec073..e4a83330b7 100644
--- a/client/gui-sdl3/gui_main.c
+++ b/client/gui-sdl3/gui_main.c
@@ -598,7 +598,7 @@ Uint16 gui_event_loop(void *data,
                       void (*loop_action)(void *data),
                       Uint16 (*key_down_handler)(SDL_KeyboardEvent *key, void *data),
                       Uint16 (*key_up_handler)(SDL_KeyboardEvent *key, void *data),
-                      Uint16 (*textinput_handler)(char *text, void *data),
+                      Uint16 (*textinput_handler)(const char *text, void *data),
                       Uint16 (*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_motion_handler)(SDL_TouchFingerEvent *touch_event,
diff --git a/client/gui-sdl3/gui_main.h b/client/gui-sdl3/gui_main.h
index fe98f2e897..b413e6801f 100644
--- a/client/gui-sdl3/gui_main.h
+++ b/client/gui-sdl3/gui_main.h
@@ -112,7 +112,7 @@ bool FilterMouseMotionEvents(void *data, SDL_Event *event);
 Uint16 gui_event_loop(void *data, void (*loop_action)(void *data),
                       Uint16 (*key_down_handler)(SDL_KeyboardEvent *key, void *data),
                       Uint16 (*key_up_handler)(SDL_KeyboardEvent *key, void *data),
-                      Uint16 (*textinput_handler)(char *text, void *data),
+                      Uint16 (*textinput_handler)(const char *text, void *data),
                       Uint16 (*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data),
                       Uint16 (*finger_motion_handler)(SDL_TouchFingerEvent *touch_event,
diff --git a/client/gui-sdl3/widget_edit.c b/client/gui-sdl3/widget_edit.c
index 8af6f943cc..a39fcb1878 100644
--- a/client/gui-sdl3/widget_edit.c
+++ b/client/gui-sdl3/widget_edit.c
@@ -582,7 +582,7 @@ static Uint16 edit_key_down(SDL_KeyboardEvent *key, void *data)
 /**********************************************************************//**
   Handle textinput strings coming to the edit widget
 **************************************************************************/
-static Uint16 edit_textinput(char *text, void *data)
+static Uint16 edit_textinput(const char *text, void *data)
 {
   struct text_edit *edt = (struct text_edit *)data;
   struct utf8_char *input_chain_tmp;
@@ -594,7 +594,7 @@ static Uint16 edit_textinput(char *text, void *data)
     int sum = 128 + 64;
     int addition = 32;
 
-    /* add new element of chain (and move cursor right) */
+    /* Add new element of chain (and move cursor right) */
     if (edt->input_chain != edt->begin_text_chain) {
       input_chain_tmp = edt->input_chain->prev;
       edt->input_chain->prev = fc_calloc(1, sizeof(struct utf8_char));
-- 
2.45.2

