fix restore a maximized window when it is minimized
Signed-off-by: 2fly2 <wjatchd@163.com>
This commit is contained in:
parent
1d86b2064f
commit
ee8cf9e023
@ -839,7 +839,7 @@ static BOOL xf_event_MapNotify(xfContext* xfc, const XMapEvent* event, BOOL app)
|
||||
* Doing this here would inhibit the ability to restore a maximized window
|
||||
* that is minimized back to the maximized state
|
||||
*/
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
|
||||
// xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
|
||||
appWindow->is_mapped = TRUE;
|
||||
}
|
||||
}
|
||||
@ -910,18 +910,22 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
|
||||
|
||||
if (status)
|
||||
{
|
||||
appWindow->maxVert = FALSE;
|
||||
appWindow->maxHorz = FALSE;
|
||||
for (i = 0; i < nitems; i++)
|
||||
{
|
||||
if ((Atom)((UINT16**)prop)[i] ==
|
||||
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
|
||||
{
|
||||
maxVert = TRUE;
|
||||
appWindow->maxVert = TRUE;
|
||||
}
|
||||
|
||||
if ((Atom)((UINT16**)prop)[i] ==
|
||||
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False))
|
||||
{
|
||||
maxHorz = TRUE;
|
||||
appWindow->maxHorz = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -938,9 +942,15 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
|
||||
{
|
||||
/* If the window is in the iconic state */
|
||||
if (((UINT32)*prop == 3))
|
||||
{
|
||||
minimized = TRUE;
|
||||
appWindow->minimized = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
minimized = FALSE;
|
||||
appWindow->minimized = FALSE;
|
||||
}
|
||||
|
||||
minimizedChanged = TRUE;
|
||||
XFree(prop);
|
||||
@ -949,23 +959,30 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
|
||||
|
||||
if (app)
|
||||
{
|
||||
if (maxVert && maxHorz && !minimized &&
|
||||
(appWindow->rail_state != WINDOW_SHOW_MAXIMIZED))
|
||||
if (appWindow->maxVert && appWindow->maxHorz && !appWindow->minimized)
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MAXIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MAXIMIZE);
|
||||
if(appWindow->rail_state != WINDOW_SHOW_MAXIMIZED)
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MAXIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MAXIMIZE);
|
||||
}
|
||||
}
|
||||
else if (minimized && (appWindow->rail_state != WINDOW_SHOW_MINIMIZED))
|
||||
else if (appWindow->minimized)
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MINIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MINIMIZE);
|
||||
if(appWindow->rail_state != WINDOW_SHOW_MINIMIZED)
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MINIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MINIMIZE);
|
||||
}
|
||||
}
|
||||
else if (((Atom)event->atom == xfc->WM_STATE) && !minimized &&
|
||||
(appWindow->rail_state != WINDOW_SHOW) &&
|
||||
(appWindow->rail_state != WINDOW_HIDE))
|
||||
else
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
|
||||
if(appWindow->rail_state != WINDOW_SHOW &&
|
||||
appWindow->rail_state != WINDOW_HIDE)
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (minimizedChanged)
|
||||
|
@ -805,6 +805,9 @@ int xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow)
|
||||
appWindow->is_mapped = FALSE;
|
||||
appWindow->is_transient = FALSE;
|
||||
appWindow->rail_state = 0;
|
||||
appWindow->maxVert = FALSE;
|
||||
appWindow->maxHorz = FALSE;
|
||||
appWindow->minimized = FALSE;
|
||||
appWindow->rail_ignore_configure = FALSE;
|
||||
appWindow->handle = XCreateWindow(xfc->display, RootWindowOfScreen(xfc->screen), appWindow->x,
|
||||
appWindow->y, appWindow->width, appWindow->height, 0,
|
||||
@ -969,11 +972,14 @@ void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
|
||||
break;
|
||||
|
||||
case WINDOW_SHOW_MINIMIZED:
|
||||
appWindow->minimized = TRUE;
|
||||
XIconifyWindow(xfc->display, appWindow->handle, xfc->screen_number);
|
||||
break;
|
||||
|
||||
case WINDOW_SHOW_MAXIMIZED:
|
||||
/* Set the window as maximized */
|
||||
appWindow->maxHorz = TRUE;
|
||||
appWindow->maxVert = TRUE;
|
||||
xf_SendClientEvent(xfc, appWindow->handle, xfc->_NET_WM_STATE, 4, _NET_WM_STATE_ADD,
|
||||
xfc->_NET_WM_STATE_MAXIMIZED_VERT, xfc->_NET_WM_STATE_MAXIMIZED_HORZ,
|
||||
0);
|
||||
|
@ -146,6 +146,9 @@ struct xf_app_window
|
||||
BOOL is_transient;
|
||||
xfLocalMove local_move;
|
||||
BYTE rail_state;
|
||||
BOOL maxVert;
|
||||
BOOL maxHorz;
|
||||
BOOL minimized;
|
||||
BOOL rail_ignore_configure;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user