]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/item/inputcontainer.c
Merge branch 'master' into terencehill/vehicles_fixes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / inputcontainer.c
index e1b14d3b1602d468d08ccdf6b26ef0aaf48b43df..0f80c2b503dbd4a40a77d062470108035afc58f2 100644 (file)
@@ -56,7 +56,7 @@ float InputContainer_keyDown(entity me, float scan, float ascii, float shift)
                        {
                                for(ff = f.prevSibling; ff; ff = ff.prevSibling)
                                {
-                                       if not(ff.focusable)
+                                       if (!ff.focusable)
                                                continue;
                                        me.setFocus(me, ff);
                                        return 1;
@@ -66,7 +66,7 @@ float InputContainer_keyDown(entity me, float scan, float ascii, float shift)
                        {
                                for(ff = me.lastChild; ff; ff = ff.prevSibling)
                                {
-                                       if not(ff.focusable)
+                                       if (!ff.focusable)
                                                continue;
                                        me.setFocus(me, ff);
                                        return 1;
@@ -80,7 +80,7 @@ float InputContainer_keyDown(entity me, float scan, float ascii, float shift)
                        {
                                for(ff = f.nextSibling; ff; ff = ff.nextSibling)
                                {
-                                       if not(ff.focusable)
+                                       if (!ff.focusable)
                                                continue;
                                        me.setFocus(me, ff);
                                        return 1;
@@ -90,7 +90,7 @@ float InputContainer_keyDown(entity me, float scan, float ascii, float shift)
                        {
                                for(ff = me.firstChild; ff; ff = ff.nextSibling)
                                {
-                                       if not(ff.focusable)
+                                       if (!ff.focusable)
                                                continue;
                                        me.setFocus(me, ff);
                                        return 1;
@@ -108,7 +108,7 @@ float InputContainer__changeFocusXY(entity me, vector pos)
        e = me.mouseFocusedChild;
        ne = me.itemFromPoint(me, pos);
        if(ne)
-               if not(ne.focusable)
+               if (!ne.focusable)
                        ne = NULL;
        me.mouseFocusedChild = ne;
        if(ne)
@@ -134,6 +134,8 @@ float InputContainer_mouseDrag(entity me, vector pos)
 }
 float InputContainer_mouseMove(entity me, vector pos)
 {
+       if(me.mouseFocusedChild != me.focusedChild) // if the keyboard moved the focus away
+               me.mouseFocusedChild = NULL; // force focusing
        if(me._changeFocusXY(me, pos))
                if(SUPER(InputContainer).mouseMove(me, pos))
                        return 1;
@@ -153,8 +155,7 @@ float InputContainer_mousePress(entity me, vector pos)
 }
 float InputContainer_mouseRelease(entity me, vector pos)
 {
-       float r;
-       r = SUPER(InputContainer).mouseRelease(me, pos);
+       SUPER(InputContainer).mouseRelease(me, pos); // return value?
        if(me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away)
                if(me._changeFocusXY(me, pos))
                        return 1;