From e234f2b1472efd1fdfe8701fc60fe5a645e710b2 Mon Sep 17 00:00:00 2001 From: Dino Date: Wed, 15 Oct 2025 22:19:47 -0400 Subject: [PATCH] #1435 - fix gtk4 client problem, letter "c" gets blocked in chat --- client/gui-gtk-4.0/chatline.c | 6 ++++-- client/gui-gtk-4.0/menu.c | 16 +++++++++++++--- client/gui-gtk-4.0/menu.h | 3 ++- client/gui-gtk-5.0/chatline.c | 6 ++++-- client/gui-gtk-5.0/menu.c | 16 +++++++++++++--- client/gui-gtk-5.0/menu.h | 3 ++- 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/client/gui-gtk-4.0/chatline.c b/client/gui-gtk-4.0/chatline.c index b5db7f64bf..668e342eba 100644 --- a/client/gui-gtk-4.0/chatline.c +++ b/client/gui-gtk-4.0/chatline.c @@ -97,7 +97,8 @@ bool inputline_is_visible(void) static gboolean il_lost_focus(GtkEventControllerFocus *controller, gpointer data) { - real_menus_update(); + menus_toggle_unit_commands(TRUE); + menus_toggle_player_commands(TRUE); return TRUE; } @@ -108,7 +109,8 @@ static gboolean il_lost_focus(GtkEventControllerFocus *controller, static gboolean il_gained_focus(GtkEventControllerFocus *controller, gpointer data) { - menus_disable_unit_commands(); + menus_toggle_unit_commands(FALSE); + menus_toggle_player_commands(FALSE); return TRUE; } diff --git a/client/gui-gtk-4.0/menu.c b/client/gui-gtk-4.0/menu.c index 32789d05b2..e9e6363aa8 100644 --- a/client/gui-gtk-4.0/menu.c +++ b/client/gui-gtk-4.0/menu.c @@ -4176,9 +4176,19 @@ void enable_menus(bool enable) } /**********************************************************************//** - Disable all unit related commands. + Toggle enable/disable all unit related commands. **************************************************************************/ -void menus_disable_unit_commands(void) +void menus_toggle_unit_commands(bool enable) { - menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), MGROUP_UNIT, FALSE); + menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), + MGROUP_UNIT, enable); +} + +/**********************************************************************//** + Toggle enable/disable all player related commands. +**************************************************************************/ +void menus_toggle_player_commands(bool enable) +{ + menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), + MGROUP_PLAYER, enable); } diff --git a/client/gui-gtk-4.0/menu.h b/client/gui-gtk-4.0/menu.h index 88a5029369..1dc9aaa8bb 100644 --- a/client/gui-gtk-4.0/menu.h +++ b/client/gui-gtk-4.0/menu.h @@ -21,6 +21,7 @@ void enable_menus(bool enable); void menus_set_initial_toggle_values(void); -void menus_disable_unit_commands(void); +void menus_toggle_unit_commands(bool enable); +void menus_toggle_player_commands(bool enable); #endif /* FC__MENU_H */ diff --git a/client/gui-gtk-5.0/chatline.c b/client/gui-gtk-5.0/chatline.c index 5988b82238..3b1524a7fb 100644 --- a/client/gui-gtk-5.0/chatline.c +++ b/client/gui-gtk-5.0/chatline.c @@ -97,7 +97,8 @@ bool inputline_is_visible(void) static gboolean il_lost_focus(GtkEventControllerFocus *controller, gpointer data) { - real_menus_update(); + menus_toggle_unit_commands(TRUE); + menus_toggle_player_commands(TRUE); return TRUE; } @@ -108,7 +109,8 @@ static gboolean il_lost_focus(GtkEventControllerFocus *controller, static gboolean il_gained_focus(GtkEventControllerFocus *controller, gpointer data) { - menus_disable_unit_commands(); + menus_toggle_unit_commands(FALSE); + menus_toggle_player_commands(FALSE); return TRUE; } diff --git a/client/gui-gtk-5.0/menu.c b/client/gui-gtk-5.0/menu.c index 150d737920..8e1216332f 100644 --- a/client/gui-gtk-5.0/menu.c +++ b/client/gui-gtk-5.0/menu.c @@ -4180,9 +4180,19 @@ void enable_menus(bool enable) } /**********************************************************************//** - Disable all unit related commands. + Toggle enable/disable all unit related commands. **************************************************************************/ -void menus_disable_unit_commands(void) +void menus_toggle_unit_commands(bool enable) { - menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), MGROUP_UNIT, FALSE); + menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), + MGROUP_UNIT, enable); +} + +/**********************************************************************//** + Toggle enable/disable all player related commands. +**************************************************************************/ +void menus_toggle_player_commands(bool enable) +{ + menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), + MGROUP_PLAYER, enable); } diff --git a/client/gui-gtk-5.0/menu.h b/client/gui-gtk-5.0/menu.h index 88a5029369..1dc9aaa8bb 100644 --- a/client/gui-gtk-5.0/menu.h +++ b/client/gui-gtk-5.0/menu.h @@ -21,6 +21,7 @@ void enable_menus(bool enable); void menus_set_initial_toggle_values(void); -void menus_disable_unit_commands(void); +void menus_toggle_unit_commands(bool enable); +void menus_toggle_player_commands(bool enable); #endif /* FC__MENU_H */ -- 2.31.0