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> 2016-06-25 Markus Gans <guru.mail@muenster.de>
* Move processNextEvent() code into sub functions * Move processNextEvent() code into sub functions

View File

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

View File

@ -128,6 +128,7 @@ class FWidget : public FObject, public FTerm
typedef std::vector<accelerator> Accelerators; typedef std::vector<accelerator> Accelerators;
Accelerators* accelerator_list; Accelerators* accelerator_list;
protected:
static struct widget_colors static struct widget_colors
{ {
short term_fg; short term_fg;
@ -212,19 +213,18 @@ class FWidget : public FObject, public FTerm
} wc; } wc;
// widget_colors wc; // widget_colors wc;
struct dbl_line_mask struct dbl_line_mask
{ {
dbl_line_mask() : top(), right(), bottom(), left() dbl_line_mask() : top(), right(), bottom(), left()
{ } { }
~dbl_line_mask() ~dbl_line_mask()
{ } { }
std::vector<bool> top; std::vector<bool> top;
std::vector<bool> right; std::vector<bool> right;
std::vector<bool> bottom; std::vector<bool> bottom;
std::vector<bool> left; std::vector<bool> left;
} double_flatline_mask; } double_flatline_mask;
protected:
int xpos; int xpos;
int ypos; int ypos;
int width; int width;

View File

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

View File

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