]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Keybinder: make sure the selected keybind is always visible when user clicks a button...
authorterencehill <piuntn@gmail.com>
Tue, 7 Mar 2023 11:15:38 +0000 (12:15 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 7 Mar 2023 11:15:38 +0000 (12:15 +0100)
qcsrc/menu/xonotic/keybinder.qc

index 5a0f9f487f0b5f9b58686f0fcc40f77458d04efa..6d0004151f75231864508fce74439f0bf7c7d209 100644 (file)
@@ -208,6 +208,7 @@ void KeyBinder_Bind_Change(entity btn, entity me)
        if(func == "" || KEYBIND_IS_SPECIAL(func))
                return;
 
+       me.setSelected(me, me.selectedItem); // make it visible if it's hidden
        me.keyGrabButton.forcePressed = 1;
        me.clearButton.disabled = 1;
        keyGrabber = me;
@@ -302,6 +303,8 @@ void KeyBinder_Bind_Edit(entity btn, entity me)
        string descr = KeyBinds_Descriptions[me.selectedItem];
        if(substring(descr, 0, 1) != "$")
                return;
+
+       me.setSelected(me, me.selectedItem); // make it visible if it's hidden
        descr = substring(descr, 1, strlen(descr) - 1);
 
        // Hooray! It IS a user bind!
@@ -317,6 +320,8 @@ void KeyBinder_Bind_Clear(entity btn, entity me)
        if(func == "" || KEYBIND_IS_SPECIAL(func))
                return;
 
+       me.setSelected(me, me.selectedItem); // make it visible if it's hidden
+
        n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
        for(j = 0; j < n; ++j)
        {