(submit/cleanup-damageext) damage: untwist Xinerma handling

The diffenciation between Xinerama and single screen version is by tweaking
call vectors unncessarily complicated: it the only reason why these are
needed in the first place. Finally, it's just about one function, so it's
much easier just branching off in ProcDamageCreate() in case of Xinerama
is enabled.

This also clears the road for further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-09 10:30:33 +02:00
parent f8d6a480e4
commit 8ef462c58a

View File

@ -42,7 +42,9 @@ typedef struct {
} PanoramiXDamageRes; } PanoramiXDamageRes;
static RESTYPE XRT_DAMAGE; static RESTYPE XRT_DAMAGE;
static int (*PanoramiXSaveDamageCreate) (ClientPtr); static int damageUseXinerama = 0;
static int PanoramiXDamageCreate(ClientPtr client);
#endif /* XINERAMA */ #endif /* XINERAMA */
@ -303,6 +305,12 @@ ProcDamageCreate(ClientPtr client)
int rc; int rc;
REQUEST(xDamageCreateReq); REQUEST(xDamageCreateReq);
REQUEST_SIZE_MATCH(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq);
#ifdef PANORAMIX
if (damageUseXinerama)
return PanoramiXDamageCreate(client);
#endif
LEGAL_NEW_RESOURCE(stuff->damage, client); LEGAL_NEW_RESOURCE(stuff->damage, client);
doDamageCreate(client, &rc); doDamageCreate(client, &rc);
return rc; return rc;
@ -704,14 +712,13 @@ PanoramiXDamageInit(void)
if (!XRT_DAMAGE) if (!XRT_DAMAGE)
FatalError("Couldn't Xineramify Damage extension\n"); FatalError("Couldn't Xineramify Damage extension\n");
PanoramiXSaveDamageCreate = ProcDamageVector[X_DamageCreate]; damageUseXinerama = 1;
ProcDamageVector[X_DamageCreate] = PanoramiXDamageCreate;
} }
void void
PanoramiXDamageReset(void) PanoramiXDamageReset(void)
{ {
ProcDamageVector[X_DamageCreate] = PanoramiXSaveDamageCreate; damageUseXinerama = 0;
} }
#endif /* XINERAMA */ #endif /* XINERAMA */