mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-02-03 04:49:04 +01:00
Split minimize and close window action
This commit is contained in:
@@ -206,7 +206,14 @@ void WindowCtrlUnix::updateX11WindowStates( CheckType check_type )
|
||||
emit signalConsole( QString( "State x11: %1").arg( state ) );
|
||||
#endif
|
||||
|
||||
minimizeWindow( m_tb_windows.at( i ) );
|
||||
if( getMinimizeType() == Preferences::PREF_DEFAULT_MINIMIZE )
|
||||
{
|
||||
minimizeWindowToTaskbar( m_tb_windows.at( i ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
minimizeWindowToTray( m_tb_windows.at( i ) );
|
||||
}
|
||||
}
|
||||
else if( ( check_type & CHECK_NORMALIZE ) &&
|
||||
( current_state == Preferences::STATE_NORMAL && current_state != getWindowState( m_tb_windows.at( i ) ) ) )
|
||||
@@ -712,6 +719,7 @@ void WindowCtrlUnix::updatePositions()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FF_NEET
|
||||
|
||||
/*
|
||||
* Minimize a window
|
||||
@@ -778,12 +786,12 @@ void WindowCtrlUnix::minimizeWindow( quint64 window )
|
||||
emit signalConsole( "Minimize done" );
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Minimize a window
|
||||
*/
|
||||
void WindowCtrlUnix::minimizeWindow( quint64 window, TargetType targetType )
|
||||
void WindowCtrlUnix::minimizeWindowToTaskbar( quint64 window )
|
||||
{
|
||||
#ifdef DEBUG_DISPLAY_ACTIONS
|
||||
emit signalConsole( "Minimize" );
|
||||
@@ -804,37 +812,10 @@ void WindowCtrlUnix::minimizeWindow( quint64 window, TargetType targetType )
|
||||
*/
|
||||
Sync( m_display );
|
||||
|
||||
if( targetType == TargetType::TYPE_WINDOW_TO_SYSTEMTRAY )
|
||||
{
|
||||
#ifdef DEBUG_DISPLAY_ACTIONS
|
||||
emit signalConsole( "Withdraw window" );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the flags (GNOME, Wayland?)
|
||||
*/
|
||||
SendEvent( m_display, window, "_NET_WM_STATE", _NET_WM_STATE_ADD, _ATOM_SKIP_TASKBAR );
|
||||
SendEvent( m_display, window, "_NET_WM_STATE", _NET_WM_STATE_ADD, _ATOM_SKIP_PAGER );
|
||||
|
||||
Flush( m_display );
|
||||
|
||||
/*
|
||||
* Remove from taskbar and task switchers
|
||||
*/
|
||||
WithdrawWindow( m_display, window );
|
||||
|
||||
/*
|
||||
* Store the window state
|
||||
*/
|
||||
m_tb_window_states[ window ] = Preferences::STATE_DOCKED;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Store the window state
|
||||
*/
|
||||
m_tb_window_states[ window ] = Preferences::STATE_MINIMIZED;
|
||||
}
|
||||
/*
|
||||
* Store the window state
|
||||
*/
|
||||
m_tb_window_states[ window ] = Preferences::STATE_MINIMIZED;
|
||||
|
||||
/*
|
||||
* Flush the pipes
|
||||
@@ -847,6 +828,49 @@ void WindowCtrlUnix::minimizeWindow( quint64 window, TargetType targetType )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Minimize window to tray
|
||||
*/
|
||||
void WindowCtrlUnix::minimizeWindowToTray( quint64 window )
|
||||
{
|
||||
#ifdef DEBUG_DISPLAY_ACTIONS
|
||||
emit signalConsole( "Close" );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Save the hints
|
||||
*/
|
||||
GetWMNormalHints( m_display, window, &m_tb_window_hints[ window ] );
|
||||
|
||||
/*
|
||||
* Set the flags (GNOME, Wayland?)
|
||||
*/
|
||||
SendEvent( m_display, window, "_NET_WM_STATE", _NET_WM_STATE_ADD, _ATOM_SKIP_TASKBAR );
|
||||
SendEvent( m_display, window, "_NET_WM_STATE", _NET_WM_STATE_ADD, _ATOM_SKIP_PAGER );
|
||||
|
||||
Flush( m_display );
|
||||
|
||||
/*
|
||||
* Remove from taskbar and task switchers
|
||||
*/
|
||||
WithdrawWindow( m_display, window );
|
||||
|
||||
/*
|
||||
* Store the window state
|
||||
*/
|
||||
m_tb_window_states[ window ] = Preferences::STATE_DOCKED;
|
||||
|
||||
/*
|
||||
* Flush the pipes
|
||||
*/
|
||||
Sync( m_display );
|
||||
|
||||
#ifdef DEBUG_DISPLAY_ACTIONS_END
|
||||
emit signalConsole( "Close done" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Normalize a window
|
||||
*/
|
||||
|
||||
@@ -282,12 +282,19 @@ class WindowCtrlUnix : public QObject
|
||||
void minimizeWindow( quint64 window );
|
||||
|
||||
/**
|
||||
* @brief minimizeWindow. Minimize window.
|
||||
* @brief minimizeWindowToTaskbar. Minimize window to taskbar.
|
||||
*
|
||||
* @param window The window.
|
||||
* @param targetType Where to minimize.
|
||||
*/
|
||||
void minimizeWindow( quint64 window, TargetType targetType );
|
||||
void minimizeWindowToTaskbar( quint64 window );
|
||||
|
||||
/**
|
||||
* @brief minimizeWindowToTray. Minimize window to tray.
|
||||
*
|
||||
* @param window The window.
|
||||
*/
|
||||
void minimizeWindowToTray( quint64 window );
|
||||
|
||||
/**
|
||||
* @brief normalizeWindow. Normalize window.
|
||||
|
||||
@@ -271,7 +271,14 @@ void WindowCtrl::slotWindowState( Preferences::WindowState state )
|
||||
.arg( Preferences::WindowStateString.at( getWindowState( win_ids.at( i ) ) ) ) );
|
||||
#endif
|
||||
|
||||
minimizeWindow( win_ids.at( i ), targetType );
|
||||
if( targetType == TargetType::TYPE_WINDOW_TO_TASKBAR )
|
||||
{
|
||||
minimizeWindowToTaskbar( win_ids.at( i ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
minimizeWindowToTray( win_ids.at( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -391,7 +398,14 @@ void WindowCtrl::slotShowHide()
|
||||
}
|
||||
else
|
||||
{
|
||||
minimizeWindow( win_ids.at( i ), targetType );
|
||||
if( targetType == TargetType::TYPE_WINDOW_TO_TASKBAR )
|
||||
{
|
||||
minimizeWindowToTaskbar( win_ids.at( i ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
minimizeWindowToTray( win_ids.at( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user