From 4ac10378e111e73ceac601e285f7bee89a9aa948 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 12 Mar 2025 16:17:31 +0100 Subject: [PATCH] dix: unexport and rename CreateWindow() a) an internal function that's not used by any drivers b) conflicting with function/define of same name on win32 Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/saver.c | 11 ++++------- composite/compoverlay.c | 4 +++- dix/dispatch.c | 6 ++---- dix/window.c | 12 ++++-------- dix/window_priv.h | 35 +++++++++++++++++++++++++++++++++++ hw/xwin/winms.h | 2 -- include/window.h | 15 --------------- 7 files changed, 48 insertions(+), 37 deletions(-) create mode 100644 dix/window_priv.h diff --git a/Xext/saver.c b/Xext/saver.c index 0085d5665..d82665702 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -36,6 +36,7 @@ in this Software without prior written authorization from the X Consortium. #include "dix/colormap_priv.h" #include "dix/cursor_priv.h" #include "dix/dix_priv.h" +#include "dix/window_priv.h" #include "os/osdep.h" #include "os/screensaver.h" @@ -63,10 +64,6 @@ in this Software without prior written authorization from the X Consortium. #include "protocol-versions.h" #include "extinit_priv.h" -// temporary workaround for win32/mingw32 name clash -// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355 -#undef CreateWindow - Bool noScreenSaverExtension = FALSE; static int ScreenSaverEventBase = 0; @@ -476,7 +473,7 @@ CreateSaverWindow(ScreenPtr pScreen) if (GrabInProgress && GrabInProgress != pAttr->client->index) return FALSE; - pWin = CreateWindow(pSaver->wid, pScreen->root, + pWin = dixCreateWindow(pSaver->wid, pScreen->root, pAttr->x, pAttr->y, pAttr->width, pAttr->height, pAttr->borderWidth, pAttr->class, pAttr->mask, (XID *) pAttr->values, @@ -757,7 +754,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff) depth = stuff->depth; visual = stuff->visualID; - /* copied directly from CreateWindow */ + /* copied directly from dixCreateWindow */ if (class == CopyFromParent) class = pParent->drawable.class; @@ -810,7 +807,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff) return BadMatch; } - /* end of errors from CreateWindow */ + /* end of errors from dixCreateWindow */ pPriv = GetScreenPrivate(pScreen); if (pPriv && pPriv->attr) { diff --git a/composite/compoverlay.c b/composite/compoverlay.c index e2c4c58bf..c646840c7 100644 --- a/composite/compoverlay.c +++ b/composite/compoverlay.c @@ -43,6 +43,8 @@ #include +#include "dix/window_priv.h" + #include "compint.h" #include "xace.h" @@ -141,7 +143,7 @@ compCreateOverlayWindow(ScreenPtr pScreen) #endif /* XINERAMA */ pWin = cs->pOverlayWin = - CreateWindow(cs->overlayWid, pRoot, x, y, w, h, 0, + dixCreateWindow(cs->overlayWid, pRoot, x, y, w, h, 0, InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0], pRoot->drawable.depth, serverClient, pScreen->rootVisual, &result); diff --git a/dix/dispatch.c b/dix/dispatch.c index bd3b8288e..77686c884 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -111,6 +111,7 @@ Equipment Corporation. #include "dix/registry_priv.h" #include "dix/resource_priv.h" #include "dix/screenint_priv.h" +#include "dix/window_priv.h" #include "include/resource.h" #include "os/auth.h" #include "os/client_priv.h" @@ -138,9 +139,6 @@ Equipment Corporation. #include "xfixesint.h" #include "dixstruct_priv.h" -// temporary workaround for win32/mingw32 name clash -#undef CreateWindow - #ifdef XSERVER_DTRACE #include "probes.h" #endif @@ -751,7 +749,7 @@ ProcCreateWindow(ClientPtr client) client->errorValue = 0; return BadValue; } - pWin = CreateWindow(stuff->wid, pParent, stuff->x, + pWin = dixCreateWindow(stuff->wid, pParent, stuff->x, stuff->y, stuff->width, stuff->height, stuff->borderWidth, stuff->class, stuff->mask, (XID *) &stuff[1], diff --git a/dix/window.c b/dix/window.c index 66e8cf36c..d911bf00d 100644 --- a/dix/window.c +++ b/dix/window.c @@ -106,6 +106,7 @@ Equipment Corporation. #include "dix/input_priv.h" #include "dix/property_priv.h" #include "dix/resource_priv.h" +#include "dix/window_priv.h" #include "mi/mi_priv.h" /* miPaintWindow */ #include "os/auth.h" #include "os/client_priv.h" @@ -142,7 +143,7 @@ Equipment Corporation. /****** * Window stuff for server * - * CreateRootWindow, CreateWindow, ChangeWindowAttributes, + * CreateRootWindow, dixCreateWindow, ChangeWindowAttributes, * GetWindowAttributes, DeleteWindow, DestroySubWindows, * HandleSaveSet, ReparentWindow, MapWindow, MapSubWindows, * UnmapWindow, UnmapSubWindows, ConfigureWindow, CirculateWindow, @@ -741,13 +742,8 @@ RealChildHead(WindowPtr pWin) return NullWindow; } -/***** - * CreateWindow - * Makes a window in response to client request - *****/ - WindowPtr -CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, +dixCreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, unsigned h, unsigned bw, unsigned class, Mask vmask, XID *vlist, int depth, ClientPtr client, VisualID visual, int *error) { @@ -3277,7 +3273,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind) } pWin = pScreen->screensaver.pWindow = - CreateWindow(pScreen->screensaver.wid, + dixCreateWindow(pScreen->screensaver.wid, pScreen->root, -RANDOM_WIDTH, -RANDOM_WIDTH, (unsigned short) pScreen->width + RANDOM_WIDTH, diff --git a/dix/window_priv.h b/dix/window_priv.h new file mode 100644 index 000000000..a2bb28dce --- /dev/null +++ b/dix/window_priv.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2025 Enrico Weigelt, metux IT consult + */ +#ifndef _XSERVER_DIX_WINDOW_H +#define _XSERVER_DIX_WINDOW_H + +#include + +#include "include/dix.h" +#include "include/window.h" + +/* + * @brief create a window + * + * Creates a window with given XID, geometry, etc + * + * @return pointer to new Window or NULL on error (see error pointer) + */ +WindowPtr dixCreateWindow(Window wid, + WindowPtr pParent, + int x, + int y, + unsigned int w, + unsigned int h, + unsigned int bw, + unsigned int windowclass, + Mask vmask, + XID * vlist, + int depth, + ClientPtr client, + VisualID visual, + int * error); + +#endif /* _XSERVER_DIX_WINDOW_H */ diff --git a/hw/xwin/winms.h b/hw/xwin/winms.h index 32923e503..3143aeac3 100644 --- a/hw/xwin/winms.h +++ b/hw/xwin/winms.h @@ -47,6 +47,4 @@ #include "ddraw.h" #pragma pop_macro("Status") -#undef CreateWindow - #endif /* _WINMS_H_ */ diff --git a/include/window.h b/include/window.h index 7a22febf8..ded5748cd 100644 --- a/include/window.h +++ b/include/window.h @@ -99,21 +99,6 @@ extern _X_EXPORT void RegisterRealChildHeadProc(RealChildHeadProc proc); extern _X_EXPORT WindowPtr RealChildHead(WindowPtr /*pWin */ ); -extern _X_EXPORT WindowPtr CreateWindow(Window /*wid */ , - WindowPtr /*pParent */ , - int /*x */ , - int /*y */ , - unsigned int /*w */ , - unsigned int /*h */ , - unsigned int /*bw */ , - unsigned int /*class */ , - Mask /*vmask */ , - XID * /*vlist */ , - int /*depth */ , - ClientPtr /*client */ , - VisualID /*visual */ , - int * /*error */ ); - extern _X_EXPORT int DeleteWindow(void *pWin, XID wid);