include: new header for fundamental pointer types

This header is holding forward declarations that are needed in many places.
It's for helping us to unclutter the include files a little bit.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2026-02-12 17:33:45 +01:00
committed by Enrico Weigelt
parent 25fc1a02f5
commit 976e6cdd13
25 changed files with 72 additions and 24 deletions

View File

@@ -47,13 +47,16 @@ SOFTWARE.
#ifndef DIX_H
#define DIX_H
#include <X11/extensions/XI.h>
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "gc.h"
#include "window.h"
#include "input.h"
#include "cursor.h"
#include "events.h"
#include <X11/extensions/XI.h>
#define EARLIER -1
#define SAMETIME 0
@@ -92,12 +95,6 @@ SOFTWARE.
typedef struct _TimeStamp *TimeStampPtr;
#ifndef _XTYPEDEF_CLIENTPTR
typedef struct _Client *ClientPtr;
#define _XTYPEDEF_CLIENTPTR
#endif
extern _X_EXPORT ClientPtr clients[];
extern _X_EXPORT ClientPtr serverClient;
extern _X_EXPORT int currentMaxClients;

View File

@@ -24,6 +24,8 @@ SOFTWARE.
#ifndef DIXFONT_H
#define DIXFONT_H 1
#include "xlibre_ptrtypes.h"
#include "dix.h"
#include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h>

View File

@@ -26,6 +26,8 @@ SOFTWARE.
#include <X11/Xmd.h>
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "dix.h"
#include "resource.h"
@@ -34,9 +36,6 @@ SOFTWARE.
#include "pixmap.h"
#include "privates.h"
struct _Client;
typedef struct _ClientId *ClientIdPtr;
/*
* direct-mapped hash table, used by resource manager to store
* translation from client ids to server addresses.
@@ -72,9 +71,7 @@ typedef struct _saveSet {
#define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr))
#define SaveSetAssignMap(ss,m) ((ss).map = (m))
struct _ClientId;
typedef struct _Client {
struct _Client {
void *requestBuffer;
void *osPrivate; /* for OS layer, including scheduler */
struct xorg_list ready; /* List of clients ready to run */
@@ -112,7 +109,7 @@ typedef struct _Client {
DeviceIntPtr clientPtr;
struct _ClientId *clientIds;
int req_fds;
} ClientRec;
};
extern _X_EXPORT TimeStamp currentTime;

View File

@@ -76,6 +76,7 @@ SOFTWARE.
#include <X11/Xfuncproto.h>
#include "xlibre_ptrtypes.h"
#include "dixstruct.h"
typedef void (*InitExtension) (void);

View File

@@ -47,6 +47,7 @@ SOFTWARE.
#ifndef EXTENSIONSTRUCT_H
#define EXTENSIONSTRUCT_H
#include "xlibre_ptrtypes.h"
#include "dix.h"
#include "misc.h"
#include "screenint.h"

View File

@@ -59,6 +59,8 @@
#ifndef GLXVENDORABI_H
#define GLXVENDORABI_H
#include "xlibre_ptrtypes.h"
#include <scrnintstr.h>
#include <extnsionst.h>
#include <GL/glxproto.h>

View File

@@ -47,6 +47,8 @@ SOFTWARE.
#ifndef INPUT_H
#define INPUT_H
#include "xlibre_ptrtypes.h"
#include "misc.h"
#include "screenint.h"
#include <X11/Xmd.h>

View File

@@ -518,6 +518,7 @@ if build_xorg
'Xprintf.h',
'xf86sbusBus.h',
'xserver-properties.h',
'xlibre_ptrtypes.h',
],
install_dir: xorgsdkdir,
)

View File

@@ -24,6 +24,8 @@
#define _MISYNCSTR_H_
#include <stdint.h>
#include "xlibre_ptrtypes.h"
#include "dix.h"
#include "misync.h"
#include "scrnintstr.h"

View File

