dix: split ProcCreateWindow() into upper and lower half

In order to reduce complexity of wrapped core request handlers with PanoramiX,
split the ProcCreateWindow() function into two pieces: the upper half is the
usual (non-PanoramiX) handler, while the lower one is what's called by both
the usual handler, as well as the PanoramiX' one.

We're already passing in the request parameters as separate pointers, so
follow-up commits can easily change PanoramiX handler to not tweaking the
request buffer directly anymore. Another one is letting PanoramiXCreateWindow()
be called by ProcCreateWindow explicitly (when enabled), so we don't need to
wrap the core request proc vector anymore. Once that's done, the swapping can
also be moved into ProcCreateWindow().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-10-23 13:36:21 +02:00
committed by Enrico Weigelt
parent 0d4e48188a
commit 04d4986004
3 changed files with 24 additions and 12 deletions

View File

@@ -36,6 +36,7 @@ Equipment Corporation.
#include "dix/rpcbuf_priv.h"
#include "dix/screenint_priv.h"
#include "dix/server_priv.h"
#include "dix/window_priv.h"
#include "os/osdep.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
@@ -154,7 +155,7 @@ PanoramiXCreateWindow(ClientPtr client)
*((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[walkScreenIdx].id;
if (orig_visual != CopyFromParent)
stuff->visual = PanoramiXTranslateVisualID(walkScreenIdx, orig_visual);
result = (*SavedProcVector[X_CreateWindow]) (client);
result = DoCreateWindowReq(client, stuff, (XID*)&stuff[1]);
if (result != Success)
break;
});

View File

@@ -732,23 +732,15 @@ CreateConnectionBlock(void)
return TRUE;
}
int
ProcCreateWindow(ClientPtr client)
int DoCreateWindowReq(ClientPtr client, xCreateWindowReq *stuff, XID *xids)
{
WindowPtr pParent, pWin;
REQUEST(xCreateWindowReq);
int len, rc;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
int rc;
LEGAL_NEW_RESOURCE(stuff->wid, client);
rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
if (rc != Success)
return rc;
len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
if (Ones(stuff->mask) != len)
return BadLength;
if (!stuff->width || !stuff->height) {
client->errorValue = 0;
return BadValue;
@@ -756,7 +748,7 @@ ProcCreateWindow(ClientPtr client)
pWin = dixCreateWindow(stuff->wid, pParent, stuff->x,
stuff->y, stuff->width, stuff->height,
stuff->borderWidth, stuff->class,
stuff->mask, (XID *) &stuff[1],
stuff->mask, (XID *) xids,
(int) stuff->depth, client, stuff->visual, &rc);
if (pWin) {
Mask mask = pWin->eventMask;
@@ -769,6 +761,19 @@ ProcCreateWindow(ClientPtr client)
return rc;
}
int
ProcCreateWindow(ClientPtr client)
{
REQUEST(xCreateWindowReq);
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
int len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
if (Ones(stuff->mask) != len)
return BadLength;
return DoCreateWindowReq(client, stuff, (XID*)&stuff[1]);
}
int
ProcChangeWindowAttributes(ClientPtr client)
{

View File

@@ -53,4 +53,10 @@ Bool MakeWindowOptional(WindowPtr pWin);
*/
Bool dixWindowIsRoot(Window window);
/*
* @brief lower part of X_CreateWindow request handler.
* Called by ProcCreateWindow() as well as PanoramiXCreateWindow()
*/
int DoCreateWindowReq(ClientPtr client, xCreateWindowReq *stuff, XID *xids);
#endif /* _XSERVER_DIX_WINDOW_PRIV_H */