From: terencehill Date: Sat, 15 Dec 2012 17:06:59 +0000 (+0100) Subject: Disable Clear button while waiting for an input key in the input dialog otherwise... X-Git-Tag: xonotic-v0.7.0~113^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9847bdf79c123bf993f18531a7ce101576156c5;p=xonotic%2Fxonotic-data.pk3dir.git 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. --- 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;