mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-05-07 06:36:29 +02:00
Update for windows
This commit is contained in:
@@ -237,13 +237,6 @@ class WindowCtrlUnix : public QObject
|
||||
*/
|
||||
const QList< quint64 >& getWinIds() const;
|
||||
|
||||
/**
|
||||
* @brief removeRefId. Remove the TB window Id from the reference list.
|
||||
*
|
||||
* @param id The TB window id.
|
||||
*/
|
||||
void removeRefId( int id );
|
||||
|
||||
/**
|
||||
* @brief getRefIds. Get the reference IDs.
|
||||
*
|
||||
@@ -251,6 +244,13 @@ class WindowCtrlUnix : public QObject
|
||||
*/
|
||||
const QMap< int, quint64 >& getRefIds() const;
|
||||
|
||||
/**
|
||||
* @brief removeRefId. Remove the TB window Id from the reference list.
|
||||
*
|
||||
* @param id The TB window id.
|
||||
*/
|
||||
void removeRefId( int id );
|
||||
|
||||
/**
|
||||
* @brief getWindowState. Get the state of a TB windows.
|
||||
*
|
||||
|
||||
@@ -219,6 +219,50 @@ const Preferences::WindowState& WindowCtrlWin::getWindowState( const quint64
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Try to match the TB window id to a x11 window
|
||||
*/
|
||||
void WindowCtrlWin::identifyWindow( int id )
|
||||
{
|
||||
/*
|
||||
* Get all the windows connected to TB
|
||||
*/
|
||||
findWindows( getPpid() );
|
||||
|
||||
/*
|
||||
* Get the list
|
||||
*/
|
||||
QList<quint64> win_list = m_tb_windows;
|
||||
|
||||
/*
|
||||
* Remove known ids
|
||||
*/
|
||||
QMapIterator<int, quint64> it(m_tb_window_refs);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
|
||||
int found = win_list.indexOf( it.value() );
|
||||
if( found != -1 )
|
||||
{
|
||||
win_list.removeAt( found );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Should only one remain
|
||||
*/
|
||||
if( win_list.length() > 0 )
|
||||
{
|
||||
m_tb_window_refs[ id ] = win_list[ 0 ];
|
||||
}
|
||||
|
||||
if( win_list.length() != 1 )
|
||||
{
|
||||
// emit signalConsole( QString( "Unexpected Ids: %1" ).arg( win_list.length() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the Thunderbird window IDs
|
||||
*/
|
||||
@@ -228,6 +272,24 @@ QList< quint64 > WindowCtrlWin::getWinIds()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the reference IDs
|
||||
*/
|
||||
const QMap< int, quint64 >& WindowCtrlWin::getRefIds() const
|
||||
{
|
||||
return m_tb_window_refs;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the reference IDs
|
||||
*/
|
||||
void WindowCtrlWin::removeRefId( int id )
|
||||
{
|
||||
m_tb_window_refs.remove( id );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Minimize a window to the taskbar
|
||||
*/
|
||||
|
||||
@@ -150,6 +150,13 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
void findWindows( qint64 pid );
|
||||
|
||||
/**
|
||||
* @brief identifyWindow. Try to connect th TB window id to a X11 window.
|
||||
*
|
||||
* @param id The TB windows id.
|
||||
*/
|
||||
void identifyWindow( int id );
|
||||
|
||||
/**
|
||||
* @brief getWindowState. Get the state of a TB windows.
|
||||
*
|
||||
@@ -166,6 +173,20 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
QList< quint64 > getWinIds();
|
||||
|
||||
/**
|
||||
* @brief getRefIds. Get the reference IDs.
|
||||
*
|
||||
* @return The list of reference IDs.
|
||||
*/
|
||||
const QMap< int, quint64 >& getRefIds() const;
|
||||
|
||||
/**
|
||||
* @brief removeRefId. Remove the TB window Id from the reference list.
|
||||
*
|
||||
* @param id The TB window id.
|
||||
*/
|
||||
void removeRefId( int id );
|
||||
|
||||
/**
|
||||
* @brief minimizeWindowToTaskbar. Minimize window to the taskbar.
|
||||
*
|
||||
@@ -263,6 +284,11 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
QList< quint64 > m_tb_windows_hidden;
|
||||
|
||||
/**
|
||||
* @brief m_tb_window_refs. The Thunderbird window ids referenced to x11 windows.
|
||||
*/
|
||||
QMap< int, quint64 > m_tb_window_refs;
|
||||
|
||||
/**
|
||||
* @brief m_tb_window_states. The Thunderbird window states.
|
||||
*/
|
||||
|
||||
@@ -413,6 +413,8 @@ void WindowCtrl::slotNewWindow( int id )
|
||||
* Try to find a corresponding x11 window
|
||||
*/
|
||||
identifyWindow( id );
|
||||
|
||||
displayRefs();
|
||||
}
|
||||
|
||||
|
||||
@@ -427,6 +429,8 @@ void WindowCtrl::slotCloseWindow( int id, bool quit )
|
||||
* Window is closed by TB
|
||||
*/
|
||||
removeRefId( id );
|
||||
|
||||
displayRefs();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -444,4 +448,18 @@ void WindowCtrl::slotCloseWindow( int id, bool quit )
|
||||
minimizeWindowToTaskbar( ref_list[ id ] );
|
||||
}
|
||||
}
|
||||
|
||||
displayRefs();
|
||||
}
|
||||
|
||||
void WindowCtrl::displayRefs()
|
||||
{
|
||||
QMap< int, quint64 > ref_list = getRefIds();
|
||||
|
||||
QMapIterator<int, quint64> it( ref_list );
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
|
||||
emit signalConsole( QString( "Ref: %1, %2" ).arg( it.key() ).arg( it.value(), 16 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,8 @@ class WindowCtrl : public QObject
|
||||
*/
|
||||
void slotCloseWindow( int id, bool quit );
|
||||
|
||||
void displayRefs();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user