Fix Event::OnFocusWithin and Event::OnFocusWithinLoss not being correctly emited.

This commit is contained in:
Martín Lucas Golini
2026-06-04 01:02:30 -03:00
parent 3be4de9b5e
commit 7aaa068d61
2 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -1346,7 +1346,7 @@ void UINode::pushState( const Uint32& State, bool emitEvent ) {
if ( emitEvent ) {
onStateChange();
if ( State & UIState::StateFocusWithin )
if ( mState & UIState::StateFlagFocusWithin )
sendCommonEvent( Event::OnFocusWithin );
} else {
invalidateDraw();
@@ -1364,7 +1364,7 @@ void UINode::popState( const Uint32& State, bool emitEvent ) {
if ( emitEvent ) {
onStateChange();
if ( State & UIState::StateFocusWithin )
if ( mState & UIState::StateFlagFocusWithin )
sendCommonEvent( Event::OnFocusWithinLoss );
} else {
invalidateDraw();
+8 -8
View File
@@ -1314,9 +1314,6 @@ void UIWidget::pushState( const Uint32& State, bool emitEvent ) {
if ( emitEvent ) {
onStateChange();
if ( State & UIState::StateFocusWithin )
sendCommonEvent( Event::OnFocusWithin );
} else {
invalidateDraw();
}
@@ -1339,9 +1336,6 @@ void UIWidget::popState( const Uint32& State, bool emitEvent ) {
if ( emitEvent ) {
onStateChange();
if ( State & UIState::StateFocusWithin )
sendCommonEvent( Event::OnFocusWithinLoss );
} else {
invalidateDraw();
}
@@ -1350,11 +1344,14 @@ void UIWidget::popState( const Uint32& State, bool emitEvent ) {
Uint32 UIWidget::onFocus( NodeFocusReason reason ) {
pushState( UIState::StateFocusWithin );
sendCommonEvent( Event::OnFocusWithin );
Node* parent = mParentNode;
while ( parent ) {
if ( parent->isUINode() )
if ( parent->isUINode() ) {
parent->asType<UINode>()->pushState( UIState::StateFocusWithin );
parent->asType<UINode>()->sendCommonEvent( Event::OnFocusWithin );
}
parent = parent->getParent();
}
@@ -1363,11 +1360,14 @@ Uint32 UIWidget::onFocus( NodeFocusReason reason ) {
Uint32 UIWidget::onFocusLoss() {
popState( UIState::StateFocusWithin );
sendCommonEvent( Event::OnFocusWithinLoss );
Node* parent = mParentNode;
while ( parent ) {
if ( parent->isUINode() )
if ( parent->isUINode() ) {
parent->asType<UINode>()->popState( UIState::StateFocusWithin );
parent->asType<UINode>()->sendCommonEvent( Event::OnFocusWithinLoss );
}
parent = parent->getParent();
}