Extra check in monitor

This commit is contained in:
Ximi1970
2021-01-16 21:46:33 +01:00
parent 1b60aa0359
commit d24408a6a7
3 changed files with 47 additions and 1 deletions

View File

@@ -106,6 +106,22 @@ void WindowCtrlUnix::updateX11WindowStates()
qint32 n_wm_state;
void* wm_state_ptr = GetWindowProperty( m_display, m_tb_windows.at( i ), "WM_STATE", &n_wm_state );
if( Error() )
{
#ifdef DEBUG_DISPLAY_ACTIONS_DETAILS
emit signalConsole( QString( "Updatex11: Removing WinID %1").arg( m_tb_windows.at( i ) ) );
#endif
/*
* Window does not exist
*/
m_tb_windows.removeAt( i );
m_tb_window_positions.removeAt( i );
m_tb_window_states_x11.removeAt( i );
continue;
}
/*
* Get the state
*/
@@ -175,7 +191,7 @@ void WindowCtrlUnix::updateX11WindowStates()
if( ( current_state == Preferences::STATE_MINIMIZED || current_state == Preferences::STATE_DOCKED ) && current_state != getWindowState( m_tb_windows.at( i ) ) )
{
#ifdef DEBUG_DISPLAY_ACTIONS_DETAILS
emit signalConsole( QString( "WinID %1, state: %2").arg( m_tb_windows.at( i ) ).
emit signalConsole( QString( "Updatex11: WinID %1, state: %2").arg( m_tb_windows.at( i ) ).
arg( Preferences::WindowStateString.at( m_tb_window_states[ m_tb_windows.at( i ) ] ) ) );
for( int j = 0 ; j < atom_list.length() ; ++j )

View File

@@ -15,11 +15,19 @@
#include <X11/Xutil.h>
/*
* X11 error state
* */
bool x11Error = false;
/*
* Open the display
*/
void* OpenDisplay()
{
x11Error = false;
return XOpenDisplay( NULL );
}
@@ -471,6 +479,7 @@ int ErrorHandler( Display* display, XErrorEvent* event )
XGetErrorText( display, event->error_code, buf, 1024 );
fprintf( stderr, "%s\n", buf );
x11Error = true;
return 0;
}
@@ -484,10 +493,24 @@ void SetErrorHandler()
}
/*
* Get the error state
*/
bool Error()
{
bool stete = x11Error;
x11Error = false;
return stete;
}
/*
* Unset the error handler
*/
void UnSetErrorHandler()
{
x11Error = false;
XSetErrorHandler( NULL );
}

View File

@@ -266,6 +266,13 @@ void MoveWindow( void* display, quint64 window, int x, int y );
*/
void SetErrorHandler();
/**
* @brief Error. Get the error state.
*
* @return The error state.
*/
bool Error();
/**
* @brief UnSetErrorHandler. Unset the x11 error handler.
*/