Bug fix for FWindow::activatePrevWindow()

This commit is contained in:
Markus Gans 2016-06-26 16:08:03 +02:00
parent e29e58acb6
commit a179e190f9
5 changed files with 32 additions and 30 deletions

View File

@ -1,3 +1,6 @@
2016-06-26 Markus Gans <guru.mail@muenster.de>
* Bug fix for FWindow::activatePrevWindow()
2016-06-25 Markus Gans <guru.mail@muenster.de>
* Move processNextEvent() code into sub functions

View File

@ -753,6 +753,8 @@ void FDialog::onWindowActive (FEvent*)
//----------------------------------------------------------------------
void FDialog::onWindowInactive (FEvent*)
{
FWindow::previous_widget = this;
if ( isVisible() && isEnabled() )
drawTitleBar();

View File

@ -128,6 +128,7 @@ class FWidget : public FObject, public FTerm
typedef std::vector<accelerator> Accelerators;
Accelerators* accelerator_list;
protected:
static struct widget_colors
{
short term_fg;
@ -224,7 +225,6 @@ class FWidget : public FObject, public FTerm
std::vector<bool> left;
} double_flatline_mask;
protected:
int xpos;
int ypos;
int width;

View File

@ -6,6 +6,9 @@
#include "fstatusbar.h"
#include "fwindow.h"
// static attributes
FWindow* FWindow::previous_widget = 0;
//----------------------------------------------------------------------
// class FWindow
//----------------------------------------------------------------------
@ -89,6 +92,7 @@ void FWindow::hide()
//----------------------------------------------------------------------
FWindow* FWindow::getWindowWidgetAt (int x, int y)
{
// returns the window object to the corresponding coordinates
if ( statusBar() && statusBar()->getGeometryGlobal().contains(x,y) )
return statusBar();
@ -367,24 +371,14 @@ void FWindow::switchToPrevWindow()
bool FWindow::activatePrevWindow()
{
// activate the previous window
if ( window_list && window_list->size() > 1 )
{
widgetList::const_iterator iter, begin;
iter = window_list->end();
begin = window_list->begin();
--iter;
do
{
--iter;
FWindow* w = static_cast<FWindow*>(*iter);
FWindow* w = previous_widget;
if ( w && ! w->isHiddenWindow() && ! w->isActiveWindow() )
{
setActiveWindow(w);
return true;
}
}
while ( iter != begin );
}
else
return false;
}

View File

@ -46,6 +46,9 @@ class FWindow : public FWidget
private:
bool window_active;
protected:
static FWindow* previous_widget;
private:
FWindow (const FWindow&);
FWindow& operator = (const FWindow&);