diff --git a/Xext/shape/byteswap.c b/Xext/shape/byteswap.c new file mode 100644 index 0000000000..748995fe50 --- /dev/null +++ b/Xext/shape/byteswap.c @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: X11 OR MIT OR AGPL-3.0-or-later + * + * Copyright © 2026 Enrico Weigelt, metux IT consult + */ +#include + +#include +#include + +#include "include/misc.h" + +#include "shape_intern.h" + +void ShapeSwapNotifyEvent(xEvent *_from, xEvent *_to) +{ + xShapeNotifyEvent *from = (xShapeNotifyEvent*)_from; + xShapeNotifyEvent *to = (xShapeNotifyEvent*)_to; + + *to = *from; + + swapl(&to->window); + swaps(&to->sequenceNumber); + swaps(&to->x); + swaps(&to->y); + swaps(&to->width); + swaps(&to->height); + swapl(&to->time); +} diff --git a/Xext/shape/meson.build b/Xext/shape/meson.build index d027d90fa4..ffc87f416d 100644 --- a/Xext/shape/meson.build +++ b/Xext/shape/meson.build @@ -1,4 +1,5 @@ srcs_shape = [ + 'byteswap.c', 'shape.c', ] diff --git a/Xext/shape/shape.c b/Xext/shape/shape.c index ce6a9dfbba..534680f794 100644 --- a/Xext/shape/shape.c +++ b/Xext/shape/shape.c @@ -56,6 +56,8 @@ in this Software without prior written authorization from The Open Group. #include "gcstruct.h" #include "protocol-versions.h" +#include "shape_intern.h" + Bool noShapeExtension = FALSE; typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */ @@ -63,10 +65,6 @@ typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */ static DevPrivateKeyRec ShapeWindowPrivateKeyRec; -static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ , - xShapeNotifyEvent * /* to */ - ); - /* SendShapeNotify, CreateBoundingShape and CreateClipShape are used * externally by the Xfixes extension and are now defined in window.h */ @@ -961,21 +959,6 @@ ProcShapeDispatch(ClientPtr client) } } -static void _X_COLD -SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to) -{ - to->type = from->type; - to->kind = from->kind; - cpswapl(from->window, to->window); - cpswaps(from->sequenceNumber, to->sequenceNumber); - cpswaps(from->x, to->x); - cpswaps(from->y, to->y); - cpswaps(from->width, to->width); - cpswaps(from->height, to->height); - cpswapl(from->time, to->time); - to->shaped = from->shaped; -} - static void ShapeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin) { @@ -1019,6 +1002,6 @@ ShapeExtensionInit(void) ProcShapeDispatch, ProcShapeDispatch, NULL, StandardMinorOpcode))) { ShapeEventBase = extEntry->eventBase; - EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; + EventSwapVector[ShapeEventBase] = ShapeSwapNotifyEvent; } } diff --git a/Xext/shape/shape_intern.h b/Xext/shape/shape_intern.h new file mode 100644 index 0000000000..8f747319be --- /dev/null +++ b/Xext/shape/shape_intern.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: X11 OR MIT OR AGPL-3.0-or-later + * + * @brief only to be used internally by shape extension + * + * Copyright © 2026 Enrico Weigelt, metux IT consult + */ +#ifndef __XLIBRE_SHAPE_INTERN_H +#define __XLIBRE_SHAPE_INTERN_H + +#include + +void ShapeSwapNotifyEvent(xEvent *_from, xEvent *_to); + +#endif /* __XLIBRE_SHAPE_INTERN_H */