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;
@ -224,7 +225,6 @@ class FWidget : public FObject, public FTerm
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
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -89,6 +92,7 @@ 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,24 +371,14 @@ 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;
{
widgetList::const_iterator iter, begin;
iter = window_list->end();
begin = window_list->begin();
--iter;
do
{
--iter;
FWindow* w = static_cast<FWindow*>(*iter);
if ( w && ! w->isHiddenWindow() && ! w->isActiveWindow() ) if ( w && ! w->isHiddenWindow() && ! w->isActiveWindow() )
{ {
setActiveWindow(w); setActiveWindow(w);
return true; return true;
} }
} else
while ( iter != begin );
}
return false; 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&);