Internal window state storage

This commit is contained in:
Ximi1970
2021-01-03 20:50:17 +01:00
parent c5c70be972
commit a650d1dd6e
3 changed files with 48 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ WindowCtrlUnix::WindowCtrlUnix( QObject *parent ) : QObject( parent )
m_tb_windows = QList< quint64 >();
m_tb_window_positions = QList< QPoint >();
m_tb_window_states = QList< Preferences::WindowState >();
m_tb_window_states_internal = QMap< quint64, Preferences::WindowState >();
m_tb_window_hints = QMap< quint64, SizeHints >();
/*
@@ -375,6 +376,15 @@ const QList< Preferences::WindowState >& WindowCtrlUnix::getWindowStates() co
}
/*
* Get the state of a TB window.
*/
Preferences::WindowState& WindowCtrlUnix::getWindowStateInternal( quint64 window )
{
return m_tb_window_states_internal[ window ];
}
/*
* Display window atoms
*/
@@ -638,6 +648,18 @@ void WindowCtrlUnix::minimizeWindow( quint64 window )
* Remove from taskbar and task switchers
*/
WithdrawWindow( m_display, window );
/*
* Store the window state
*/
m_tb_window_states_internal[ window ] = Preferences::STATE_DOCKED;
}
else
{
/*
* Store the window state
*/
m_tb_window_states_internal[ window ] = Preferences::STATE_MINIMIZED;
}
/*
@@ -716,6 +738,11 @@ void WindowCtrlUnix::normalizeWindow( quint64 window )
Flush( m_display );
}
/*
* Store the window state
*/
m_tb_window_states_internal[ window ] = Preferences::STATE_NORMAL;
/*
* Raise the window to the top
*/

View File

@@ -187,6 +187,15 @@ class WindowCtrlUnix : public QObject
*/
const QList< Preferences::WindowState >& getWindowStates() const;
/**
* @brief getWindowStateInternal
*
* @param window
*
* @return
*/
Preferences::WindowState& getWindowStateInternal( quint64 window );
/**
* @brief displayWindowElements. Display window elements (atoms).
*
@@ -293,6 +302,11 @@ class WindowCtrlUnix : public QObject
*/
QList< Preferences::WindowState > m_tb_window_states;
/**
* @brief m_tb_window_states_internal. The Thunderbird window states (internal).
*/
QMap< quint64, Preferences::WindowState > m_tb_window_states_internal;
/**
* @brief m_tb_window_hints. The Thunderbird window hints.
*/

View File

@@ -297,6 +297,10 @@ void WindowCtrl::slotShowHide()
emit signalConsole( QString( "Window state: %1, %2" )
.arg( win_ids.at( i ) )
.arg( Preferences::WindowStateString.at( win_states.at( i ) ) ) );
emit signalConsole( QString( "Window state: %1, %2" )
.arg( win_ids.at( i ) )
.arg( Preferences::WindowStateString.at( getWindowStateInternal( win_ids.at( i ) ) ) ) );
#endif
#ifdef Q_OS_UNIX
@@ -305,7 +309,9 @@ void WindowCtrl::slotShowHide()
#endif
if( win_states.at( i ) == Preferences::STATE_MINIMIZED || win_states.at( i ) == Preferences::STATE_DOCKED )
// if( win_states.at( i ) == Preferences::STATE_MINIMIZED || win_states.at( i ) == Preferences::STATE_DOCKED )
if( getWindowStateInternal( win_ids.at( i ) ) == Preferences::STATE_MINIMIZED || getWindowStateInternal( win_ids.at( i ) ) == Preferences::STATE_DOCKED )
{
normalizeWindow( win_ids.at( i ) );
}