switchToPrevWindow() is looking for another window if no previous window was found

This commit is contained in:
Markus Gans 2016-08-21 00:16:34 +02:00
parent 5f3f8468ea
commit f870506194
3 changed files with 34 additions and 5 deletions

View File

@ -1,5 +1,7 @@
2016-08-20 Markus Gans <guru.mail@muenster.de> 2016-08-20 Markus Gans <guru.mail@muenster.de>
* Switch back to the own dialog when you closing a dialog menu * Switch back to the own dialog when you closing a dialog menu
* switchToPrevWindow() is looking for another window
if no previous window was found
2016-08-14 Markus Gans <guru.mail@muenster.de> 2016-08-14 Markus Gans <guru.mail@muenster.de>
* Screen characters now have a transparent * Screen characters now have a transparent

View File

@ -730,11 +730,16 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
if ( title_button.contains(gPos) ) if ( title_button.contains(gPos) )
{ {
FWidget* window_focus_widget;
dialog_menu->unselectItem(); dialog_menu->unselectItem();
dialog_menu->hide(); dialog_menu->hide();
activateWindow(); activateWindow();
raiseWindow(); raiseWindow();
getWindowFocusWidget()->setFocus(); window_focus_widget = getWindowFocusWidget();
if ( window_focus_widget )
window_focus_widget->setFocus();
setClickedWidget(0); setClickedWidget(0);
if ( isModal() ) if ( isModal() )

View File

@ -96,9 +96,6 @@ void FWindow::hide()
if ( area ) if ( area )
area->visible = false; area->visible = false;
if ( isDialog() )
switchToPrevWindow();
FWidget::hide(); FWidget::hide();
} }
@ -406,9 +403,34 @@ void FWindow::setWindowFocusWidget (FWidget* obj)
void FWindow::switchToPrevWindow() void FWindow::switchToPrevWindow()
{ {
// switch to previous window // switch to previous window
activatePrevWindow(); bool is_activated = activatePrevWindow();
FWindow* active_window = getActiveWindow(); FWindow* active_window = getActiveWindow();
if ( ! is_activated )
{
// no previous window -> looking for another window
if ( window_list && window_list->size() > 1 )
{
widgetList::const_iterator iter, begin;
iter = window_list->end();
begin = window_list->begin();
do
{
--iter;
FWindow* w = static_cast<FWindow*>(*iter);
if ( w && w != active_window
&& ! (w->isHiddenWindow() || w->isActiveWindow()) )
{
setActiveWindow(w);
break;
}
}
while ( iter != begin );
}
}
if ( active_window ) if ( active_window )
{ {
FWidget* focus_widget = active_window->getWindowFocusWidget(); FWidget* focus_widget = active_window->getWindowFocusWidget();