From b4e52a5aad36604856f22e4a7f503e0c3e86813a Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 16 Feb 2024 16:30:15 +0100 Subject: [PATCH] Xnest: drop hack for building 32bit server against 64bit libs Xnest.h contains a weird historical hack for building 32bit server with 64bit libraries. It redeclares a bunch of stanard X types (eg. from Xdefs.h) to 32 bit size. Those hacks are ugly to maintain and can easily cause trouble (eg. if include order gets mixed up). And it's not at all needed anyways. Those kind of situations are easily solved, in a much more robust way: just run build the build it in a chroot or container, or do a pretty boring usual crosscompile. No need to carry special hacks for things that already done out-of-the-box by proper tooling / build environment. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xnest/Color.c | 42 ---------------------------------- hw/xnest/Keyboard.c | 17 -------------- hw/xnest/Xnest.h | 55 --------------------------------------------- 3 files changed, 114 deletions(-) diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c index b8460b974..b4dd5629d 100644 --- a/hw/xnest/Color.c +++ b/hw/xnest/Color.c @@ -216,22 +216,8 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) { free(xnestOldInstalledColormapWindows); -#ifdef _XSERVER64 - { - int i; - Window64 *windows = xallocarray(numWindows, sizeof(Window64)); - - for (i = 0; i < numWindows; ++i) - windows[i] = icws.windows[i]; - XSetWMColormapWindows(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], windows, - numWindows); - free(windows); - } -#else XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum], icws.windows, numWindows); -#endif xnestOldInstalledColormapWindows = icws.windows; xnestNumOldInstalledColormapWindows = icws.numWindows; @@ -273,19 +259,8 @@ xnestSetScreenSaverColormapWindow(ScreenPtr pScreen) { free(xnestOldInstalledColormapWindows); -#ifdef _XSERVER64 - { - Window64 window; - - window = xnestScreenSaverWindows[pScreen->myNum]; - XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum], - &window, 1); - xnestScreenSaverWindows[pScreen->myNum] = window; - } -#else XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum], &xnestScreenSaverWindows[pScreen->myNum], 1); -#endif /* _XSERVER64 */ xnestOldInstalledColormapWindows = NULL; xnestNumOldInstalledColormapWindows = 0; @@ -388,25 +363,8 @@ void xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem * pColors) { if (pCmap->pVisual->class & DynamicClass) -#ifdef _XSERVER64 - { - int i; - XColor *pColors64 = xallocarray(nColors, sizeof(XColor)); - - for (i = 0; i < nColors; ++i) { - pColors64[i].pixel = pColors[i].pixel; - pColors64[i].red = pColors[i].red; - pColors64[i].green = pColors[i].green; - pColors64[i].blue = pColors[i].blue; - pColors64[i].flags = pColors[i].flags; - } - XStoreColors(xnestDisplay, xnestColormap(pCmap), pColors64, nColors); - free(pColors64); - } -#else XStoreColors(xnestDisplay, xnestColormap(pCmap), (XColor *) pColors, nColors); -#endif } void diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index cd6e69b0b..212835b07 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -125,26 +125,9 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff) switch (onoff) { case DEVICE_INIT: XDisplayKeycodes(xnestDisplay, &min_keycode, &max_keycode); -#ifdef _XSERVER64 - { - KeySym64 *keymap64; - int len; - - keymap64 = XGetKeyboardMapping(xnestDisplay, - min_keycode, - max_keycode - min_keycode + 1, - &mapWidth); - len = (max_keycode - min_keycode + 1) * mapWidth; - keymap = xallocarray(len, sizeof(KeySym)); - for (i = 0; i < len; ++i) - keymap[i] = keymap64[i]; - XFree(keymap64); - } -#else keymap = XGetKeyboardMapping(xnestDisplay, min_keycode, max_keycode - min_keycode + 1, &mapWidth); -#endif memset(modmap, 0, sizeof(modmap)); modifier_keymap = XGetModifierMapping(xnestDisplay); diff --git a/hw/xnest/Xnest.h b/hw/xnest/Xnest.h index fafb2c876..87c47f471 100644 --- a/hw/xnest/Xnest.h +++ b/hw/xnest/Xnest.h @@ -30,65 +30,10 @@ from the X Consortium. #ifndef _XORG_XNEST_H #define _XORG_XNEST_H -/* -** Machines with a 64 bit library interface and a 32 bit server require -** name changes to protect the guilty. -*/ -#ifdef _XSERVER64 -#define _XSERVER64_tmp -#undef _XSERVER64 -typedef unsigned long XID64; -typedef unsigned long Mask64; -typedef unsigned long Atom64; -typedef unsigned long VisualID64; -typedef unsigned long Time64; - -#define XID XID64 -#define Mask Mask64 -#define Atom Atom64 -#define VisualID VisualID64 -#define Time Time64 -typedef XID Window64; -typedef XID Drawable64; -typedef XID Font64; -typedef XID Pixmap64; -typedef XID Cursor64; -typedef XID Colormap64; -typedef XID GContext64; -typedef XID KeySym64; - -#define Window Window64 -#define Drawable Drawable64 -#define Font Font64 -#define Pixmap Pixmap64 -#define Cursor Cursor64 -#define Colormap Colormap64 -#define GContext GContext64 -#define KeySym KeySym64 -#endif /*_XSERVER64*/ - #define GC XlibGC #include #include #include #undef GC -#ifdef _XSERVER64_tmp -#define _XSERVER64 -#undef _XSERVER64_tmp -#undef XID -#undef Mask -#undef Atom -#undef VisualID -#undef Time -#undef Window -#undef Drawable -#undef Font -#undef Pixmap -#undef Cursor -#undef Colormap -#undef GContext -#undef KeySym -#endif /*_XSERVER64_tmp*/ - #endif /* _XORG_XNEST_H */