1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

dtwm: Trigger fullscreen in an "edge trigger" manner to avoid wrong

behaviors caused by some unusual operations. E.g., after entered
fullscreen, applications change windows to other states instead of
leaving fullscreen.
This commit is contained in:
Liang Chang 2021-08-19 07:17:51 +08:00
parent 3e81d4c4de
commit 8fa32b3db5
6 changed files with 19 additions and 12 deletions

View file

@ -2575,9 +2575,11 @@ void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent)
} }
else if (clientEvent->data.l[0] == NormalState) else if (clientEvent->data.l[0] == NormalState)
{ {
if (pCD->isFullscreen) if (pCD->enterFullscreen)
{ {
Boolean enterFullscreen = pCD->enterFullscreen;
SetClientState (pCD, NORMAL_STATE, GetTimestamp ()); SetClientState (pCD, NORMAL_STATE, GetTimestamp ());
pCD->enterFullscreen = enterFullscreen;
newState = MAXIMIZED_STATE; newState = MAXIMIZED_STATE;
} }
else else

View file

@ -149,16 +149,10 @@ static void ProcessNetWmStateFullscreen (ClientData *pCD, Boolean en)
if (pHints != &hints) XFree (pHints); if (pHints != &hints) XFree (pHints);
pCD->isFullscreen = en; pCD->enterFullscreen = en;
XSendEvent (DISPLAY, ROOT_FOR_CLIENT (pCD), False, SubstructureRedirectMask, XSendEvent (DISPLAY, ROOT_FOR_CLIENT (pCD), False, SubstructureRedirectMask,
(XEvent *) &clientMsgEvent); (XEvent *) &clientMsgEvent);
if (en) XChangeProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) &wmGD.xa_NET_WM_STATE_FULLSCREEN,
1);
else XDeleteProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE);
} /* END OF FUNCTION ProcessNetWmStateFullscreen */ } /* END OF FUNCTION ProcessNetWmStateFullscreen */

View file

@ -1629,7 +1629,7 @@ typedef struct _ClientData
int xBorderWidth; /* original X border width */ int xBorderWidth; /* original X border width */
FrameInfo frameInfo; /* frame geometry data */ FrameInfo frameInfo; /* frame geometry data */
Boolean decorUpdated; /* True => decoration updated */ Boolean decorUpdated; /* True => decoration updated */
Boolean isFullscreen; /* True => fullscreen */ Boolean enterFullscreen; /* True => enter fullscreen */
Boolean monitorSizeIsSet; /* True => X, Y, W, H is set */ Boolean monitorSizeIsSet; /* True => X, Y, W, H is set */
int monitorX; /* monitor X loc */ int monitorX; /* monitor X loc */
int monitorY; /* monitor Y loc */ int monitorY; /* monitor Y loc */

View file

@ -1008,6 +1008,7 @@ void WithdrawWindow (ClientData *pCD)
} }
} }
XDeleteProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE);
XUnmapWindow (DISPLAY, pCD->client); XUnmapWindow (DISPLAY, pCD->client);
XReparentWindow (DISPLAY, pCD->client, ROOT_FOR_CLIENT(pCD), x, y); XReparentWindow (DISPLAY, pCD->client, ROOT_FOR_CLIENT(pCD), x, y);

View file

@ -218,7 +218,7 @@ InitClientData (Window clientWindow)
pCD->smClientID = (String)NULL; pCD->smClientID = (String)NULL;
pCD->decorUpdated = False; pCD->decorUpdated = False;
pCD->isFullscreen = False; pCD->enterFullscreen = False;
pCD->monitorSizeIsSet = False; pCD->monitorSizeIsSet = False;
return (pCD); return (pCD);

View file

@ -181,7 +181,6 @@ void SetClientStateWithEventMask (ClientData *pCD, int newState, Time setTime, u
* WM_STATE property is set in WithdrawWindow. * WM_STATE property is set in WithdrawWindow.
*/ */
XDeleteProperty (DISPLAY, pCD->client, wmGD.xa_NET_WM_STATE);
UnManageWindow (pCD); UnManageWindow (pCD);
break; break;
} }
@ -614,10 +613,12 @@ void ConfigureNewState (ClientData *pcd)
XResizeWindow (DISPLAY, pcd->client, XResizeWindow (DISPLAY, pcd->client,
(unsigned int) pcd->clientWidth, (unsigned int) pcd->clientWidth,
(unsigned int) pcd->clientHeight); (unsigned int) pcd->clientHeight);
XDeleteProperty (DISPLAY, pcd->client, wmGD.xa_NET_WM_STATE);
} }
else else
{ {
if (pcd->isFullscreen && pcd->monitorSizeIsSet) if (pcd->enterFullscreen && pcd->monitorSizeIsSet)
{ {
pcd->maxX = pcd->monitorX; pcd->maxX = pcd->monitorX;
pcd->maxY = pcd->monitorY; pcd->maxY = pcd->monitorY;
@ -646,7 +647,16 @@ void ConfigureNewState (ClientData *pcd)
(unsigned int) pcd->maxHeight); (unsigned int) pcd->maxHeight);
pcd->maxConfig = TRUE; pcd->maxConfig = TRUE;
RegenerateClientFrame(pcd); RegenerateClientFrame(pcd);
if (pcd->enterFullscreen)
XChangeProperty (DISPLAY, pcd->client, wmGD.xa_NET_WM_STATE,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) &wmGD.xa_NET_WM_STATE_FULLSCREEN,
1);
} }
pcd->enterFullscreen = False;
SendConfigureNotify (pcd); SendConfigureNotify (pcd);
/* /*