diff --git a/src/eepp/ui/uinode.cpp b/src/eepp/ui/uinode.cpp index ebed7c634..5ea4d6c18 100644 --- a/src/eepp/ui/uinode.cpp +++ b/src/eepp/ui/uinode.cpp @@ -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(); diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index c728be30c..20097f4cc 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -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()->pushState( UIState::StateFocusWithin ); + parent->asType()->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()->popState( UIState::StateFocusWithin ); + parent->asType()->sendCommonEvent( Event::OnFocusWithinLoss ); + } parent = parent->getParent(); }