From 1256b56a40cbff00224b97e57fcd65eeac5b3e18 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 16 Oct 2023 00:54:51 +0300 Subject: [PATCH 34/34] sdl3: Update event and key names Bulk update, likely missing some instances. Just makes it compile a bit further. See osdn #48851 Signed-off-by: Marko Lindqvist --- client/gui-sdl3/citydlg.c | 6 +++--- client/gui-sdl3/finddlg.c | 2 +- client/gui-sdl3/gui_main.c | 22 +++++++++++----------- client/gui-sdl3/gui_main.h | 6 +++--- client/gui-sdl3/mapctrl.c | 14 +++++++------- client/gui-sdl3/menu.c | 30 +++++++++++++++--------------- client/gui-sdl3/optiondlg.c | 2 +- client/gui-sdl3/plrdlg.c | 2 +- client/gui-sdl3/widget.c | 2 +- client/gui-sdl3/widget_button.c | 2 +- client/gui-sdl3/widget_checkbox.c | 2 +- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/client/gui-sdl3/citydlg.c b/client/gui-sdl3/citydlg.c index 2462b6502c..7d1332275e 100644 --- a/client/gui-sdl3/citydlg.c +++ b/client/gui-sdl3/citydlg.c @@ -381,7 +381,7 @@ static int units_orders_dlg_callback(struct widget *button) **************************************************************************/ static int units_orders_city_dlg_callback(struct widget *button) { - bool right_button = (main_data.event.type == SDL_MOUSEBUTTONDOWN + bool right_button = (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN && main_data.event.button.button == SDL_BUTTON_RIGHT); if (PRESSED_EVENT(main_data.event) || right_button) { @@ -3739,7 +3739,7 @@ void real_city_dialog_popup(struct city *pcity) set_wstate(buf, FC_WS_NORMAL); } buf->key = SDLK_LEFT; - buf->mod = KMOD_LSHIFT; + buf->mod = SDL_KMOD_LSHIFT; add_to_gui_list(ID_CITY_DLG_PREV_BUTTON, buf); /* -------- */ @@ -3754,7 +3754,7 @@ void real_city_dialog_popup(struct city *pcity) set_wstate(buf, FC_WS_NORMAL); } buf->key = SDLK_RIGHT; - buf->mod = KMOD_LSHIFT; + buf->mod = SDL_KMOD_LSHIFT; add_to_gui_list(ID_CITY_DLG_NEXT_BUTTON, buf); /* -------- */ diff --git a/client/gui-sdl3/finddlg.c b/client/gui-sdl3/finddlg.c index c209b08f5a..64da1ea3e4 100644 --- a/client/gui-sdl3/finddlg.c +++ b/client/gui-sdl3/finddlg.c @@ -127,7 +127,7 @@ void popup_find_dialog(void) struct player *owner = NULL; struct tile *original; int window_x = 0, window_y = 0; - bool mouse = (main_data.event.type == SDL_MOUSEBUTTONDOWN); + bool mouse = (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN); SDL_Rect area; /* check that there are any cities to find */ diff --git a/client/gui-sdl3/gui_main.c b/client/gui-sdl3/gui_main.c index 47d7f73b25..5ae9620141 100644 --- a/client/gui-sdl3/gui_main.c +++ b/client/gui-sdl3/gui_main.c @@ -572,7 +572,7 @@ void force_exit_from_event_loop(void) **************************************************************************/ int FilterMouseMotionEvents(void *data, SDL_Event *event) { - if (event->type == SDL_MOUSEMOTION) { + if (event->type == SDL_EVENT_MOUSE_MOTION) { static int x = 0, y = 0; if (((MOVE_STEP_X > 0) && (abs(event->motion.x - x) >= MOVE_STEP_X)) @@ -725,11 +725,11 @@ Uint16 gui_event_loop(void *data, switch (main_data.event.type) { - case SDL_QUIT: + case SDL_EVENT_QUIT: return MAX_ID; break; - case SDL_KEYUP: + case SDL_EVENT_KEY_UP: switch (main_data.event.key.keysym.sym) { /* find if Shifts are released */ case SDLK_RSHIFT: @@ -755,7 +755,7 @@ Uint16 gui_event_loop(void *data, } break; - case SDL_KEYDOWN: + case SDL_EVENT_KEY_DOWN: switch (main_data.event.key.keysym.sym) { #if 0 case SDLK_PRINT: @@ -798,43 +798,43 @@ Uint16 gui_event_loop(void *data, } break; - case SDL_TEXTINPUT: + case SDL_EVENT_TEXT_INPUT: if (textinput_handler) { ID = textinput_handler(main_data.event.text.text, data); } break; - case SDL_FINGERDOWN: + case SDL_EVENT_FINGER_DOWN: if (finger_down_handler) { ID = finger_down_handler(&main_data.event.tfinger, data); } break; - case SDL_FINGERUP: + case SDL_EVENT_FINGER_UP: if (finger_up_handler) { ID = finger_up_handler(&main_data.event.tfinger, data); } break; - case SDL_FINGERMOTION: + case SDL_EVENT_FINGER_MOTION: if (finger_motion_handler) { ID = finger_motion_handler(&main_data.event.tfinger, data); } break; - case SDL_MOUSEBUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: if (mouse_button_down_handler) { ID = mouse_button_down_handler(&main_data.event.button, data); } break; - case SDL_MOUSEBUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: if (mouse_button_up_handler) { ID = mouse_button_up_handler(&main_data.event.button, data); } break; - case SDL_MOUSEMOTION: + case SDL_EVENT_MOUSE_MOTION: if (mouse_motion_handler) { ID = mouse_motion_handler(&main_data.event.motion, data); } diff --git a/client/gui-sdl3/gui_main.h b/client/gui-sdl3/gui_main.h index ab889b41fd..718edb7f52 100644 --- a/client/gui-sdl3/gui_main.h +++ b/client/gui-sdl3/gui_main.h @@ -65,9 +65,9 @@ struct theme; /* Predicate for detecting basic widget activation events. */ #define PRESSED_EVENT(event) ( \ - (event).type == SDL_KEYDOWN \ - || (event).type == SDL_FINGERDOWN \ - || ((event).type == SDL_MOUSEBUTTONDOWN \ + (event).type == SDL_EVENT_KEY_DOWN \ + || (event).type == SDL_EVENT_FINGER_DOWN \ + || ((event).type == SDL_EVENT_MOUSE_BUTTON_DOWN \ && (event).button.button == SDL_BUTTON_LEFT)) enum mouse_button_hold_state { diff --git a/client/gui-sdl3/mapctrl.c b/client/gui-sdl3/mapctrl.c index 672e91de2e..b59b5c6ece 100644 --- a/client/gui-sdl3/mapctrl.c +++ b/client/gui-sdl3/mapctrl.c @@ -121,7 +121,7 @@ static int players_action_callback(struct widget *pwidget) set_wstate(pwidget, FC_WS_NORMAL); widget_redraw(pwidget); widget_mark_dirty(pwidget); - if (main_data.event.type == SDL_MOUSEBUTTONDOWN) { + if (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { switch (main_data.event.button.button) { #if 0 case SDL_BUTTON_LEFT: @@ -168,10 +168,10 @@ static int cities_action_callback(struct widget *button) set_wstate(button, FC_WS_DISABLED); widget_redraw(button); widget_mark_dirty(button); - if (main_data.event.type == SDL_KEYDOWN) { + if (main_data.event.type == SDL_EVENT_KEY_DOWN) { /* Ctrl-F shortcut */ popup_find_dialog(); - } else if (main_data.event.type == SDL_MOUSEBUTTONDOWN) { + } else if (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { switch (main_data.event.button.button) { #if 0 case SDL_BUTTON_LEFT: @@ -1293,7 +1293,7 @@ static int minimap_window_callback(struct widget *pwidget) **************************************************************************/ static int unit_info_window_callback(struct widget *pwidget) { - if (main_data.event.type == SDL_MOUSEBUTTONDOWN) { + if (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { switch (main_data.event.button.button) { #if 0 case SDL_BUTTON_LEFT: @@ -1524,7 +1524,7 @@ void popup_unitinfo_window(void) pwidget->info_label = create_utf8_from_char_fonto(buf, FONTO_ATTENTION); pwidget->action = revolution_callback; pwidget->key = SDLK_g; - pwidget->mod = KMOD_CTRL | KMOD_SHIFT; + pwidget->mod = SDL_KMOD_CTRL | SDL_KMOD_SHIFT; add_to_gui_list(ID_REVOLUTION, pwidget); @@ -1687,7 +1687,7 @@ void popup_minimap_window(void) pwidget->info_label = create_utf8_from_char_fonto(buf, FONTO_ATTENTION); pwidget->action = end_turn_callback; pwidget->key = SDLK_RETURN; - pwidget->mod = KMOD_SHIFT; + pwidget->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_NEW_TURN, pwidget); @@ -1715,7 +1715,7 @@ void popup_minimap_window(void) pwidget->info_label->style |= SF_CENTER; pwidget->action = cities_action_callback; pwidget->key = SDLK_f; - pwidget->mod = KMOD_CTRL; + pwidget->mod = SDL_KMOD_CTRL; add_to_gui_list(ID_CITIES, pwidget); diff --git a/client/gui-sdl3/menu.c b/client/gui-sdl3/menu.c index bfc80a8a75..e82d1c9fff 100644 --- a/client/gui-sdl3/menu.c +++ b/client/gui-sdl3/menu.c @@ -436,7 +436,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_n; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_UNIT_ORDER_NUKE, buf); /* --------- */ @@ -462,7 +462,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_d; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_UNIT_ORDER_DISBAND, buf); /* --------- */ @@ -475,7 +475,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_u; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_UNIT_ORDER_UPGRADE, buf); /* --------- */ @@ -488,7 +488,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_o; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_UNIT_ORDER_CONVERT, buf); /* --------- */ @@ -502,7 +502,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_g; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_UNIT_ORDER_RETURN, buf); /* --------- */ @@ -564,7 +564,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_i; - buf->mod = KMOD_CTRL; + buf->mod = SDL_KMOD_CTRL; add_to_gui_list(ID_UNIT_ORDER_CONNECT_IRRIGATE, buf); /* --------- */ @@ -583,7 +583,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_r; - buf->mod = KMOD_CTRL; + buf->mod = SDL_KMOD_CTRL; add_to_gui_list(ID_UNIT_ORDER_CONNECT_ROAD, buf); } /* --------- */ @@ -602,7 +602,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_l; - buf->mod = KMOD_CTRL; + buf->mod = SDL_KMOD_CTRL; add_to_gui_list(ID_UNIT_ORDER_CONNECT_RAILROAD, buf); } /* --------- */ @@ -642,7 +642,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_s; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_UNIT_ORDER_WAKEUP_OTHERS, buf); /* --------- */ @@ -655,7 +655,7 @@ void create_units_order_widgets(void) set_wstate(buf, FC_WS_NORMAL); buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; buf->key = SDLK_t; add_to_gui_list(ID_UNIT_ORDER_UNLOAD_TRANSPORTER, buf); /* --------- */ @@ -706,7 +706,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_p; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; add_to_gui_list(ID_UNIT_ORDER_PILLAGE, buf); /* --------- */ @@ -759,7 +759,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_e; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; order_airbase_button = buf; add_to_gui_list(ID_UNIT_ORDER_AIRBASE, buf); /* --------- */ @@ -786,7 +786,7 @@ void create_units_order_widgets(void) buf->action = unit_order_callback; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); buf->key = SDLK_f; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; order_fortress_button = buf; add_to_gui_list(ID_UNIT_ORDER_FORTRESS, buf); /* --------- */ @@ -844,7 +844,7 @@ void create_units_order_widgets(void) set_wstate(buf, FC_WS_NORMAL); buf->action = unit_order_callback; buf->key = SDLK_i; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); add_to_gui_list(ID_UNIT_ORDER_CULTIVATE, buf); @@ -860,7 +860,7 @@ void create_units_order_widgets(void) set_wstate(buf, FC_WS_NORMAL); buf->action = unit_order_callback; buf->key = SDLK_m; - buf->mod = KMOD_SHIFT; + buf->mod = SDL_KMOD_SHIFT; buf->info_label = create_utf8_from_char_fonto(cbuf, FONTO_DEFAULT); add_to_gui_list(ID_UNIT_ORDER_PLANT, buf); diff --git a/client/gui-sdl3/optiondlg.c b/client/gui-sdl3/optiondlg.c index 434d59f4e6..de4f69e0d6 100644 --- a/client/gui-sdl3/optiondlg.c +++ b/client/gui-sdl3/optiondlg.c @@ -1095,7 +1095,7 @@ static int edit_worklist_callback(struct widget *widget) return -1; } - if (main_data.event.type == SDL_MOUSEBUTTONDOWN) { + if (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { switch (main_data.event.button.button) { case SDL_BUTTON_LEFT: /* Edit. */ diff --git a/client/gui-sdl3/plrdlg.c b/client/gui-sdl3/plrdlg.c index 0d1f5df91e..3c035249fd 100644 --- a/client/gui-sdl3/plrdlg.c +++ b/client/gui-sdl3/plrdlg.c @@ -606,7 +606,7 @@ static int player_nation_callback(struct widget *pwidget) bool try_dlg = FALSE; bool popdown = FALSE; - if (main_data.event.type == SDL_MOUSEBUTTONDOWN) { + if (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { switch (main_data.event.button.button) { #if 0 case SDL_BUTTON_LEFT: diff --git a/client/gui-sdl3/widget.c b/client/gui-sdl3/widget.c index b5a714c088..b3a494470e 100644 --- a/client/gui-sdl3/widget.c +++ b/client/gui-sdl3/widget.c @@ -252,7 +252,7 @@ struct widget *find_next_widget_for_key(struct widget *start_widget, pwidget = start_widget ? start_widget : begin_main_widget_list; - key.mod &= ~(KMOD_NUM | KMOD_CAPS); + key.mod &= ~(SDL_KMOD_NUM | SDL_KMOD_CAPS); while (pwidget) { if ((pwidget->key == key.sym || (pwidget->key == SDLK_RETURN && key.sym == SDLK_KP_ENTER) diff --git a/client/gui-sdl3/widget_button.c b/client/gui-sdl3/widget_button.c index 6287725d7a..b8f29a89b7 100644 --- a/client/gui-sdl3/widget_button.c +++ b/client/gui-sdl3/widget_button.c @@ -277,7 +277,7 @@ struct widget *create_icon_button(SDL_Surface *icon, struct gui_layer *pdest, set_wflag(button, (WF_FREE_STRING | flags)); set_wstate(button, FC_WS_DISABLED); set_wtype(button, WT_I_BUTTON); - button->mod = KMOD_NONE; + button->mod = SDL_KMOD_NONE; button->dst = pdest; baseclass_redraw = button->redraw; diff --git a/client/gui-sdl3/widget_checkbox.c b/client/gui-sdl3/widget_checkbox.c index c712ed507e..294a634f26 100644 --- a/client/gui-sdl3/widget_checkbox.c +++ b/client/gui-sdl3/widget_checkbox.c @@ -123,7 +123,7 @@ struct widget *create_checkbox(struct gui_layer *pdest, bool state, set_wflag(cbox, (WF_FREE_STRING | WF_FREE_GFX | WF_FREE_PRIVATE_DATA | flags)); set_wstate(cbox, FC_WS_DISABLED); set_wtype(cbox, WT_CHECKBOX); - cbox->mod = KMOD_NONE; + cbox->mod = SDL_KMOD_NONE; cbox->dst = pdest; ptmp->state = state; ptmp->true_theme = current_theme->cbox_sell_icon; -- 2.42.0