Project

General

Profile

Feature #886 ยป 0049-sdl-Make-textinput_handler-to-take-a-const-parameter.patch

Marko Lindqvist, 09/21/2024 12:20 AM

View differences:

client/gui-sdl2/gui_main.c
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,
client/gui-sdl2/gui_main.h
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,
client/gui-sdl2/widget_edit.c
/**********************************************************************//**
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;
......
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));
client/gui-sdl3/gui_main.c
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,
client/gui-sdl3/gui_main.h
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,
client/gui-sdl3/widget_edit.c
/**********************************************************************//**
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;
......
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));
    (1-1/1)