From d9847bdf79c123bf993f18531a7ce101576156c5 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 15 Dec 2012 18:06:59 +0100 Subject: [PATCH] Disable Clear button while waiting for an input key in the input dialog otherwise if you press the Clear button you assign MOUSE1 and immediately clear it, with the result that you loose MOUSE1 bind from primary fire. --- qcsrc/menu/xonotic/dialog_settings_input.c | 1 + qcsrc/menu/xonotic/keybinder.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/qcsrc/menu/xonotic/dialog_settings_input.c b/qcsrc/menu/xonotic/dialog_settings_input.c index 96bf5e5c6..daa8f3ff1 100644 --- a/qcsrc/menu/xonotic/dialog_settings_input.c +++ b/qcsrc/menu/xonotic/dialog_settings_input.c @@ -40,6 +40,7 @@ void XonoticInputSettingsTab_fill(entity me) me.TD(me, 1, 1, e = makeXonoticButton(_("Clear"), '0 0 0')); e.onClick = KeyBinder_Bind_Clear; e.onClickEntity = kb; + kb.clearButton = e; me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn); me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("Pressing \"enter console\" key also closes it"))); diff --git a/qcsrc/menu/xonotic/keybinder.c b/qcsrc/menu/xonotic/keybinder.c index fbd7c3997..739be1b05 100644 --- a/qcsrc/menu/xonotic/keybinder.c +++ b/qcsrc/menu/xonotic/keybinder.c @@ -22,6 +22,7 @@ CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox) ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0) ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL) ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL) + ATTRIB(XonoticKeyBinder, clearButton, entity, NULL) ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL) METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string)) ENDCLASS(XonoticKeyBinder) @@ -128,6 +129,7 @@ void KeyBinder_Bind_Change(entity btn, entity me) return; me.keyGrabButton.forcePressed = 1; + me.clearButton.disabled = 1; keyGrabber = me; } void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii) @@ -136,6 +138,8 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii) string func; me.keyGrabButton.forcePressed = 0; + me.clearButton.disabled = 0; + if(key == K_ESCAPE) return; -- 2.39.2