@@ -47,9 +47,6 @@ SOFTWARE.
#ifndef OS_H
#define OS_H
#include "callback.h"
#include "misc.h"
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
@@ -60,6 +57,10 @@ SOFTWARE.
#include <X11/Xfuncproto.h>
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "misc.h"
/*
* @brief macro for specifying non-null arguments
*

View File

@@ -47,6 +47,7 @@ SOFTWARE.
#ifndef PROPERTY_H
#define PROPERTY_H
#include "xlibre_ptrtypes.h"
#include "window.h"
extern _X_EXPORT int dixChangeWindowProperty(ClientPtr pClient,

View File

@@ -30,6 +30,8 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include "xlibre_ptrtypes.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"

View File

@@ -47,8 +47,9 @@ SOFTWARE.
#ifndef RESOURCE_H
#define RESOURCE_H 1
#include "callback.h"
#include "xlibre_ptrtypes.h"
#include "callback.h"
#include "misc.h"
#include "dixaccess.h"

View File

@@ -47,6 +47,7 @@ SOFTWARE.
#ifndef SCREENINTSTRUCT_H
#define SCREENINTSTRUCT_H
#include "xlibre_ptrtypes.h"
#include "screenint.h"
#include "regionstr.h"
#include "colormap.h"

View File

@@ -49,6 +49,7 @@ SOFTWARE.
#include <X11/Xproto.h>
#include "xlibre_ptrtypes.h"
#include "misc.h"
#include "regionstr.h"
#include "screenint.h"

View File

@@ -47,6 +47,7 @@ SOFTWARE.
#ifndef WINDOWSTRUCT_H
#define WINDOWSTRUCT_H
#include "xlibre_ptrtypes.h"
#include "window.h"
#include "pixmapstr.h"
#include "regionstr.h"
@@ -114,7 +115,7 @@ typedef struct _WindowOpt {
#define RedirectDrawAutomatic 1
#define RedirectDrawManual 2
typedef struct _Window {
struct _Window {
DrawableRec drawable;
PrivateRec *devPrivates;
WindowPtr parent; /* ancestor chain */
@@ -154,7 +155,7 @@ typedef struct _Window {
unsigned inhibitBGPaint:1; /* paint the background? */
PropertyPtr properties; /* default: NULL */
} WindowRec;
};
extern _X_EXPORT Mask DontPropagateMasks[];

View File

@@ -35,6 +35,7 @@
#ifndef _XF86_H
#define _XF86_H
#include "xlibre_ptrtypes.h"
#include "xf86str.h"
#include "xf86Opt.h"
#include <X11/Xfuncproto.h>

View File

@@ -35,6 +35,7 @@
#ifndef _XF86PRIV_H
#define _XF86PRIV_H
#include "xlibre_ptrtypes.h"
#include "xf86Privstr.h"
#include "input.h"

View File

@@ -53,6 +53,7 @@
#include <X11/Xfuncproto.h>
#include "xlibre_ptrtypes.h"
#include "xf86.h"
#include "xf86str.h"
#include "inputstr.h"

View File

@@ -29,6 +29,7 @@
#ifndef _XF86CMAP_H
#define _XF86CMAP_H
#include "xlibre_ptrtypes.h"
#include "xf86str.h"
#define CMAP_PALETTED_TRUECOLOR 0x0000001

View File

@@ -34,6 +34,7 @@
#ifndef _XF86STR_H
#define _XF86STR_H
#include "xlibre_ptrtypes.h"
#include "misc.h"
#include "input.h"
#include "scrnintstr.h"
@@ -160,7 +161,6 @@ typedef struct x_ClockRange {
* FALSE. pointer can be used to pass arguments to the function or
* to return data to the caller.
*/
typedef struct _ScrnInfoRec *ScrnInfoPtr;
/* do not change order */
typedef enum {
@@ -564,8 +564,7 @@ typedef void xf86ModeSetProc(ScrnInfoPtr);
* There is one of these for each screen, and it holds all the screen-specific
* information. Note: No fields are to be dependent on compile-time defines.
*/
typedef struct _ScrnInfoRec {
struct _ScrnInfoRec {
int driverVersion;
const char *driverName; /* canonical name used in */
/* the config file */
@@ -691,7 +690,7 @@ typedef struct _ScrnInfoRec {
int reservedInt[NUM_RESERVED_INTS];
void *reservedPtr[NUM_RESERVED_POINTERS];
funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
} ScrnInfoRec;
};
typedef struct {
Bool (*OpenFramebuffer) (ScrnInfoPtr pScrn,

View File

@@ -29,6 +29,7 @@
#ifndef _XF86XV_H_
#define _XF86XV_H_
#include "xlibre_ptrtypes.h"
#include "xvdix.h"
#include "xf86str.h"

View File

@@ -29,6 +29,7 @@
#ifndef _XF86XVMC_H
#define _XF86XVMC_H
#include "xlibre_ptrtypes.h"
#include "xvmcext.h"
#include "xf86xv.h"

View File

@@ -32,6 +32,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xdefs.h>
#include <X11/extensions/XKBproto.h>
#include "xlibre_ptrtypes.h"
#include "xkbstr.h"
#include "xkbrules.h"
#include "inputstr.h"

29
include/xlibre_ptrtypes.h Normal file
View File

@@ -0,0 +1,29 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*
* @brief
* This header holds forward definitions for pointer types used in many places.
* Helpful for uncluttering the includes a bit, so we have less complex dependencies.
*
* External drivers rarely have a reason for directly including it.
*/
#ifndef _XLIBRE_SDK_PTRTYPES_H
#define _XLIBRE_SDK_PTRTYPES_H
struct _Client;
typedef struct _Client *ClientPtr;
typedef struct _Client ClientRec;
struct _ClientId;
typedef struct _ClientId *ClientIdPtr;
struct _Window;
typedef struct _Window *WindowPtr;
typedef struct _Window WindowRec;
struct _ScrnInfoRec;
typedef struct _ScrnInfoRec *ScrnInfoPtr;
typedef struct _ScrnInfoRec ScrnInfoRec;
#endif /* _XLIBRE_SDK_PTRTYPES_H */