mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-06-20 20:59:57 +02:00
Remove obsolete methods
This commit is contained in:
@@ -7,12 +7,11 @@
|
||||
*/
|
||||
#include <TlHelp32.h>
|
||||
#include <Psapi.h>
|
||||
#include <CommCtrl.h>
|
||||
|
||||
/*
|
||||
* Standard library includes
|
||||
*/
|
||||
#include <array>
|
||||
//#include <array>
|
||||
|
||||
/*
|
||||
* Qt includes
|
||||
@@ -43,15 +42,6 @@ WindowCtrlWin::~WindowCtrlWin()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the states of the TB windows.
|
||||
*/
|
||||
const Preferences::WindowState& WindowCtrlWin::getWindowState( const quint64 window )
|
||||
{
|
||||
return m_tb_window_states[ window ];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the minimize type
|
||||
*/
|
||||
@@ -159,43 +149,6 @@ QString WindowCtrlWin::getProcessName( qint64 pid ) const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find the window by title
|
||||
*/
|
||||
bool WindowCtrlWin::findWindow( const QString& title )
|
||||
{
|
||||
m_tb_windows = QList< quint64 >();
|
||||
|
||||
EnumWindowsTitleProcData data{ *this, title.toStdString() };
|
||||
|
||||
EnumWindows( &enumWindowsTitleProc, reinterpret_cast<LPARAM>(&data) );
|
||||
|
||||
if( m_tb_windows.length() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Callback for the window enumaration title find.
|
||||
*/
|
||||
BOOL CALLBACK WindowCtrlWin::enumWindowsTitleProc( HWND hwnd, LPARAM lParam )
|
||||
{
|
||||
auto& data = *reinterpret_cast<EnumWindowsTitleProcData*>(lParam);
|
||||
std::array<char, 128> buffer;
|
||||
int written = GetWindowTextA( hwnd, buffer.data(), int(buffer.size()) );
|
||||
if( written && strstr( buffer.data(), data.title.c_str() ) != nullptr )
|
||||
{
|
||||
data.window_ctrl.m_tb_windows.append( (quint64)hwnd );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find the window by pid
|
||||
*/
|
||||
@@ -206,15 +159,6 @@ void WindowCtrlWin::findWindows( qint64 pid )
|
||||
|
||||
EnumWindowsPidProcData data{ *this, pid };
|
||||
EnumWindows( &enumWindowsPidProc, reinterpret_cast<LPARAM>(&data) );
|
||||
|
||||
/*
|
||||
emit signalConsole( QString( "Number of windows found: %1" ).arg( m_tb_windows.length() ) );
|
||||
|
||||
for( int i = 0 ; i< m_tb_windows.length() ; ++i )
|
||||
{
|
||||
emit signalConsole( QString( "WinID %1, State %2" ).arg( m_tb_windows.at( i ) ).arg( m_tb_window_states.at( i ) ) );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -271,26 +215,11 @@ BOOL WindowCtrlWin::isMainWindow( HWND hwnd )
|
||||
|
||||
|
||||
/*
|
||||
* Display the window elements
|
||||
* Get the states of the TB windows.
|
||||
*/
|
||||
void WindowCtrlWin::displayWindowElements( const QString& title )
|
||||
const Preferences::WindowState& WindowCtrlWin::getWindowState( const quint64 window )
|
||||
{
|
||||
findWindow( title );
|
||||
|
||||
QList< quint64 > winIds = getWinIds();
|
||||
for( int i = 0 ; i < winIds.length() ; i++ )
|
||||
{
|
||||
emit signalConsole( QString( "Found: XID %1" ).arg( winIds[ i ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display the window elements
|
||||
*/
|
||||
void WindowCtrlWin::displayWindowElements( quint64 window )
|
||||
{
|
||||
emit signalConsole( QString( "Found: XID %1" ).arg( window ) );
|
||||
return m_tb_window_states[ window ];
|
||||
}
|
||||
|
||||
|
||||
@@ -320,12 +249,6 @@ void WindowCtrlWin::minimizeWindowToTray( quint64 window )
|
||||
ShowWindow( (HWND)window, SW_HIDE );
|
||||
|
||||
m_tb_windows_hidden.append( window );
|
||||
|
||||
/*
|
||||
ShowWindow( (HWND)window, SW_MINIMIZE );
|
||||
|
||||
hideWindow( (HWND)window );
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -334,18 +257,6 @@ void WindowCtrlWin::minimizeWindowToTray( quint64 window )
|
||||
*/
|
||||
void WindowCtrlWin::normalizeWindow( quint64 window )
|
||||
{
|
||||
if( !isThunderbird( getPpid() ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long style = GetWindowLong( (HWND)window, GWL_STYLE );
|
||||
|
||||
style &= ~(WS_EX_TOOLWINDOW);
|
||||
style |= WS_EX_APPWINDOW;
|
||||
|
||||
SetWindowLong( (HWND)window, GWL_STYLE, style );
|
||||
|
||||
ShowWindow( (HWND)window, SW_RESTORE );
|
||||
SetForegroundWindow( (HWND)window );
|
||||
}
|
||||
@@ -370,31 +281,11 @@ void WindowCtrlWin::normalizeWindowsHidden()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hide a window
|
||||
*/
|
||||
void WindowCtrlWin::hideWindow( HWND hwnd )
|
||||
{
|
||||
long style = GetWindowLong( hwnd, GWL_STYLE );
|
||||
|
||||
style &= ~(WS_VISIBLE);
|
||||
style |= WS_EX_TOOLWINDOW;
|
||||
style &= ~(WS_EX_APPWINDOW);
|
||||
|
||||
SetWindowLong( hwnd, GWL_STYLE, style );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Delete / Close a window
|
||||
*/
|
||||
void WindowCtrlWin::deleteWindow( quint64 window )
|
||||
{
|
||||
if( !isThunderbird( getPpid() ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SendMessageA( (HWND)window, WM_CLOSE, 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -143,15 +143,6 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
QString getProcessName( qint64 pid ) const;
|
||||
|
||||
/**
|
||||
* @brief findWindow. Find window by title.
|
||||
*
|
||||
* @param title The (part)title to find.
|
||||
*
|
||||
* @return State of the find.
|
||||
*/
|
||||
bool findWindow( const QString& title );
|
||||
|
||||
/**
|
||||
* @brief findWindow. Find window by pid.
|
||||
*
|
||||
@@ -168,20 +159,6 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
const Preferences::WindowState& getWindowState( const quint64 window );
|
||||
|
||||
/**
|
||||
* @brief displayWindowElements. Display window elements.
|
||||
*
|
||||
* @param title The title to find.
|
||||
*/
|
||||
void displayWindowElements( const QString& title );
|
||||
|
||||
/**
|
||||
* @brief displayWindowElements. Display window elements.
|
||||
*
|
||||
* @param title The window id.
|
||||
*/
|
||||
void displayWindowElements( quint64 window );
|
||||
|
||||
/**
|
||||
* @brief getWinIds. Get the Thunderbird window IDs.
|
||||
*
|
||||
@@ -224,23 +201,6 @@ class WindowCtrlWin : public QObject
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief hideWindow. Hide window.
|
||||
*
|
||||
* @param hwnd The window.
|
||||
*/
|
||||
void hideWindow( HWND hwnd );
|
||||
|
||||
/**
|
||||
* @brief EnumWindowsTitleProc. Callback for window enumaration by title.
|
||||
*
|
||||
* @param hwnd Handle of window.
|
||||
* @param lParam Argument passed by EnumWindows.
|
||||
*
|
||||
* @return State of callback. (TRUE = continue / FALSE = stop)
|
||||
*/
|
||||
static BOOL CALLBACK enumWindowsTitleProc( HWND hwnd, LPARAM lParam );
|
||||
|
||||
/**
|
||||
* @brief EnumWindowsPidProc. Callback for window enumaration by pid.
|
||||
*
|
||||
@@ -260,36 +220,6 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
static BOOL isMainWindow( HWND hwnd );
|
||||
|
||||
/**
|
||||
* @brief interceptMinimizeWindow. Intercept minimize event of the TB window.
|
||||
*/
|
||||
void interceptMinimizeWindow();
|
||||
|
||||
/**
|
||||
* @brief stopInterceptMinimizeWindow. Remove the intercept hook.
|
||||
*/
|
||||
void stopInterceptMinimizeWindow();
|
||||
|
||||
/**
|
||||
* @brief handleWinEvent. Callback for the hook.
|
||||
*
|
||||
* @param hook
|
||||
* @param event
|
||||
* @param hwnd
|
||||
* @param idObject
|
||||
* @param idChild
|
||||
* @param dwEventThread
|
||||
* @param dwmsEventTime
|
||||
*/
|
||||
static void CALLBACK handleWinEvent( HWINEVENTHOOK hook, DWORD event, HWND hwnd,
|
||||
LONG idObject, LONG idChild,
|
||||
DWORD dwEventThread, DWORD dwmsEventTime);
|
||||
|
||||
/**
|
||||
* @brief hookAction. Non-static function to be used by the hook callback.
|
||||
*/
|
||||
void hookAction( HWND hWnd );
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user