Xnest: use xcb_window_t instead of Window

Since we're now using xcb for upstream X11 connection, it's cleaner to
use it's type for the window IDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-02 11:48:52 +02:00
parent 5913906151
commit 5038b4e413
8 changed files with 26 additions and 22 deletions

View File

@ -46,7 +46,7 @@ Bool xnestUserBorderWidth = FALSE;
char *xnestWindowName = NULL;
int xnestNumScreens = 0;
Bool xnestDoDirectColormaps = FALSE;
Window xnestParentWindow = 0;
xcb_window_t xnestParentWindow = 0;
int
ddxProcessArgument(int argc, char *argv[], int i)

View File

@ -18,6 +18,8 @@ is" without express or implied warranty.
#include <X11/X.h>
#include <X11/Xdefs.h>
#include <xcb/xcb.h>
extern char *xnestDisplayName;
extern Bool xnestFullGeneration;
extern int xnestDefaultClass;
@ -32,6 +34,6 @@ extern Bool xnestUserBorderWidth;
extern char *xnestWindowName;
extern int xnestNumScreens;
extern Bool xnestDoDirectColormaps;
extern Window xnestParentWindow;
extern xcb_window_t xnestParentWindow;
#endif /* XNESTARGS_H */

View File

@ -17,6 +17,8 @@ is" without express or implied warranty.
#include <X11/Xdefs.h>
#include <X11/Xproto.h>
#include <xcb/xcb.h>
#include "dix/colormap_priv.h"
#include "scrnintstr.h"
@ -182,11 +184,11 @@ xnestGetInstalledColormapWindows(WindowPtr pWin, void *ptr)
return WT_WALKCHILDREN;
}
static Window *xnestOldInstalledColormapWindows = NULL;
static xcb_window_t *xnestOldInstalledColormapWindows = NULL;
static int xnestNumOldInstalledColormapWindows = 0;
static Bool
xnestSameInstalledColormapWindows(Window *windows, int numWindows)
xnestSameInstalledColormapWindows(xcb_window_t *windows, int numWindows)
{
if (xnestNumOldInstalledColormapWindows != numWindows)
return FALSE;
@ -198,7 +200,7 @@ xnestSameInstalledColormapWindows(Window *windows, int numWindows)
return FALSE;
if (memcmp(xnestOldInstalledColormapWindows, windows,
numWindows * sizeof(Window)))
numWindows * sizeof(xcb_window_t)))
return FALSE;
return TRUE;
@ -216,10 +218,7 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
icws.numWindows = 0;
WalkTree(pScreen, xnestCountInstalledColormapWindows, (void *) &icws);
if (icws.numWindows) {
if (!(icws.windows = calloc(icws.numWindows + 1, sizeof(Window)))) {
free(icws.cmapIDs);
return;
}
icws.windows = calloc(icws.numWindows + 1, sizeof(xcb_window_t));
icws.index = 0;
WalkTree(pScreen, xnestGetInstalledColormapWindows, (void *) &icws);
icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];

View File

@ -33,7 +33,7 @@ typedef struct {
int numCmapIDs;
Colormap *cmapIDs;
int numWindows;
Window *windows;
xcb_window_t *windows;
int index;
} xnestInstalledColormapWindows;

View File

@ -46,13 +46,13 @@ is" without express or implied warranty.
#include "Args.h"
#include "mipointrst.h"
Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS];
xcb_window_t xnestDefaultWindows[MAXSCREENS];
xcb_window_t xnestScreenSaverWindows[MAXSCREENS];
DevPrivateKeyRec xnestScreenCursorFuncKeyRec;
DevScreenPrivateKeyRec xnestScreenCursorPrivKeyRec;
ScreenPtr
xnestScreen(Window window)
xnestScreen(xcb_window_t window)
{
int i;

View File

@ -18,10 +18,12 @@ is" without express or implied warranty.
#include <X11/X.h>
#include <X11/Xdefs.h>
extern Window xnestDefaultWindows[MAXSCREENS];
extern Window xnestScreenSaverWindows[MAXSCREENS];
#include <xcb/xcb.h>
ScreenPtr xnestScreen(Window window);
extern xcb_window_t xnestDefaultWindows[MAXSCREENS];
extern xcb_window_t xnestScreenSaverWindows[MAXSCREENS];
ScreenPtr xnestScreen(xcb_window_t window);
Bool xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]);
Bool xnestCloseScreen(ScreenPtr pScreen);

View File

@ -56,7 +56,7 @@ xnestFindWindowMatch(WindowPtr pWin, void *ptr)
}
WindowPtr
xnestWindowPtr(Window window)
xnestWindowPtr(xcb_window_t window)
{
xnestWindowMatch wm;
int i;

View File

@ -16,23 +16,24 @@ is" without express or implied warranty.
#define XNESTWINDOW_H
#include <X11/Xdefs.h>
#include <xcb/xcb.h>
typedef struct {
Window window;
Window parent;
xcb_window_t window;
xcb_window_t parent;
int x;
int y;
unsigned int width;
unsigned int height;
unsigned int border_width;
Window sibling_above;
xcb_window_t sibling_above;
RegionPtr bounding_shape;
RegionPtr clip_shape;
} xnestPrivWin;
typedef struct {
WindowPtr pWin;
Window window;
xcb_window_t window;
} xnestWindowMatch;
extern DevPrivateKeyRec xnestWindowPrivateKeyRec;
@ -55,7 +56,7 @@ extern DevPrivateKeyRec xnestWindowPrivateKeyRec;
#define xnestWindowSiblingBelow(pWin) \
((pWin)->nextSib ? xnestWindow((pWin)->nextSib) : XCB_WINDOW_NONE)
WindowPtr xnestWindowPtr(Window window);
WindowPtr xnestWindowPtr(xcb_window_t window);
Bool xnestCreateWindow(WindowPtr pWin);
Bool xnestDestroyWindow(WindowPtr pWin);
Bool xnestPositionWindow(WindowPtr pWin, int x, int y);