mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-06-23 05:20:16 +02:00
Remove obsolete methods
This commit is contained in:
@@ -148,44 +148,6 @@ QString WindowCtrlUnix::getProcessName( qint64 pid ) const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find window(s) by title
|
||||
*/
|
||||
bool WindowCtrlUnix::findWindow( const QString& title )
|
||||
{
|
||||
QList< WindowItem > windows = listXWindows( m_display, GetDefaultRootWindow( m_display ) );
|
||||
|
||||
m_tb_windows = QList< quint64 >();
|
||||
m_tb_window_positions = QMap< quint64, QPoint >();
|
||||
for( int i = 0 ; i < windows.length() ; ++i )
|
||||
{
|
||||
WindowItem win = windows.at( i );
|
||||
|
||||
char *name = nullptr;
|
||||
if( FetchName( m_display, win.window, &name ) > 0 ) {
|
||||
QString win_name( name );
|
||||
|
||||
Free( name );
|
||||
|
||||
if( win_name.contains( title, Qt::CaseInsensitive ) ) {
|
||||
/*
|
||||
* Store the XID
|
||||
*/
|
||||
m_tb_windows.append( win.window );
|
||||
m_tb_window_positions[ win.window ] = QPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_tb_windows.length() > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find a window by PID
|
||||
*/
|
||||
@@ -341,159 +303,6 @@ const Preferences::WindowState& WindowCtrlUnix::getWindowStateX11( const quin
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display window atoms
|
||||
*/
|
||||
void WindowCtrlUnix::displayWindowElements( const QString& title )
|
||||
{
|
||||
QList< WindowItem > windows = listXWindows( m_display, GetDefaultRootWindow( m_display ) );
|
||||
|
||||
for( int i = 0 ; i < windows.length() ; ++i )
|
||||
{
|
||||
WindowItem win = windows.at( i );
|
||||
|
||||
char *name = nullptr;
|
||||
if( FetchName( m_display, win.window, &name ) > 0 ) {
|
||||
QString win_name( name );
|
||||
|
||||
Free( name );
|
||||
|
||||
if( win_name.contains( title, Qt::CaseInsensitive ) ) {
|
||||
|
||||
emit signalConsole( QString( "Found: Level %1, XID %2, Name %3" ).arg( win.level ).arg( win.window ).arg( win_name ) );
|
||||
|
||||
displayWindowElements( win.window );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display window atoms
|
||||
*/
|
||||
void WindowCtrlUnix::displayWindowElements( quint64 window )
|
||||
{
|
||||
QString name;
|
||||
|
||||
qint32 n_name;
|
||||
void* name_ptr = GetWindowProperty( m_display, window, "_NET_WM_NAME", &n_name );
|
||||
|
||||
if( name_ptr != nullptr )
|
||||
{
|
||||
name = QString( reinterpret_cast<char*>( name_ptr ) );
|
||||
|
||||
Free( name_ptr );
|
||||
}
|
||||
|
||||
emit signalConsole( QString( "Atom name: %1" ).arg( name ) );
|
||||
|
||||
QStringList types;
|
||||
|
||||
qint32 n_types;
|
||||
void* types_ptr = GetWindowProperty( m_display, window, "_NET_WM_WINDOW_TYPE", &n_types );
|
||||
|
||||
if( types_ptr != nullptr )
|
||||
{
|
||||
for( qint32 i = 0; i < n_types; ++i )
|
||||
{
|
||||
char* type_name = GetAtomName( m_display, reinterpret_cast<long *>( types_ptr )[ i ] );
|
||||
|
||||
types.append( type_name );
|
||||
|
||||
if( type_name )
|
||||
{
|
||||
Free( type_name );
|
||||
}
|
||||
}
|
||||
|
||||
Free( types_ptr );
|
||||
}
|
||||
|
||||
for( int i = 0 ; i < types.length() ; ++i )
|
||||
{
|
||||
emit signalConsole( QString( "Atom type: %1" ).arg( types.at( i ) ) );
|
||||
}
|
||||
|
||||
QStringList states;
|
||||
|
||||
qint32 n_states;
|
||||
void* states_ptr = GetWindowProperty( m_display,window, "_NET_WM_STATE", &n_states );
|
||||
|
||||
if( states_ptr != nullptr )
|
||||
{
|
||||
for( qint32 i = 0; i < n_states ; ++i )
|
||||
{
|
||||
char* atom_name = GetAtomName( m_display, reinterpret_cast<long *>( states_ptr )[ i ] );
|
||||
|
||||
states.append( atom_name );
|
||||
|
||||
if( atom_name )
|
||||
{
|
||||
Free( atom_name );
|
||||
}
|
||||
}
|
||||
|
||||
Free( states_ptr );
|
||||
}
|
||||
|
||||
bool max_vert = false;
|
||||
bool max_horz = false;
|
||||
bool hidden = false;
|
||||
|
||||
for( int i = 0 ; i < states.length() ; ++i )
|
||||
{
|
||||
QString state = states.at( i );
|
||||
|
||||
emit signalConsole( QString( "Atom state: %1" ).arg( state ) );
|
||||
|
||||
int state_code = WindowStates.indexOf( state ) ;
|
||||
|
||||
switch( state_code )
|
||||
{
|
||||
case STATE_MAXIMIZED_VERT:
|
||||
{
|
||||
max_vert = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_MAXIMIZED_HORZ:
|
||||
{
|
||||
max_horz = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_HIDDEN:
|
||||
{
|
||||
hidden = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( states.length() > 0 )
|
||||
{
|
||||
if( hidden )
|
||||
{
|
||||
emit signalConsole( "Window State: Hidden" );
|
||||
}
|
||||
else
|
||||
if( max_vert && max_horz )
|
||||
{
|
||||
emit signalConsole( "Window State: Maximize" );
|
||||
}
|
||||
else
|
||||
{
|
||||
emit signalConsole( "Window State: Normal" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
emit signalConsole( "Window State: Normal" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get window positions
|
||||
*/
|
||||
@@ -718,11 +527,6 @@ void WindowCtrlUnix::normalizeWindow( quint64 window )
|
||||
*/
|
||||
SendEvent( m_display, window, "_NET_ACTIVE_WINDOW" );
|
||||
|
||||
/*
|
||||
* Set focus
|
||||
*/
|
||||
// SetInputFocus( m_display, window ); // Throws error: Fedora 33
|
||||
|
||||
/*
|
||||
* Flush the pipes
|
||||
*/
|
||||
|
||||
@@ -215,15 +215,6 @@ class WindowCtrlUnix : public QObject
|
||||
*/
|
||||
QString getProcessName( qint64 pid ) const;
|
||||
|
||||
/**
|
||||
* @brief findWindow. Find window by (sub)title.
|
||||
*
|
||||
* @param title The title to find.
|
||||
*
|
||||
* @return State of the find.
|
||||
*/
|
||||
bool findWindow( const QString& title );
|
||||
|
||||
/**
|
||||
* @brief findWindows. Find all windows of a process.
|
||||
*
|
||||
@@ -256,20 +247,6 @@ class WindowCtrlUnix : public QObject
|
||||
*/
|
||||
const Preferences::WindowState& getWindowStateX11( const quint64 window );
|
||||
|
||||
/**
|
||||
* @brief displayWindowElements. Display window elements (atoms).
|
||||
*
|
||||
* @param title The window title to find.
|
||||
*/
|
||||
void displayWindowElements( const QString& title );
|
||||
|
||||
/**
|
||||
* @brief displayWindowElements. Display window elements (atoms).
|
||||
*
|
||||
* @param window The window.
|
||||
*/
|
||||
void displayWindowElements( quint64 window );
|
||||
|
||||
/**
|
||||
* @brief updatePositions. Update the window positions.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user