Project

General

Profile

Feature #836 ยป 0028-sdl3-Replace-SDL_Keysym-with-SDL_Keycode.patch

Marko Lindqvist, 09/07/2024 06:15 AM

View differences:

client/gui-sdl3/gui_main.c
/**********************************************************************//**
Main handler for key presses
**************************************************************************/
static Uint16 main_key_down_handler(SDL_Keysym key, void *data)
static Uint16 main_key_down_handler(SDL_Keycode key, void *data)
{
static struct widget *pwidget;
......
/**********************************************************************//**
Main key release handler.
**************************************************************************/
static Uint16 main_key_up_handler(SDL_Keysym key, void *data)
static Uint16 main_key_up_handler(SDL_Keycode key, void *data)
{
if (selected_widget) {
unselect_widget_action();
......
return ID_ERROR;
}
/**********************************************************************//**
Main finger down handler.
**************************************************************************/
......
}
return ID_ERROR;
}
/**********************************************************************//**
Main finger release handler.
**************************************************************************/
......
**************************************************************************/
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 (*key_down_handler)(SDL_Keycode key, void *data),
Uint16 (*key_up_handler)(SDL_Keycode key, void *data),
Uint16 (*textinput_handler)(char *text, void *data),
Uint16 (*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data),
Uint16 (*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data),
client/gui-sdl3/gui_main.h
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 (*key_down_handler)(SDL_Keycode key, void *data),
Uint16 (*key_up_handler)(SDL_Keycode key, void *data),
Uint16 (*textinput_handler)(char *text, void *data),
Uint16 (*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data),
Uint16 (*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data),
client/gui-sdl3/mapctrl.c
/**********************************************************************//**
Toggle map drawing stuff.
**************************************************************************/
bool map_event_handler(SDL_Keysym key)
bool map_event_handler(SDL_Keycode key)
{
if (C_S_RUNNING == client_state()) {
enum direction8 movedir = DIR8_MAGIC_MAX;
client/gui-sdl3/mapctrl.h
void enable_and_redraw_revolution_button(void);
void enable_main_widgets(void);
void disable_main_widgets(void);
bool map_event_handler(SDL_Keysym key);
bool map_event_handler(SDL_Keycode key);
void finger_down_on_map(struct finger_behavior *finger_behavior);
void finger_up_on_map(struct finger_behavior *finger_behavior);
client/gui-sdl3/widget.c
NOTE: This function ignores CapsLock and NumLock Keys.
**************************************************************************/
struct widget *find_next_widget_for_key(struct widget *start_widget,
SDL_Keysym key)
SDL_Keycode key)
{
struct widget *pwidget;
client/gui-sdl3/widget.h
void del_main_list(void);
struct widget *find_next_widget_at_pos(struct widget *start_widget, int x, int y);
struct widget *find_next_widget_for_key(struct widget *start_widget, SDL_Keysym key);
struct widget *find_next_widget_for_key(struct widget *start_widget, SDL_Keycode key);
struct widget *get_widget_pointer_from_id(const struct widget *gui_list,
Uint16 id,
client/gui-sdl3/widget_edit.c
NOTE: This functions can return NULL in 'edit_widget->string_utf8->text' but
never free 'edit_widget->string_utf8' struct.
**************************************************************************/
static Uint16 edit_key_down(SDL_Keysym key, void *data)
static Uint16 edit_key_down(SDL_Keycode key, void *data)
{
struct text_edit *edt = (struct text_edit *)data;
struct utf8_char *input_chain_tmp;
    (1-1/1)