(submit/xext-saver) Xext: saver: consolidate (non-)xinerama versions

We can make it a bit simpler by doing the request header
checking only once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-03 00:17:11 +02:00
parent e7291758ac
commit 00bedc4bbb

View File

@ -700,9 +700,8 @@ ProcScreenSaverSelectInput(ClientPtr client)
} }
static int static int
ScreenSaverSetAttributes(ClientPtr client) ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
{ {
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw; DrawablePtr pDraw;
WindowPtr pParent; WindowPtr pParent;
ScreenPtr pScreen; ScreenPtr pScreen;
@ -725,7 +724,6 @@ ScreenSaverSetAttributes(ClientPtr client)
Colormap cmap; Colormap cmap;
ColormapPtr pCmap; ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess); DixGetAttrAccess);
if (ret != Success) if (ret != Success)
@ -1042,16 +1040,13 @@ ScreenSaverSetAttributes(ClientPtr client)
} }
static int static int
ScreenSaverUnsetAttributes(ClientPtr client) ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
{ {
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw; DrawablePtr pDraw;
ScreenSaverScreenPrivatePtr pPriv; ScreenSaverScreenPrivatePtr pPriv;
int rc; int rc;
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq); rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
pPriv = GetScreenPrivate(pDraw->pScreen); pPriv = GetScreenPrivate(pDraw->pScreen);
@ -1067,9 +1062,11 @@ ScreenSaverUnsetAttributes(ClientPtr client)
static int static int
ProcScreenSaverSetAttributes(ClientPtr client) ProcScreenSaverSetAttributes(ClientPtr client)
{ {
REQUEST(xScreenSaverSetAttributesReq);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
#ifdef PANORAMIX #ifdef PANORAMIX
if (!noPanoramiXExtension) { if (!noPanoramiXExtension) {
REQUEST(xScreenSaverSetAttributesReq);
PanoramiXRes *draw; PanoramiXRes *draw;
PanoramiXRes *backPix = NULL; PanoramiXRes *backPix = NULL;
PanoramiXRes *bordPix = NULL; PanoramiXRes *bordPix = NULL;
@ -1078,8 +1075,6 @@ ProcScreenSaverSetAttributes(ClientPtr client)
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0; int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
XID orig_visual, tmp; XID orig_visual, tmp;
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
status = dixLookupResourceByClass((void **) &draw, stuff->drawable, status = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess); XRC_DRAWABLE, client, DixWriteAccess);
if (status != Success) if (status != Success)
@ -1141,26 +1136,27 @@ ProcScreenSaverSetAttributes(ClientPtr client)
if (orig_visual != CopyFromParent) if (orig_visual != CopyFromParent)
stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual); stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
status = ScreenSaverSetAttributes(client); status = ScreenSaverSetAttributes(client, stuff);
} }
return status; return status;
} }
#endif #endif
return ScreenSaverSetAttributes(client); return ScreenSaverSetAttributes(client, stuff);
} }
static int static int
ProcScreenSaverUnsetAttributes(ClientPtr client) ProcScreenSaverUnsetAttributes(ClientPtr client)
{ {
REQUEST(xScreenSaverUnsetAttributesReq);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
#ifdef PANORAMIX #ifdef PANORAMIX
if (!noPanoramiXExtension) { if (!noPanoramiXExtension) {
REQUEST(xScreenSaverUnsetAttributesReq);
PanoramiXRes *draw; PanoramiXRes *draw;
int rc, i; int rc, i;
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable, rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess); XRC_DRAWABLE, client, DixWriteAccess);
@ -1168,15 +1164,14 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
return (rc == BadValue) ? BadDrawable : rc; return (rc == BadValue) ? BadDrawable : rc;
for (i = PanoramiXNumScreens - 1; i > 0; i--) { for (i = PanoramiXNumScreens - 1; i > 0; i--) {
stuff->drawable = draw->info[i].id; ScreenSaverUnsetAttributes(client, draw->info[i].id);
ScreenSaverUnsetAttributes(client);
} }
stuff->drawable = draw->info[0].id; stuff->drawable = draw->info[0].id;
} }
#endif #endif
return ScreenSaverUnsetAttributes(client); return ScreenSaverUnsetAttributes(client, stuff->drawable);
} }
static int static int