mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-30 07:49:56 +00:00
Xext: shape: fix mismatching event swap prototypes
Instead of hard typecasts on event proc assignment, better accept the expected parameter types and do the typecast inside the functions. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
e1aa7c5fd5
commit
4fb08174d7
4 changed files with 46 additions and 20 deletions
28
Xext/shape/byteswap.c
Normal file
28
Xext/shape/byteswap.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* SPDX-License-Identifier: X11 OR MIT OR AGPL-3.0-or-later
|
||||
*
|
||||
* Copyright © 2026 Enrico Weigelt, metux IT consult <info@metux.net>
|
||||
*/
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/shapeproto.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
srcs_shape = [
|
||||
'byteswap.c',
|
||||
'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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
Xext/shape/shape_intern.h
Normal file
14
Xext/shape/shape_intern.h
Normal file
|
|
@ -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 <info@metux.net>
|
||||
*/
|
||||
#ifndef __XLIBRE_SHAPE_INTERN_H
|
||||
#define __XLIBRE_SHAPE_INTERN_H
|
||||
|
||||
#include <X11/Xproto.h>
|
||||
|
||||
void ShapeSwapNotifyEvent(xEvent *_from, xEvent *_to);
|
||||
|
||||
#endif /* __XLIBRE_SHAPE_INTERN_H */
|
||||
Loading…
Reference in a new issue