Fixed view events and active controls not working properly

This commit is contained in:
OM 2023-05-16 19:02:16 +02:00
parent 32028ccf1d
commit 2db3eb868a

View file

@ -170,16 +170,21 @@ void UIWindowManager::ViewEvent
) )
{ {
if( !view ) view = this; if (!view) {
// use the first responder instead
view = m_firstResponder;
}
if( !view->isEnabled() ) if (!view->isEnabled()) {
return; return;
}
Event *ev = new Event( event ); Event *ev = new Event( event );
ev->AddFloat( pos.x ); ev->AddFloat( pos.x );
ev->AddFloat( pos.y ); ev->AddFloat( pos.y );
ev->AddInteger( buttons ); ev->AddInteger( buttons );
ProcessEvent( ev ); // send the event to the view
view->ProcessEvent( ev );
} }
UIWidget *UIWindowManager::getResponder UIWidget *UIWindowManager::getResponder
@ -321,7 +326,6 @@ void UIWindowManager::ServiceEvents
} }
SafePtr<UIWidget> b = m_oldview; SafePtr<UIWidget> b = m_oldview;
m_oldview = NULL;
if( b != view ) if( b != view )
{ {
@ -474,11 +478,11 @@ void UIWindowManager::ActivateControl
if( !m_activeControl ) if( !m_activeControl )
{ {
m_activeControl = this; m_activeControl = control;
m_activeControl->SetHovermaterialActive( true ); control->SetHovermaterialActive( true );
m_activeControl->ActivateOrder(); control->ActivateOrder();
m_activeControl->BringToFrontPropogated(); control->BringToFrontPropogated();
m_activeControl->SendSignal( W_Activated ); control->SendSignal( W_Activated );
} }
} }
} }
@ -652,7 +656,7 @@ qboolean UIWindowManager::KeyEvent
{ {
UIWidget *selwidget = NULL; UIWidget *selwidget = NULL;
if( key == K_TAB && ( uii.Sys_IsKeyDown( K_CTRL ) || uii.Sys_IsKeyDown( K_DEL ) ) ) if( key == K_TAB && ( uii.Sys_IsKeyDown( K_LCTRL ) || uii.Sys_IsKeyDown( K_DEL ) ) )
{ {
UIWidget *wid; UIWidget *wid;