Prevent duplicate widget in the close widget list
This commit is contained in:
parent
af5ec304d8
commit
7462c60cfd
|
@ -1,3 +1,6 @@
|
|||
2021-05-13 Markus Gans <guru.mail@muenster.de>
|
||||
* Prevent duplicate widget in the close widget list
|
||||
|
||||
2021-05-07 Markus Gans <guru.mail@muenster.de>
|
||||
* Some pointers were replaced by references
|
||||
|
||||
|
|
|
@ -851,7 +851,7 @@ bool FWidget::close()
|
|||
{
|
||||
hide();
|
||||
|
||||
if ( ! flags.modal )
|
||||
if ( ! flags.modal && ! isInFWidgetList(close_widget, this) )
|
||||
close_widget->push_back(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
#include "final/fcolorpair.h"
|
||||
#include "final/fstatusbar.h"
|
||||
|
@ -53,6 +55,16 @@ bool isFocusPrevKey (const FKey key)
|
|||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool isInFWidgetList (const FWidget::FWidgetList* list, const FWidget* obj)
|
||||
{
|
||||
if ( ! list || ! obj )
|
||||
return false;
|
||||
|
||||
return std::any_of ( list->begin(), list->end()
|
||||
, [&obj] (FWidget* w) { return w == obj; } );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FApplication* getFApplication()
|
||||
{
|
||||
|
|
|
@ -507,6 +507,7 @@ class FWidget : public FVTerm, public FObject
|
|||
void detectTermSize();
|
||||
bool isFocusNextKey (const FKey);
|
||||
bool isFocusPrevKey (const FKey);
|
||||
bool isInFWidgetList (const FWidget::FWidgetList*, const FWidget*);
|
||||
FKey getHotkey (const FString&);
|
||||
std::size_t getHotkeyPos (const FString& src, FString& dest);
|
||||
void setHotkeyViaString (FWidget*, const FString&);
|
||||
|
|
Loading…
Reference in New Issue