From bae6cbc8ca61b283efc59745ed7f1a9937444ae2 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 9 Feb 2024 15:11:30 +0100 Subject: [PATCH] include: move private defs to dixstruct_priv.h Public server module API shouldn't be clobbered with private definitions, thus move them out to dixstruct_priv.h Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- Xext/shm.c | 2 +- damageext/damageext.c | 1 + dix/devices.c | 14 +++--- dix/dispatch.c | 1 + dix/dixstruct_priv.h | 92 ++++++++++++++++++++++++++++++++++ dix/events.c | 21 +++----- dri3/dri3_request.c | 1 + hw/xwin/InitInput.c | 2 +- hw/xwin/winclipboardwrappers.c | 2 +- include/dixstruct.h | 72 +------------------------- include/xkbsrv.h | 25 --------- os/WaitFor.c | 2 +- os/connection.c | 2 +- os/io.c | 2 + os/osinit.c | 2 +- os/utils.c | 1 + xkb/xkbAccessX.c | 12 +++-- xkb/xkbActions.c | 2 +- xkb/xkbEvents.c | 2 +- xkb/xkbInit.c | 4 +- xkb/xkbLEDs.c | 9 ++-- xkb/xkbPrKeyEv.c | 8 +-- xkb/xkbUtils.c | 6 ++- xkb/xkbsrv_priv.h | 27 ++++++++++ 24 files changed, 169 insertions(+), 143 deletions(-) create mode 100644 dix/dixstruct_priv.h create mode 100644 xkb/xkbsrv_priv.h diff --git a/Xext/shm.c b/Xext/shm.c index a17915a67..7e6071215 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -48,7 +48,7 @@ in this Software without prior written authorization from The Open Group. #include "misc.h" #include "os.h" -#include "dixstruct.h" +#include "dixstruct_priv.h" #include "resource.h" #include "scrnintstr.h" #include "windowstr.h" diff --git a/damageext/damageext.c b/damageext/damageext.c index fd6fcc87e..76609fb6b 100644 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -31,6 +31,7 @@ #include "damagestr.h" #include "protocol-versions.h" #include "extinit.h" +#include "dixstruct_priv.h" #ifdef PANORAMIX #include "panoramiX.h" diff --git a/dix/devices.c b/dix/devices.c index b37523262..4d8974b67 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -48,12 +48,18 @@ SOFTWARE. #include #endif +#include +#include #include #include #include +#include +#include +#include #include "dix/dix_priv.h" #include "dix/ptrveloc_priv.h" +#include "xkb/xkbsrv_priv.h" #include "misc.h" #include "resource.h" @@ -63,23 +69,15 @@ SOFTWARE. #include "cursorstr.h" #include "dixstruct.h" #include "ptrveloc.h" -#include "xkbsrv.h" #include "privates.h" #include "xace.h" #include "mi.h" - #include "dispatch.h" #include "swaprep.h" #include "dixevents.h" #include "mipointer.h" #include "eventstr.h" #include "dixgrabs.h" - -#include -#include -#include -#include -#include #include "exglobals.h" #include "exevents.h" #include "xiquerydevice.h" /* for SizeDeviceClasses */ diff --git a/dix/dispatch.c b/dix/dispatch.c index 77d6217a7..4a7d0565f 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -132,6 +132,7 @@ Equipment Corporation. #include "xkbsrv.h" #include "client.h" #include "xfixesint.h" +#include "dixstruct_priv.h" // temporary workaround for win32/mingw32 name clash #undef CreateWindow diff --git a/dix/dixstruct_priv.h b/dix/dixstruct_priv.h new file mode 100644 index 000000000..0601448f5 --- /dev/null +++ b/dix/dixstruct_priv.h @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * Copyright © 2024 Enrico Weigelt, metux IT consult + */ +#ifndef _XSERVER_DIXSTRUCT_PRIV_H +#define _XSERVER_DIXSTRUCT_PRIV_H + +#include "client.h" +#include "dix.h" +#include "resource.h" +#include "cursor.h" +#include "gc.h" +#include "pixmap.h" +#include "privates.h" +#include "dixstruct.h" +#include + +static inline void +SetReqFds(ClientPtr client, int req_fds) { + if (client->req_fds != 0 && req_fds != client->req_fds) + LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds); + client->req_fds = req_fds; +} + +/* + * Scheduling interface + */ +extern long SmartScheduleTime; +extern long SmartScheduleInterval; +extern long SmartScheduleSlice; +extern long SmartScheduleMaxSlice; +#ifdef HAVE_SETITIMER +extern Bool SmartScheduleSignalEnable; +#else +#define SmartScheduleSignalEnable FALSE +#endif +void SmartScheduleStartTimer(void); +void SmartScheduleStopTimer(void); + +/* Client has requests queued or data on the network */ +void mark_client_ready(ClientPtr client); + +/* + * Client has requests queued or data on the network, but awaits a + * server grab release + */ +void mark_client_saved_ready(ClientPtr client); + +/* Client has no requests queued and no data on network */ +void mark_client_not_ready(ClientPtr client); + +static inline Bool client_is_ready(ClientPtr client) +{ + return !xorg_list_is_empty(&client->ready); +} + +Bool +clients_are_ready(void); + +extern struct xorg_list output_pending_clients; + +static inline void +output_pending_mark(ClientPtr client) +{ + if (!client->clientGone && xorg_list_is_empty(&client->output_pending)) + xorg_list_append(&client->output_pending, &output_pending_clients); +} + +static inline void +output_pending_clear(ClientPtr client) +{ + xorg_list_del(&client->output_pending); +} + +static inline Bool any_output_pending(void) { + return !xorg_list_is_empty(&output_pending_clients); +} + +#define SMART_MAX_PRIORITY (20) +#define SMART_MIN_PRIORITY (-20) + +void SmartScheduleInit(void); + +/* This prototype is used pervasively in Xext, dix */ +#define DISPATCH_PROC(func) int func(ClientPtr /* client */) + +/* proc vectors */ + +extern int (*InitialVector[3]) (ClientPtr /*client */ ); + +#endif /* _XSERVER_DIXSTRUCT_PRIV_H */ diff --git a/dix/events.c b/dix/events.c index f5a719a85..00ada3340 100644 --- a/dix/events.c +++ b/dix/events.c @@ -107,9 +107,16 @@ Equipment Corporation. #include #include +#include +#include +#include +#include +#include +#include #include "dix/dix_priv.h" #include "dix/eventconvert.h" +#include "xkb/xkbsrv_priv.h" #include "misc.h" #include "resource.h" @@ -118,35 +125,23 @@ Equipment Corporation. #include "inpututils.h" #include "scrnintstr.h" #include "cursorstr.h" - #include "dixstruct.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #include "globals.h" - -#include -#include "xkbsrv.h" #include "xace.h" #include "probes.h" - -#include -#include -#include -#include #include "exglobals.h" #include "exevents.h" #include "extnsionst.h" - #include "dixevents.h" #include "dixgrabs.h" #include "dispatch.h" - -#include #include "geext.h" #include "geint.h" - +#include "dixstruct_priv.h" #include "eventstr.h" #include "enterleave.h" #include "mi.h" diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c index 27d3c73a7..b6128659c 100644 --- a/dri3/dri3_request.c +++ b/dri3/dri3_request.c @@ -32,6 +32,7 @@ #include #include #include "randrstr_priv.h" +#include "dixstruct_priv.h" static Bool dri3_screen_can_one_point_four(ScreenPtr screen) diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c index 1b7068dba..6aced4f9c 100644 --- a/hw/xwin/InitInput.c +++ b/hw/xwin/InitInput.c @@ -30,7 +30,7 @@ #include #endif #include "win.h" -#include "dixstruct.h" +#include "dixstruct_priv.h" #include "inputstr.h" /* diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c index 2e6b63287..eee7882bd 100644 --- a/hw/xwin/winclipboardwrappers.c +++ b/hw/xwin/winclipboardwrappers.c @@ -35,7 +35,7 @@ #endif #include "win.h" -#include "dixstruct.h" +#include "dixstruct_priv.h" /* * Local function prototypes diff --git a/include/dixstruct.h b/include/dixstruct.h index fb0ac14b8..3607ea88a 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -113,75 +113,6 @@ typedef struct _Client { int req_fds; } ClientRec; -static inline void -SetReqFds(ClientPtr client, int req_fds) { - if (client->req_fds != 0 && req_fds != client->req_fds) - LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds); - client->req_fds = req_fds; -} - -/* - * Scheduling interface - */ -extern long SmartScheduleTime; -extern long SmartScheduleInterval; -extern long SmartScheduleSlice; -extern long SmartScheduleMaxSlice; -#ifdef HAVE_SETITIMER -extern Bool SmartScheduleSignalEnable; -#else -#define SmartScheduleSignalEnable FALSE -#endif -extern void SmartScheduleStartTimer(void); -extern void SmartScheduleStopTimer(void); - -/* Client has requests queued or data on the network */ -void mark_client_ready(ClientPtr client); - -/* - * Client has requests queued or data on the network, but awaits a - * server grab release - */ -void mark_client_saved_ready(ClientPtr client); - -/* Client has no requests queued and no data on network */ -void mark_client_not_ready(ClientPtr client); - -static inline Bool client_is_ready(ClientPtr client) -{ - return !xorg_list_is_empty(&client->ready); -} - -Bool -clients_are_ready(void); - -extern struct xorg_list output_pending_clients; - -static inline void -output_pending_mark(ClientPtr client) -{ - if (!client->clientGone && xorg_list_is_empty(&client->output_pending)) - xorg_list_append(&client->output_pending, &output_pending_clients); -} - -static inline void -output_pending_clear(ClientPtr client) -{ - xorg_list_del(&client->output_pending); -} - -static inline Bool any_output_pending(void) { - return !xorg_list_is_empty(&output_pending_clients); -} - -#define SMART_MAX_PRIORITY (20) -#define SMART_MIN_PRIORITY (-20) - -extern void SmartScheduleInit(void); - -/* This prototype is used pervasively in Xext, dix */ -#define DISPATCH_PROC(func) int func(ClientPtr /* client */) - typedef struct _WorkQueue { struct _WorkQueue *next; Bool (*function) (ClientPtr /* pClient */ , @@ -216,12 +147,11 @@ typedef struct _CallbackList { /* proc vectors */ -extern int (*InitialVector[3]) (ClientPtr /*client */ ); - extern _X_EXPORT int (*ProcVector[256]) (ClientPtr /*client */ ); extern _X_EXPORT int (*SwappedProcVector[256]) (ClientPtr /*client */ ); +/* fixme: still needed by (public) dix.h */ extern ReplySwapPtr ReplySwapVector[256]; extern _X_EXPORT int diff --git a/include/xkbsrv.h b/include/xkbsrv.h index 45564e2f4..c182b5330 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -284,8 +284,6 @@ extern _X_EXPORT DevPrivateKeyRec xkbDevicePrivateKeyRec; #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey)) -extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, void *); - /***====================================================================***/ /***====================================================================***/ @@ -492,8 +490,6 @@ extern _X_EXPORT void XkbUpdateIndicators(DeviceIntPtr /* keybd */ , XkbEventCausePtr /* cause */ ); -extern void XkbForceUpdateDeviceLEDs(DeviceIntPtr /* keybd */); - extern _X_EXPORT void XkbUpdateAllDeviceIndicators(XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); @@ -640,10 +636,6 @@ extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ , DeviceEvent * /* event */ ); -extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */, - int /* evtype */, - int /* key */); - extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ , unsigned long /* change */ , unsigned long /* newValues */ , @@ -820,29 +812,12 @@ extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ , xkbNewKeyboardNotify * /* pNKN */ ); -extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ , - XkbDescPtr /* src */ ); - extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */, DeviceIntPtr /* src */); extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ , XkbDescPtr /* src */ ); -extern void XkbFilterEvents(ClientPtr /* pClient */ , - int /* nEvents */ , - xEvent * /* xE */ ); - -extern int XkbGetEffectiveGroup(XkbSrvInfoPtr /* xkbi */ , - XkbStatePtr /* xkbstate */ , - CARD8 /* keycode */ ); - -extern void XkbMergeLockedPtrBtns(DeviceIntPtr /* master */ ); - -extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ , - int /* press */ , - int /* button */ ); - extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ , XkbDescPtr /* src */ ); diff --git a/os/WaitFor.c b/os/WaitFor.c index b08b44040..ea84570b1 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -69,7 +69,7 @@ SOFTWARE. #include "misc.h" #include "osdep.h" -#include "dixstruct.h" +#include "dixstruct_priv.h" #include "opaque.h" #ifdef DPMSExtension #include "dpmsproc.h" diff --git a/os/connection.c b/os/connection.c index bd46ae68b..5a724fd4f 100644 --- a/os/connection.c +++ b/os/connection.c @@ -103,7 +103,7 @@ SOFTWARE. #include "misc.h" /* for typedef of pointer */ #include "opaque.h" -#include "dixstruct.h" +#include "dixstruct_priv.h" #include "xace.h" #ifdef HAVE_GETPEERUCRED diff --git a/os/io.c b/os/io.c index 1e9258cd0..43c4e5d30 100644 --- a/os/io.c +++ b/os/io.c @@ -57,6 +57,8 @@ SOFTWARE. #undef DEBUG_COMMUNICATION +#include "dixstruct_priv.h" + #ifdef WIN32 #include #endif diff --git a/os/osinit.c b/os/osinit.c index 465b3df14..2c4604b87 100644 --- a/os/osinit.c +++ b/os/osinit.c @@ -64,11 +64,11 @@ SOFTWARE. #include "os/osdep.h" #include "misc.h" - #include "os.h" #include "opaque.h" #include "misc.h" #include "dixstruct.h" +#include "dixstruct_priv.h" #if !defined(SYSV) && !defined(WIN32) #include diff --git a/os/utils.c b/os/utils.c index 4c5c9e987..332d1f72e 100644 --- a/os/utils.c +++ b/os/utils.c @@ -116,6 +116,7 @@ __stdcall unsigned long GetTickCount(void); #include "picture.h" #include "miinitext.h" #include "present.h" +#include "dixstruct_priv.h" Bool noTestExtensions; diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index 4f1fee280..fffcf31f5 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -28,20 +28,22 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif +#if !defined(WIN32) +#include +#endif #include #include #include #include #include -#include "exglobals.h" #include + +#include "xkb/xkbsrv_priv.h" + +#include "exglobals.h" #include "inputstr.h" #include "eventstr.h" #include "inpututils.h" -#include -#if !defined(WIN32) -#include -#endif int XkbDfltRepeatDelay = 660; int XkbDfltRepeatInterval = 40; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 2b87de393..99bb6574e 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -36,12 +36,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "dix/dix_priv.h" +#include "xkb/xkbsrv_priv.h" #include "misc.h" #include "inputstr.h" #include "exevents.h" #include "eventstr.h" -#include #include "mi.h" #include "mipointer.h" #include "inpututils.h" diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index f8f65d4a7..c31f89740 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "exevents.h" #include "exglobals.h" #include "windowstr.h" -#include +#include "xkbsrv_priv.h" /***====================================================================***/ diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index c06ec09d4..1e189a3f0 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -39,17 +39,17 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include "os/cmdline.h" +#include "xkb/xkbsrv_priv.h" #include "misc.h" #include "inputstr.h" #include "opaque.h" #include "property.h" #include "scrnintstr.h" -#include #include "xkbgeom.h" -#include #include "xkbfile.h" #define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1) diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index 2ddd7a402..7ac6b1ad9 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -33,14 +33,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include + +#include "xkb/xkbsrv_priv.h" + #include "misc.h" #include "inputstr.h" -#include -#include - -/***====================================================================***/ - /* * unsigned * XkbIndicatorsToUpdate(dev,changed,check_devs_rtrn) diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index d2c7e33f4..972f35170 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -28,21 +28,21 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif +#include #include #include #include #include #include + +#include "xkb/xkbsrv_priv.h" + #include "misc.h" #include "inputstr.h" #include "exevents.h" #include "eventstr.h" -#include -#include #include "events.h" -/***====================================================================***/ - void XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd) { diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 9ad66927c..cdd5eb004 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -52,7 +52,6 @@ DEALINGS IN THE SOFTWARE. #include #endif -#include "os.h" #include #include #include @@ -60,10 +59,13 @@ DEALINGS IN THE SOFTWARE. #include #define XK_CYRILLIC #include + +#include "xkb/xkbsrv_priv.h" + +#include "os.h" #include "misc.h" #include "inputstr.h" #include "eventstr.h" -#include #include "xkbgeom.h" /***====================================================================***/ diff --git a/xkb/xkbsrv_priv.h b/xkb/xkbsrv_priv.h new file mode 100644 index 000000000..8a9592314 --- /dev/null +++ b/xkb/xkbsrv_priv.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 1993 Silicon Graphics Computer Systems, Inc. + * Copyright © 2024 Enrico Weigelt, metux IT consult + */ +#ifndef _XSERVER_XKBSRV_PRIV_H_ +#define _XSERVER_XKBSRV_PRIV_H_ + +#include "xkbsrv.h" + +void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, void *); + +void XkbForceUpdateDeviceLEDs(DeviceIntPtr keybd); + +void XkbPushLockedStateToSlaves(DeviceIntPtr master, int evtype, int key); + +Bool XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src); + +void XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE); + +int XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbstate, CARD8 keycode); + +void XkbMergeLockedPtrBtns(DeviceIntPtr master); + +void XkbFakeDeviceButton(DeviceIntPtr dev, int press, int button); + +#endif /* _XSERVER_XKBSRV_PRIV_H_ */