Improvement in widget focusing

This commit is contained in:
Markus Gans 2019-01-07 05:03:00 +01:00
parent 2b110d87d8
commit 6a91738f48
3 changed files with 8 additions and 14 deletions

View File

@ -131,10 +131,8 @@ void Transparent::onKeyPress (finalcut::FKeyEvent* ev)
if ( ev->key() == 'q' && getParentWidget() )
{
if ( getParentWidget()->close() )
ev->accept();
else
ev->ignore();
getParentWidget()->close();
ev->accept();
}
else
finalcut::FDialog::onKeyPress(ev);
@ -224,7 +222,6 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
// Statusbar at the bottom
status_bar.setMessage("Press Q to quit");
addAccelerator('q');
unsetTransparentShadow();
activateDialog();
}

View File

@ -1192,7 +1192,7 @@ bool FApplication::processNextEvent()
void FApplication::performTimerAction ( const FObject* receiver
, const FEvent* event )
{
sendEvent(receiver, event);
sendEvent (receiver, event);
}
} // namespace finalcut

View File

@ -267,16 +267,10 @@ bool FWidget::setFocus (bool enable)
// set widget focus
if ( enable && ! flags.focus )
{
int focusable_children = numOfFocusableChildren();
if ( last_focus )
last_focus->unsetFocus();
if ( (!isDialogWidget() && focusable_children == 0)
|| (isDialogWidget() && focusable_children == 1) )
{
FWidget::setFocusWidget(this);
}
FWidget::setFocusWidget(this);
}
auto window = FWindow::getWindowWidget(this);
@ -292,6 +286,7 @@ bool FWidget::setFocus (bool enable)
if ( has_raised && window->isVisible() && window->isShown() )
window->redraw();
}
window->setWindowFocusWidget(this);
}
@ -790,7 +785,9 @@ int FWidget::numOfFocusableChildren()
{
auto widget = static_cast<FWidget*>(*iter);
if ( widget->acceptFocus() )
if ( widget->isVisible()
&& widget->acceptFocus()
&& ! widget->isWindowWidget() )
num++;
}