dtwm: optimize EWMH processing.

This commit is contained in:
hyousatsu
2023-02-21 10:37:27 +00:00
parent 1f101d22f0
commit e22fd8d84f
12 changed files with 306 additions and 272 deletions

View File

@@ -98,6 +98,34 @@ static void CheckPushRecallClient (ClientData *pCD);
*/
static void ApplyPrematureClientMessages (ClientData *pCD)
{
unsigned long i, nitems, leftover;
int actualFormat;
Atom actualType;
Atom property = wmGD.xa_PREMATURE_XCLIENTMESSAGEEVENT_LIST;
XClientMessageEvent *messages = NULL;
if (!HasProperty (pCD, property)) goto err;
if (XGetWindowProperty (DISPLAY, pCD->client, property, 0L, 1000000L, True,
property, &actualType, &actualFormat, &nitems,
&leftover, (unsigned char **)&messages) != Success)
goto err;
if (actualType != property) goto err;
nitems /= sizeof (XClientMessageEvent);
if (!nitems) goto err;
for (i = 0; i < nitems; ++i) HandleClientMessage (pCD, &messages[i]);
err:
if (messages) XFree (messages);
}
/*************************************<->*************************************
*
@@ -415,6 +443,11 @@ ManageWindow (WmScreenData *pSD, Window clientWindow, long manageFlags)
return;
}
ApplyPrematureClientMessages (pCD);
if (!HasProperty (pCD, wmGD.xa__NET_WM_STATE))
UpdateNetWmState (pCD->client, NULL, 0, _NET_WM_STATE_REMOVE);
/*
* Send config notify if the client's been moved/resized
*/
@@ -1012,6 +1045,8 @@ void WithdrawWindow (ClientData *pCD)
}
XDeleteProperty (DISPLAY, pCD->client, wmGD.xa__NET_WM_STATE);
XDeleteProperty (DISPLAY, pCD->client,
wmGD.xa_PREMATURE_XCLIENTMESSAGEEVENT_LIST);
XUnmapWindow (DISPLAY, pCD->client);
XReparentWindow (DISPLAY, pCD->client, ROOT_FOR_CLIENT(pCD), x, y);