X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fmenu%2Fitem%2Finputcontainer.qc;h=cda342677262206dd8afb2bcdb011f136ed2edc9;hp=37c46240f77fdcd8bf704b1b6d999aaa3de5e254;hb=58032876ef7ef5d8978989144dfa20e84457ee37;hpb=cff3504ad5e8ace014ea44de7ad04ad6e246a277 diff --git a/qcsrc/menu/item/inputcontainer.qc b/qcsrc/menu/item/inputcontainer.qc index 37c46240f..cda342677 100644 --- a/qcsrc/menu/item/inputcontainer.qc +++ b/qcsrc/menu/item/inputcontainer.qc @@ -89,11 +89,10 @@ if (e && !e.focusable) e = NULL; entity prev = this.mouseFocusedChild; this.mouseFocusedChild = e; - if (!e) return false; // keep focus when hovering over non-focusable elements if (e != prev) { this.setFocus(this, e); - if (e.instanceOfInputContainer) + if (e && e.instanceOfInputContainer) { e.focusedChild = NULL; e._changeFocusXY(e, globalToBox(pos, e.Container_origin, e.Container_size)); @@ -117,13 +116,13 @@ if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1; return 0; } - float InputContainer_mousePress(entity me, vector pos) + METHOD(InputContainer, mousePress, bool(InputContainer this, vector pos)) { - me.mouseFocusedChild = NULL; // force focusing - if (me._changeFocusXY(me, pos)) - if (SUPER(InputContainer).mousePress(me, pos)) return 1; - if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1; - return 0; + this.mouseFocusedChild = NULL; // force focusing + if (this._changeFocusXY(this, pos)) + if (SUPER(InputContainer).mousePress(this, pos)) return true; + if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return true; + return false; } float InputContainer_mouseRelease(entity me, vector pos) {