tBug fix for keyboard shortcuts in the Fight dialog not being disabled when the buttons are hidden. - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 41edc2764dddcff0a4a09b4c008c31492c9eef4f
(DIR) parent c1ed313e16e1f3bea05f17a25390b591ed152e05
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Mon, 13 May 2002 16:26:40 +0000
Bug fix for keyboard shortcuts in the Fight dialog not being disabled when
tthe buttons are hidden.
Diffstat:
M ChangeLog | 3 +++
M src/gui_client/gtk_client.c | 35 +++++++++++++------------------
2 files changed, 18 insertions(+), 20 deletions(-)
---
(DIR) diff --git a/ChangeLog b/ChangeLog
t@@ -6,6 +6,9 @@ cvs
sensibly (it's all done server-side, and spurious warnings are now
removed - only an old client connecting to a new server will
trigger them)
+ - Bug fix: when the buttons in the Fight dialog are not visible to a
+ mouse user, previously you were able to access them via. the keyboard
+ shortcuts; now fixed.
1.5.6 29-04-2002
- Bug fix: the server will only let you pay back loans or deal with the
(DIR) diff --git a/src/gui_client/gtk_client.c b/src/gui_client/gtk_client.c
t@@ -1057,6 +1057,17 @@ static void FreeCombatants(void)
g_array_free(combatants, TRUE);
}
+static void EnableFightButton(GtkWidget *button, gboolean enable)
+{
+ if (enable) {
+ gtk_widget_set_sensitive(button, TRUE);
+ gtk_widget_show(button);
+ } else {
+ gtk_widget_hide(button);
+ gtk_widget_set_sensitive(button, FALSE);
+ }
+}
+
/*
* Given the network message "Data" concerning some happening during
* combat, extracts the relevant data and updates the Fight dialog,
t@@ -1149,26 +1160,10 @@ void DisplayFightMessage(char *Data)
TextViewAppend(textview, "\n", NULL, TRUE);
}
- if (!CanRunHere || fp == F_LASTLEAVE) {
- gtk_widget_show(Deal);
- } else {
- gtk_widget_hide(Deal);
- }
- if (CanFire && TotalGunsCarried(Play) > 0) {
- gtk_widget_show(Fight);
- } else {
- gtk_widget_hide(Fight);
- }
- if (CanFire && TotalGunsCarried(Play) == 0) {
- gtk_widget_show(Stand);
- } else {
- gtk_widget_hide(Stand);
- }
- if (fp != F_LASTLEAVE) {
- gtk_widget_show(Run);
- } else {
- gtk_widget_hide(Run);
- }
+ EnableFightButton(Deal, !CanRunHere || fp == F_LASTLEAVE);
+ EnableFightButton(Fight, CanFire && TotalGunsCarried(Play) > 0);
+ EnableFightButton(Stand, CanFire && TotalGunsCarried(Play) == 0);
+ EnableFightButton(Run, fp != F_LASTLEAVE);
}
/*