r2853 - in trunk/data/qcsrc/menu-div0test: . item
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Oct 26 08:34:31 EDT 2007
Author: div0
Date: 2007-10-26 08:34:30 -0400 (Fri, 26 Oct 2007)
New Revision: 2853
Modified:
trunk/data/qcsrc/menu-div0test/item/container.c
trunk/data/qcsrc/menu-div0test/item/inputcontainer.c
trunk/data/qcsrc/menu-div0test/item/modalcontroller.c
trunk/data/qcsrc/menu-div0test/item/nexposee.c
trunk/data/qcsrc/menu-div0test/menu.qc
Log:
some focus cleanups
Modified: trunk/data/qcsrc/menu-div0test/item/container.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/container.c 2007-10-26 11:48:35 UTC (rev 2852)
+++ trunk/data/qcsrc/menu-div0test/item/container.c 2007-10-26 12:34:30 UTC (rev 2853)
@@ -92,9 +92,7 @@
void focusLeaveContainer(entity me)
{
- if(me.focusedChild)
- me.focusedChild.focused = 0;
- me.focusedChild = NULL;
+ me.setFocus(me, NULL);
}
float keyUpContainer(entity me, float scan, float ascii, float shift)
@@ -208,6 +206,7 @@
{
if(me.focusedChild == other)
return;
+ print(etos(me), ": focus changes from ", etos(me.focusedChild), " to ", etos(other), "\n");
if(me.focusedChild)
{
me.focusedChild.focused = 0;
Modified: trunk/data/qcsrc/menu-div0test/item/inputcontainer.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/inputcontainer.c 2007-10-26 11:48:35 UTC (rev 2852)
+++ trunk/data/qcsrc/menu-div0test/item/inputcontainer.c 2007-10-26 12:34:30 UTC (rev 2853)
@@ -153,9 +153,9 @@
{
float r;
r = mouseReleaseContainer(me, pos);
- me._changeFocusXY(me, pos);
- if(r)
- return 1;
+ 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;
if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
return 1;
return 0;
Modified: trunk/data/qcsrc/menu-div0test/item/modalcontroller.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/modalcontroller.c 2007-10-26 11:48:35 UTC (rev 2852)
+++ trunk/data/qcsrc/menu-div0test/item/modalcontroller.c 2007-10-26 12:34:30 UTC (rev 2853)
@@ -212,10 +212,10 @@
// --> (maxima)
// o' = (to * (f - f_prev) + o * (1 - f)) / (1 - f_prev)
}
- if(animating)
- me.focusedChild = NULL;
+ if(animating || !me.focused)
+ me.setFocus(me, NULL);
else
- me.focusedChild = front;
+ me.setFocus(me, front);
drawContainer(me);
};
@@ -244,14 +244,15 @@
void setFocusModalController(entity me, entity other)
{
- error("Sorry, modal controllers can't handle setFocus");
+ //print("focus to ", etos(other), "\n");
+ setFocusContainer(me, other);
}
void showChildModalController(entity me, entity other, vector theOrigin, vector theSize, float skipAnimation)
{
if(other.ModalController_state == 0)
{
- me.focusedChild = NULL;
+ me.setFocus(me, NULL);
other.ModalController_buttonOrigin = globalToBox(theOrigin, me.origin, me.size);
other.ModalController_buttonSize = globalToBoxSize(theSize, me.size);
me.switchState(me, other, 1, skipAnimation);
@@ -269,7 +270,7 @@
{
if(other.ModalController_state)
{
- me.focusedChild = NULL;
+ me.setFocus(me, NULL);
me.switchState(me, other, 0, skipAnimation);
if(other.ModalController_controllingButton)
{
Modified: trunk/data/qcsrc/menu-div0test/item/nexposee.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/nexposee.c 2007-10-26 11:48:35 UTC (rev 2852)
+++ trunk/data/qcsrc/menu-div0test/item/nexposee.c 2007-10-26 12:34:30 UTC (rev 2853)
@@ -8,7 +8,8 @@
METHOD(Nexposee, mouseRelease, float(entity, vector))
METHOD(Nexposee, mouseDrag, float(entity, vector))
METHOD(Nexposee, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(Nexposee, setFocus, void(entity, entity))
+ //METHOD(Nexposee, setFocus, void(entity, entity))
+ METHOD(Nexposee, focusEnter, void(entity))
ATTRIB(Nexposee, animationState, float, -1)
ATTRIB(Nexposee, animationFactor, float, 0)
@@ -44,7 +45,9 @@
void ExposeeCloseButton_Click(entity button, entity other)
{
+ other.selectedChild = other.focusedChild;
other.setFocus(other, NULL);
+ other.animationState = 3;
}
void resizeNotifyNexposee(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
@@ -314,13 +317,20 @@
addItemContainer(me, other, theOrigin, theSize, theAlpha);
}
+void focusEnterNexposee(entity me)
+{
+ if(me.animationState == 2)
+ setFocusContainer(me, me.selectedChild);
+}
+
void setFocusNexposee(entity me, entity other)
{
+/*
if(me.animationState == 0)
{
if(other != NULL)
{
- me.focusedChild = other;
+ setFocusContainer(me, other);
me.selectedChild = other;
me.animationState = 1;
}
@@ -330,9 +340,10 @@
if(other == NULL)
{
me.selectedChild = me.focusedChild;
- me.focusedChild = NULL;
+ setFocusContainer(me, NULL);
me.animationState = 3;
}
}
+*/
}
#endif
Modified: trunk/data/qcsrc/menu-div0test/menu.qc
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qc 2007-10-26 11:48:35 UTC (rev 2852)
+++ trunk/data/qcsrc/menu-div0test/menu.qc 2007-10-26 12:34:30 UTC (rev 2853)
@@ -24,6 +24,7 @@
main = spawnMainWindow(); main.configureMainWindow(main);
draw_reset();
main.resizeNotify(main, draw_shift, draw_scale, draw_shift, draw_scale);
+ main.focused = 1;
shiftState = 0;
};
More information about the nexuiz-commits
mailing list