From 0627d5a91f82c0b5035c0a349e1dd440cdd29d0e Mon Sep 17 00:00:00 2001 From: Ximi1970 Date: Wed, 30 Dec 2020 01:37:55 +0100 Subject: [PATCH] Use both wm_state and net_wm_state --- .../SysTray-X-app/windowctrl-unix.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/SysTray-X/SysTray-X-app/windowctrl-unix.cpp b/app/SysTray-X/SysTray-X-app/windowctrl-unix.cpp index a393c3d..a2109f8 100644 --- a/app/SysTray-X/SysTray-X-app/windowctrl-unix.cpp +++ b/app/SysTray-X/SysTray-X-app/windowctrl-unix.cpp @@ -154,10 +154,14 @@ void WindowCtrlUnix::findWindows( qint64 pid ) { if( pid == *((reinterpret_cast( propPID ) ) ) ) { - qint32 n_state; - void* state = GetWindowProperty( m_display, win.window, "_NET_WM_STATE", &n_state ); - if( state != nullptr ) + qint32 n_wm_state; + void* wm_stat_ptr = GetWindowProperty( m_display, win.window, "WM_STATE", &n_wm_state ); + + qint32 n_net_wm_state; + void* net_wm_state_ptr = GetWindowProperty( m_display, win.window, "_NET_WM_STATE", &n_net_wm_state ); + + if( wm_stat_ptr != nullptr || net_wm_state_ptr != nullptr ) { m_tb_windows.append( win.window ); @@ -169,7 +173,15 @@ void WindowCtrlUnix::findWindows( qint64 pid ) m_tb_window_positions.append( point ); - Free( state ); + if( wm_stat_ptr != nullptr ) + { + Free( wm_stat_ptr ); + } + + if( net_wm_state_ptr != nullptr ) + { + Free( net_wm_state_ptr ); + } } }