xserver: Branch 'orib-soc-2006'
Ori Bernstein
orib at kemper.freedesktop.org
Fri Jun 9 01:08:39 EEST 2006
hw/xnest/Args.c | 9
hw/xnest/Args.h | 2
hw/xnest/Color.c | 796 ++++++++++++++++++++++-----------------------
hw/xnest/Color.h | 10
hw/xnest/Cursor.c | 255 ++++++++------
hw/xnest/Display.c | 396 +++++++++++++---------
hw/xnest/Display.h | 36 +-
hw/xnest/Drawable.h | 5
hw/xnest/Events.c | 327 +++++++++---------
hw/xnest/Font.c | 112 +++---
hw/xnest/GC.c | 537 +++++++++++++++---------------
hw/xnest/GCOps.c | 550 ++++++++++++++++++-------------
hw/xnest/Handlers.c | 7
hw/xnest/Init.c | 37 +-
hw/xnest/Keyboard.c | 461 +++++++++++++-------------
hw/xnest/Makefile.am | 1
hw/xnest/Pixmap.c | 41 +-
hw/xnest/Pointer.c | 74 ++--
hw/xnest/Screen.c | 709 ++++++++++++++++++++--------------------
hw/xnest/Screen.h | 6
hw/xnest/Visual.c | 87 ++--
hw/xnest/Visual.h | 9
hw/xnest/Window.c | 893 +++++++++++++++++++++++++--------------------------
hw/xnest/XNFont.h | 8
hw/xnest/XNGC.h | 2
hw/xnest/XNPixmap.h | 2
hw/xnest/XNWindow.h | 16
27 files changed, 2822 insertions(+), 2566 deletions(-)
New commits:
diff-tree 2dee7c5fa8c41ac89d437d52502d906c2fb260b0 (from 614fe9dd3de15cf275b99ca5b6fef2268ff12bad)
Author: Ori Bernstein <rand.chars at gmail.com>
Date: Thu Jun 8 18:14:09 2006 -0500
Actually committing xnest port to XCB
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c
index a366774..bfe7cd1 100644
--- a/hw/xnest/Args.c
+++ b/hw/xnest/Args.c
@@ -18,8 +18,9 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -49,7 +50,7 @@ Bool xnestUserBorderWidth = False;
char *xnestWindowName = NULL;
int xnestNumScreens = 0;
Bool xnestDoDirectColormaps = False;
-Window xnestParentWindow = 0;
+XCBWINDOW xnestParentWindow = {0};
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
void ddxInitGlobals(void)
@@ -174,7 +175,7 @@ ddxProcessArgument (int argc, char *argv
}
if (!strcmp(argv[i], "-parent")) {
if (++i < argc) {
- xnestParentWindow = (XID) strtol (argv[i], (char**)NULL, 0);
+ xnestParentWindow.xid = (CARD32) strtol (argv[i], (char**)NULL, 0);
return 2;
}
}
diff --git a/hw/xnest/Args.h b/hw/xnest/Args.h
index a0c586b..237938f 100644
--- a/hw/xnest/Args.h
+++ b/hw/xnest/Args.h
@@ -35,6 +35,6 @@ extern Bool xnestUserBorderWidth;
extern char *xnestWindowName;
extern int xnestNumScreens;
extern Bool xnestDoDirectColormaps;
-extern Window xnestParentWindow;
+extern XCBWINDOW xnestParentWindow;
#endif /* XNESTARGS_H */
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index 779633a..973e874 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -1,15 +1,15 @@
/* $Xorg: Color.c,v 1.3 2000/08/17 19:53:27 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86$ */
@@ -18,8 +18,10 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/xcb_aux.h>
#include "scrnintstr.h"
#include "window.h"
#include "windowstr.h"
@@ -38,460 +40,462 @@ is" without express or implied warranty.
static ColormapPtr InstalledMaps[MAXSCREENS];
-Bool
-xnestCreateColormap(ColormapPtr pCmap)
+Bool xnestCreateColormap(ColormapPtr pCmap)
{
- VisualPtr pVisual;
- XColor *colors;
- int i, ncolors;
- Pixel red, green, blue;
- Pixel redInc, greenInc, blueInc;
-
- pVisual = pCmap->pVisual;
- ncolors = pVisual->ColormapEntries;
-
- pCmap->devPriv = (pointer)xalloc(sizeof(xnestPrivColormap));
-
- xnestColormapPriv(pCmap)->colormap =
- XCreateColormap(xnestDisplay,
- xnestDefaultWindows[pCmap->pScreen->myNum],
- xnestVisual(pVisual),
- (pVisual->class & DynamicClass) ?
- AllocAll : AllocNone);
-
-
- switch (pVisual->class) {
- case StaticGray: /* read only */
- colors = (XColor *)xalloc(ncolors * sizeof(XColor));
- for (i = 0; i < ncolors; i++)
- colors[i].pixel = i;
- XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
- pCmap->red[i].co.local.red = colors[i].red;
- pCmap->red[i].co.local.green = colors[i].red;
- pCmap->red[i].co.local.blue = colors[i].red;
- }
- xfree(colors);
- break;
-
- case StaticColor: /* read only */
- colors = (XColor *)xalloc(ncolors * sizeof(XColor));
- for (i = 0; i < ncolors; i++)
- colors[i].pixel = i;
- XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
- pCmap->red[i].co.local.red = colors[i].red;
- pCmap->red[i].co.local.green = colors[i].green;
- pCmap->red[i].co.local.blue = colors[i].blue;
- }
- xfree(colors);
- break;
-
- case TrueColor: /* read only */
- colors = (XColor *)xalloc(ncolors * sizeof(XColor));
- red = green = blue = 0L;
- redInc = lowbit(pVisual->redMask);
- greenInc = lowbit(pVisual->greenMask);
- blueInc = lowbit(pVisual->blueMask);
- for (i = 0; i < ncolors; i++) {
- colors[i].pixel = red | green | blue;
- red += redInc;
- if (red > pVisual->redMask) red = 0L;
- green += greenInc;
- if (green > pVisual->greenMask) green = 0L;
- blue += blueInc;
- if (blue > pVisual->blueMask) blue = 0L;
- }
- XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
- pCmap->red[i].co.local.red = colors[i].red;
- pCmap->green[i].co.local.green = colors[i].green;
- pCmap->blue[i].co.local.blue = colors[i].blue;
- }
- xfree(colors);
- break;
-
- case GrayScale: /* read and write */
- break;
-
- case PseudoColor: /* read and write */
- break;
-
- case DirectColor: /* read and write */
- break;
- }
-
- return True;
+ VisualPtr pVisual;
+ XCBRGB *colors;
+ int i, ncolors;
+ CARD32 *pixels;
+ CARD32 red, green, blue;
+ CARD32 redInc, greenInc, blueInc;
+ XCBQueryColorsCookie c;
+ XCBQueryColorsRep *rep;
+
+ pVisual = pCmap->pVisual;
+ ncolors = pVisual->ColormapEntries;
+
+ pCmap->devPriv = (pointer)xalloc(sizeof(xnestPrivColormap));
+
+ xnestColormapPriv(pCmap)->colormap = XCBCOLORMAPNew(xnestConnection);
+ XCBCreateColormap(xnestConnection,
+ (pVisual->class & DynamicClass) ? AllocAll : AllocNone,
+ xnestColormapPriv(pCmap)->colormap,
+ xnestDefaultWindows[pCmap->pScreen->myNum],
+ xnestVisual(pVisual)->visual_id);
+
+
+ switch (pVisual->class) {
+ case XCBVisualClassStaticGray: /* read only */
+ colors = xalloc(ncolors * sizeof(XCBRGB));
+ pixels = xalloc(ncolors * sizeof(CARD32));
+ for (i = 0; i < ncolors; i++)
+ pixels[i] = i;
+ c = XCBQueryColors(xnestConnection, xnestColormap(pCmap), ncolors, pixels);
+ rep = XCBQueryColorsReply(xnestConnection, c, 0);
+ colors = XCBQueryColorsColors(rep);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->red[i].co.local.green = colors[i].red;
+ pCmap->red[i].co.local.blue = colors[i].red;
+ }
+ xfree(colors);
+ xfree(pixels);
+ break;
+
+ case XCBVisualClassStaticColor: /* read only */
+ colors = xalloc(ncolors * sizeof(XCBRGB));
+ pixels = xalloc(ncolors * sizeof(CARD32));
+ for (i = 0; i < ncolors; i++)
+ pixels[i] = i;
+ c = XCBQueryColors(xnestConnection, xnestColormap(pCmap), ncolors, pixels);
+ rep = XCBQueryColorsReply(xnestConnection, c, 0);
+ colors = XCBQueryColorsColors(rep);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->red[i].co.local.green = colors[i].green;
+ pCmap->red[i].co.local.blue = colors[i].blue;
+ }
+ xfree(colors);
+ xfree(pixels);
+ break;
+
+ case XCBVisualClassTrueColor: /* read only */
+ //colors = xalloc(ncolors * sizeof(XCBRGB));
+ pixels = xalloc(ncolors * sizeof(CARD32));
+ red = green = blue = 0L;
+ redInc = lowbit(pVisual->redMask);
+ greenInc = lowbit(pVisual->greenMask);
+ blueInc = lowbit(pVisual->blueMask);
+ for (i = 0; i < ncolors; i++) {
+ pixels[i] = red | green | blue;
+ red += redInc;
+ if (red > pVisual->redMask) red = 0L;
+ green += greenInc;
+ if (green > pVisual->greenMask) green = 0L;
+ blue += blueInc;
+ if (blue > pVisual->blueMask) blue = 0L;
+ }
+
+ c = XCBQueryColors(xnestConnection, xnestColormap(pCmap), ncolors, pixels);
+ xfree(pixels);
+ rep = XCBQueryColorsReply(xnestConnection, c, 0);
+ colors = XCBQueryColorsColors(rep);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->green[i].co.local.green = colors[i].green;
+ pCmap->blue[i].co.local.blue = colors[i].blue;
+ }
+ /*free(colors); FIXME: are we leaking? crash if I free it...*/
+ break;
+
+ case XCBVisualClassGrayScale: /* read and write */
+ break;
+
+ case XCBVisualClassPseudoColor: /* read and write */
+ break;
+
+ case XCBVisualClassDirectColor: /* read and write */
+ break;
+ }
+
+ return True;
}
-void
-xnestDestroyColormap(ColormapPtr pCmap)
+void xnestDestroyColormap(ColormapPtr pCmap)
{
- XFreeColormap(xnestDisplay, xnestColormap(pCmap));
- xfree(pCmap->devPriv);
+ XCBFreeColormap(xnestConnection, xnestColormap(pCmap));
+ xfree(pCmap->devPriv);
}
#define SEARCH_PREDICATE \
- (xnestWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i])
+ (xnestWindow(pWin).xid != None && wColormap(pWin) == icws->cmapIDs[i].xid)
-static int
-xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+static int xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr)
{
- xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
- int i;
-
- for (i = 0; i < icws->numCmapIDs; i++)
- if (SEARCH_PREDICATE) {
- icws->numWindows++;
- return WT_DONTWALKCHILDREN;
- }
-
- return WT_WALKCHILDREN;
+ xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
+ int i;
+
+ for (i = 0; i < icws->numCmapIDs; i++)
+ if (SEARCH_PREDICATE) {
+ icws->numWindows++;
+ return WT_DONTWALKCHILDREN;
+ }
+
+ return WT_WALKCHILDREN;
}
-static int
-xnestGetInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+static int xnestGetInstalledColormapWindows(WindowPtr pWin, pointer ptr)
{
- xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
- int i;
-
- for (i = 0; i < icws->numCmapIDs; i++)
- if (SEARCH_PREDICATE) {
- icws->windows[icws->index++] = xnestWindow(pWin);
- return WT_DONTWALKCHILDREN;
- }
-
- return WT_WALKCHILDREN;
+ xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
+ int i;
+
+ for (i = 0; i < icws->numCmapIDs; i++)
+ if (SEARCH_PREDICATE) {
+ icws->windows[icws->index++] = xnestWindow(pWin);
+ return WT_DONTWALKCHILDREN;
+ }
+
+ return WT_WALKCHILDREN;
}
-static Window *xnestOldInstalledColormapWindows = NULL;
+static XCBWINDOW *xnestOldInstalledColormapWindows = NULL;
static int xnestNumOldInstalledColormapWindows = 0;
-
-static Bool
-xnestSameInstalledColormapWindows(Window *windows, int numWindows)
+static Bool xnestSameInstalledColormapWindows(XCBWINDOW *windows, int numWindows)
{
- if (xnestNumOldInstalledColormapWindows != numWindows)
- return False;
+ if (xnestNumOldInstalledColormapWindows != numWindows)
+ return False;
+
+ if (xnestOldInstalledColormapWindows == windows)
+ return True;
+
+ if (xnestOldInstalledColormapWindows == NULL || windows == NULL)
+ return False;
+
+ if (memcmp(xnestOldInstalledColormapWindows, windows,
+ numWindows * sizeof(XCBWINDOW)))
+ return False;
- if (xnestOldInstalledColormapWindows == windows)
return True;
+}
- if (xnestOldInstalledColormapWindows == NULL || windows == NULL)
- return False;
+static void xnestSetWmColormapWindows(XCBConnection *c, XCBWINDOW win, XCBWINDOW *wins, int numwin)
+{
+}
- if (memcmp(xnestOldInstalledColormapWindows, windows,
- numWindows * sizeof(Window)))
- return False;
-
- return True;
-}
-
-void
-xnestSetInstalledColormapWindows(ScreenPtr pScreen)
-{
- xnestInstalledColormapWindows icws;
- int numWindows;
-
- icws.cmapIDs = (Colormap *)xalloc(pScreen->maxInstalledCmaps *
- sizeof(Colormap));
- icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
- icws.numWindows = 0;
- WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer)&icws);
- if (icws.numWindows) {
- icws.windows = (Window *)xalloc((icws.numWindows + 1) * sizeof(Window));
- icws.index = 0;
- WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer)&icws);
- icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
- numWindows = icws.numWindows + 1;
- }
- else {
- icws.windows = NULL;
- numWindows = 0;
- }
-
- xfree(icws.cmapIDs);
-
- if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
- if (xnestOldInstalledColormapWindows)
- xfree(xnestOldInstalledColormapWindows);
+void xnestSetInstalledColormapWindows(ScreenPtr pScreen)
+{
+ xnestInstalledColormapWindows icws;
+ XCBVISUALID vis;
+ XCBParamsCW params;
+ int numWindows;
+ icws.cmapIDs = (XCBCOLORMAP *)xalloc(pScreen->maxInstalledCmaps *
+ sizeof(XCBCOLORMAP));
+ icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
+ icws.numWindows = 0;
+ WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer)&icws);
+ if (icws.numWindows) {
+ icws.windows = xalloc((icws.numWindows + 1) * sizeof(XCBWINDOW));
+ icws.index = 0;
+ WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer)&icws);
+ icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
+ numWindows = icws.numWindows + 1;
+ }
+ else {
+ icws.windows = NULL;
+ numWindows = 0;
+ }
+
+ xfree(icws.cmapIDs);
+
+ if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
+ if (xnestOldInstalledColormapWindows)
+ xfree(xnestOldInstalledColormapWindows);
+/* Hm, how do I deal with _XSERVER64 in XCB?
#ifdef _XSERVER64
- {
- int i;
- Window64 *windows = (Window64 *)xalloc(numWindows * sizeof(Window64));
+ {
+ int i;
+ Window64 *windows = (Window64 *)xalloc(numWindows * sizeof(Window64));
- for(i = 0; i < numWindows; ++i)
- windows[i] = icws.windows[i];
- XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- windows, numWindows);
- xfree(windows);
- }
-#else
- XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- icws.windows, numWindows);
-#endif
+ for(i = 0; i < numWindows; ++i)
+ windows[i] = icws.windows[i];
+ xnestSetWmColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ windows, numWindows);
+ xfree(windows);
+ }
+#else*/
+ xnestSetWmColormapWindows(xnestConnection, xnestDefaultWindows[pScreen->myNum], icws.windows, numWindows);
+/*#endif*/
- xnestOldInstalledColormapWindows = icws.windows;
- xnestNumOldInstalledColormapWindows = icws.numWindows;
+ xnestOldInstalledColormapWindows = icws.windows;
+ xnestNumOldInstalledColormapWindows = icws.numWindows;
#ifdef DUMB_WINDOW_MANAGERS
- /*
- This code is for dumb window managers.
- This will only work with default local visual colormaps.
- */
- if (icws.numWindows)
- {
- WindowPtr pWin;
- Visual *visual;
- ColormapPtr pCmap;
-
- pWin = xnestWindowPtr(icws.windows[0]);
- visual = xnestVisualFromID(pScreen, wVisual(pWin));
-
- if (visual == xnestDefaultVisual(pScreen))
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin),
- RT_COLORMAP);
- else
- pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
- RT_COLORMAP);
-
- XSetWindowColormap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- xnestColormap(pCmap));
- }
+ /*
+ This code is for dumb window managers.
+ This will only work with default local visual colormaps.
+ */
+ if (icws.numWindows)
+ {
+ WindowPtr pWin;
+ XCBVISUALTYPE *visual;
+ ColormapPtr pCmap;
+
+ pWin = xnestWindowPtr(icws.windows[0]);
+ vis.id = wVisual(pWin);
+ visual = xnestVisualFromID(pScreen, vis);
+
+ if (visual == xnestGetDefaultVisual(pScreen))
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin),
+ RT_COLORMAP);
+ else
+ pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
+ RT_COLORMAP);
+
+ params.colormap = xnestColormap(pCmap).xid;
+ XCBAuxChangeWindowAttributes(xnestConnection,
+ xnestDefaultWindows[pScreen->myNum],
+ XCBCWColormap,
+ ¶ms);
+ /* XSetWindowColormap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ xnestColormap(pCmap));*/
+ }
#endif /* DUMB_WINDOW_MANAGERS */
- }
- else
- if (icws.windows) xfree(icws.windows);
+ }
+ else
+ if (icws.windows) xfree(icws.windows);
}
-void
-xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
+void xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
{
- if (xnestOldInstalledColormapWindows)
- xfree(xnestOldInstalledColormapWindows);
-
-#ifdef _XSERVER64
- {
- Window64 window;
+ if (xnestOldInstalledColormapWindows)
+ xfree(xnestOldInstalledColormapWindows);
- 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;
-
- xnestDirectUninstallColormaps(pScreen);
-}
-
-void
-xnestDirectInstallColormaps(ScreenPtr pScreen)
-{
- int i, n;
- Colormap pCmapIDs[MAXCMAPS];
-
- if (!xnestDoDirectColormaps) return;
+/*#ifdef _XSERVER64
+ {
+ Window64 window;
- n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
+ window = xnestScreenSaverWindows[pScreen->myNum];
+ xnestSetWMColormapWindows(xnestConnection, xnestDefaultWindows[pScreen->myNum],
+ &window, 1);
+ xnestScreenSaverWindows[pScreen->myNum] = window;
+ }
+#else*/
+ xnestSetWmColormapWindows(xnestConnection, xnestDefaultWindows[pScreen->myNum],
+ &xnestScreenSaverWindows[pScreen->myNum], 1);
+//#endif /* _XSERVER64 */
- for (i = 0; i < n; i++) {
- ColormapPtr pCmap;
-
- pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
- if (pCmap)
- XInstallColormap(xnestDisplay, xnestColormap(pCmap));
- }
+ xnestOldInstalledColormapWindows = NULL;
+ xnestNumOldInstalledColormapWindows = 0;
+
+ xnestDirectUninstallColormaps(pScreen);
}
+void xnestDirectInstallColormaps(ScreenPtr pScreen)
+{
+ int i, n;
+ XCBCOLORMAP pCmapIDs[MAXCMAPS];
+
+ if (!xnestDoDirectColormaps) return;
-void
-xnestDirectUninstallColormaps(ScreenPtr pScreen)
+ n = (*pScreen->ListInstalledColormaps)(pScreen, (XID *)pCmapIDs);
+
+ for (i = 0; i < n; i++) {
+ ColormapPtr pCmap;
+
+ pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i].xid, RT_COLORMAP);
+ if (pCmap)
+ XCBInstallColormap(xnestConnection, xnestColormap(pCmap));
+ }
+}
+void xnestDirectUninstallColormaps(ScreenPtr pScreen)
{
- int i, n;
- Colormap pCmapIDs[MAXCMAPS];
+ int i, n;
+ XCBCOLORMAP pCmapIDs[MAXCMAPS];
- if (!xnestDoDirectColormaps) return;
+ if (!xnestDoDirectColormaps) return;
- n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
+ n = (*pScreen->ListInstalledColormaps)(pScreen, (XID*)pCmapIDs);
- for (i = 0; i < n; i++) {
- ColormapPtr pCmap;
-
- pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
- if (pCmap)
- XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
- }
-}
-
-void
-xnestInstallColormap(ColormapPtr pCmap)
-{
- int index;
- ColormapPtr pOldCmap;
-
- index = pCmap->pScreen->myNum;
- pOldCmap = InstalledMaps[index];
-
- if(pCmap != pOldCmap)
+ for (i = 0; i < n; i++) {
+ ColormapPtr pCmap;
+
+ pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i].xid, RT_COLORMAP);
+ if (pCmap)
+ XCBUninstallColormap(xnestConnection, xnestColormap(pCmap));
+ }
+}
+void xnestInstallColormap(ColormapPtr pCmap)
+{
+ int index;
+ ColormapPtr pOldCmap;
+
+ index = pCmap->pScreen->myNum;
+ pOldCmap = InstalledMaps[index];
+
+ if(pCmap != pOldCmap)
{
- xnestDirectUninstallColormaps(pCmap->pScreen);
+ xnestDirectUninstallColormaps(pCmap->pScreen);
+
+ /* Uninstall pInstalledMap. Notify all interested parties. */
+ if(pOldCmap != (ColormapPtr)None)
+ WalkTree(pCmap->pScreen, TellLostMap, (pointer)&pOldCmap->mid);
- /* Uninstall pInstalledMap. Notify all interested parties. */
- if(pOldCmap != (ColormapPtr)None)
- WalkTree(pCmap->pScreen, TellLostMap, (pointer)&pOldCmap->mid);
-
- InstalledMaps[index] = pCmap;
- WalkTree(pCmap->pScreen, TellGainedMap, (pointer)&pCmap->mid);
-
- xnestSetInstalledColormapWindows(pCmap->pScreen);
- xnestDirectInstallColormaps(pCmap->pScreen);
+ InstalledMaps[index] = pCmap;
+ WalkTree(pCmap->pScreen, TellGainedMap, (pointer)&pCmap->mid);
+
+ xnestSetInstalledColormapWindows(pCmap->pScreen);
+ xnestDirectInstallColormaps(pCmap->pScreen);
}
}
+void xnestUninstallColormap(ColormapPtr pCmap)
+{
+ int index;
+ ColormapPtr pCurCmap;
-void
-xnestUninstallColormap(ColormapPtr pCmap)
-{
- int index;
- ColormapPtr pCurCmap;
-
- index = pCmap->pScreen->myNum;
- pCurCmap = InstalledMaps[index];
-
- if(pCmap == pCurCmap)
+ index = pCmap->pScreen->myNum;
+ pCurCmap = InstalledMaps[index];
+
+ if(pCmap == pCurCmap)
{
- if (pCmap->mid != pCmap->pScreen->defColormap)
+ if (pCmap->mid != pCmap->pScreen->defColormap)
{
- pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap,
- RT_COLORMAP);
- (*pCmap->pScreen->InstallColormap)(pCurCmap);
+ pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap,
+ RT_COLORMAP);
+ (*pCmap->pScreen->InstallColormap)(pCurCmap);
}
}
}
static Bool xnestInstalledDefaultColormap = False;
-int
-xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs)
+int xnestListInstalledColormaps(ScreenPtr pScreen, XCBCOLORMAP *pCmapIDs)
{
- if (xnestInstalledDefaultColormap) {
- *pCmapIDs = InstalledMaps[pScreen->myNum]->mid;
- return 1;
- }
- else
- return 0;
+ if (xnestInstalledDefaultColormap) {
+ pCmapIDs->xid = InstalledMaps[pScreen->myNum]->mid;
+ return 1;
+ }
+ else
+ return 0;
}
-
-void
-xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
+void xnestStoreColors(ColormapPtr pCmap, int nColors, XCBCOLORITEM *pColors)
{
- if (pCmap->pVisual->class & DynamicClass)
-#ifdef _XSERVER64
- {
- int i;
- XColor *pColors64 = (XColor *)xalloc(nColors * sizeof(XColor) );
-
- for(i = 0; i < nColors; ++i)
+ if (pCmap->pVisual->class & DynamicClass)
+/*#ifdef _XSERVER64
{
- 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);
- xfree(pColors64);
- }
-#else
- XStoreColors(xnestDisplay, xnestColormap(pCmap),
- (XColor *)pColors, nColors);
-#endif
+ int i;
+ XColor *pColors64 = (XColor *)xalloc(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;
+ }
+ XCBStoreColors(xnestConnection, xnestColormap(pCmap), pColors64, nColors);
+ xfree(pColors64);
+ }
+#else*/
+ XCBStoreColors(xnestConnection, xnestColormap(pCmap), nColors, pColors);
+/*#endif*/
}
-void
-xnestResolveColor(unsigned short *pRed, unsigned short *pGreen,
- unsigned short *pBlue, VisualPtr pVisual)
-{
- int shift;
- unsigned int lim;
-
- shift = 16 - pVisual->bitsPerRGBValue;
- lim = (1 << pVisual->bitsPerRGBValue) - 1;
+void xnestResolveColor(unsigned short *pRed, unsigned short *pGreen, unsigned short *pBlue, VisualPtr pVisual)
+{
+ int shift;
+ unsigned int lim;
+
+ shift = 16 - pVisual->bitsPerRGBValue;
+ lim = (1 << pVisual->bitsPerRGBValue) - 1;
- if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor))
+ if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor))
{
- /* rescale to rgb bits */
- *pRed = ((*pRed >> shift) * 65535) / lim;
- *pGreen = ((*pGreen >> shift) * 65535) / lim;
- *pBlue = ((*pBlue >> shift) * 65535) / lim;
+ /* rescale to rgb bits */
+ *pRed = ((*pRed >> shift) * 65535) / lim;
+ *pGreen = ((*pGreen >> shift) * 65535) / lim;
+ *pBlue = ((*pBlue >> shift) * 65535) / lim;
}
- else if (pVisual->class == GrayScale)
+ else if (pVisual->class == GrayScale)
{
- /* rescale to gray then rgb bits */
- *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
- *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ /* rescale to gray then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
}
- else if (pVisual->class == StaticGray)
+ else if (pVisual->class == StaticGray)
{
- unsigned int limg;
-
- limg = pVisual->ColormapEntries - 1;
- /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
- *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
- *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg;
- *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ unsigned int limg;
+
+ limg = pVisual->ColormapEntries - 1;
+ /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
}
- else
+ else
{
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- /* rescale to [0..limN] then [0..65535] then rgb bits */
- *pRed = ((((((*pRed * (limr + 1)) >> 16) *
- 65535) / limr) >> shift) * 65535) / lim;
- *pGreen = ((((((*pGreen * (limg + 1)) >> 16) *
- 65535) / limg) >> shift) * 65535) / lim;
- *pBlue = ((((((*pBlue * (limb + 1)) >> 16) *
- 65535) / limb) >> shift) * 65535) / lim;
+ unsigned limr, limg, limb;
+
+ limr = pVisual->redMask >> pVisual->offsetRed;
+ limg = pVisual->greenMask >> pVisual->offsetGreen;
+ limb = pVisual->blueMask >> pVisual->offsetBlue;
+ /* rescale to [0..limN] then [0..65535] then rgb bits */
+ *pRed = ((((((*pRed * (limr + 1)) >> 16) *
+ 65535) / limr) >> shift) * 65535) / lim;
+ *pGreen = ((((((*pGreen * (limg + 1)) >> 16) *
+ 65535) / limg) >> shift) * 65535) / lim;
+ *pBlue = ((((((*pBlue * (limb + 1)) >> 16) *
+ 65535) / limb) >> shift) * 65535) / lim;
}
}
+Bool xnestCreateDefaultColormap(ScreenPtr pScreen)
+{
+ VisualPtr pVisual;
+ ColormapPtr pCmap;
+ unsigned short zero = 0, ones = 0xFFFF;
+ Pixel wp, bp;
-Bool
-xnestCreateDefaultColormap(ScreenPtr pScreen)
-{
- VisualPtr pVisual;
- ColormapPtr pCmap;
- unsigned short zero = 0, ones = 0xFFFF;
- Pixel wp, bp;
-
- for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++);
-
- if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pCmap,
- (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0)
- != Success)
- return False;
-
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
- if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) !=
- Success) ||
- (AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) !=
- Success))
- return FALSE;
- pScreen->whitePixel = wp;
- pScreen->blackPixel = bp;
- (*pScreen->InstallColormap)(pCmap);
-
- xnestInstalledDefaultColormap = True;
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++);
+
+ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pCmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0)
+ != Success)
+ return False;
+
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+ if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) !=
+ Success) ||
+ (AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) !=
+ Success))
+ return FALSE;
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+ (*pScreen->InstallColormap)(pCmap);
- return True;
+ xnestInstalledDefaultColormap = True;
+ return True;
}
diff --git a/hw/xnest/Color.h b/hw/xnest/Color.h
index 9ce72a9..2784a51 100644
--- a/hw/xnest/Color.h
+++ b/hw/xnest/Color.h
@@ -23,14 +23,14 @@ is" without express or implied warranty.
#define MINCMAPS 1
typedef struct {
- Colormap colormap;
+ XCBCOLORMAP colormap;
} xnestPrivColormap;
typedef struct {
int numCmapIDs;
- Colormap *cmapIDs;
+ XCBCOLORMAP *cmapIDs;
int numWindows;
- Window *windows;
+ XCBWINDOW *windows;
int index;
} xnestInstalledColormapWindows;
@@ -49,8 +49,8 @@ void xnestDirectInstallColormaps(ScreenP
void xnestDirectUninstallColormaps(ScreenPtr pScreen);
void xnestInstallColormap(ColormapPtr pCmap);
void xnestUninstallColormap(ColormapPtr pCmap);
-int xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs);
-void xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors);
+int xnestListInstalledColormaps(ScreenPtr pScreen, XCBCOLORMAP *pCmapIDs);
+void xnestStoreColors(ColormapPtr pCmap, int nColors, XCBCOLORITEM *pColors);
void xnestResolveColor(unsigned short *pRed, unsigned short *pGreen,
unsigned short *pBlue, VisualPtr pVisual);
Bool xnestCreateDefaultColormap(ScreenPtr pScreen);
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index f958600..00f4611 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -1,15 +1,15 @@
/* $Xorg: Cursor.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/Cursor.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */
@@ -18,8 +18,11 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/xcb_image.h>
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -37,123 +40,151 @@ is" without express or implied warranty.
#include "Keyboard.h"
#include "Args.h"
-Bool
-xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
- XImage *ximage;
- Pixmap source, mask;
- XColor fg_color, bg_color;
- unsigned long valuemask;
- XGCValues values;
-
- valuemask = GCFunction |
- GCPlaneMask |
- GCForeground |
- GCBackground |
- GCClipMask;
-
- values.function = GXcopy;
- values.plane_mask = AllPlanes;
- values.foreground = 1L;
- values.background = 0L;
- values.clip_mask = None;
-
- XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values);
-
- source = XCreatePixmap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- pCursor->bits->width,
- pCursor->bits->height,
- 1);
-
- mask = XCreatePixmap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- pCursor->bits->width,
- pCursor->bits->height,
- 1);
-
- ximage = XCreateImage(xnestDisplay,
- xnestDefaultVisual(pScreen),
- 1, XYBitmap, 0,
- (char *)pCursor->bits->source,
- pCursor->bits->width,
- pCursor->bits->height,
- BitmapPad(xnestDisplay), 0);
-
- XPutImage(xnestDisplay, source, xnestBitmapGC, ximage,
- 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
- XFree(ximage);
-
- ximage = XCreateImage(xnestDisplay,
- xnestDefaultVisual(pScreen),
- 1, XYBitmap, 0,
- (char *)pCursor->bits->mask,
- pCursor->bits->width,
- pCursor->bits->height,
- BitmapPad(xnestDisplay), 0);
-
- XPutImage(xnestDisplay, mask, xnestBitmapGC, ximage,
- 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
- XFree(ximage);
-
- fg_color.red = pCursor->foreRed;
- fg_color.green = pCursor->foreGreen;
- fg_color.blue = pCursor->foreBlue;
-
- bg_color.red = pCursor->backRed;
- bg_color.green = pCursor->backGreen;
- bg_color.blue = pCursor->backBlue;
-
- pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor));
- xnestCursorPriv(pCursor, pScreen)->cursor =
- XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
- pCursor->bits->xhot, pCursor->bits->yhot);
-
- XFreePixmap(xnestDisplay, source);
- XFreePixmap(xnestDisplay, mask);
-
- return True;
+ XCBImage *ximage;
+ XCBPIXMAP source, mask;
+ int pad;
+ XCBCURSOR c;
+ unsigned long valuemask;
+ XCBParamsGC values;
+
+ valuemask = XCBGCFunction |
+ XCBGCPlaneMask |
+ XCBGCForeground |
+ XCBGCBackground |
+ XCBGCClipMask;
+
+ values.function = GXcopy;
+ values.plane_mask = AllPlanes;
+ values.foreground = 1L;
+ values.background = 0L;
+ values.mask = None;
+
+ XCBAuxChangeGC(xnestConnection, xnestBitmapGC, valuemask, &values);
+
+ source = XCBPIXMAPNew(xnestConnection);
+ mask = XCBPIXMAPNew(xnestConnection);
+
+ XCBCreatePixmap(xnestConnection,
+ 1,
+ source,
+ (XCBDRAWABLE)xnestDefaultWindows[pScreen->myNum],
+ pCursor->bits->width,
+ pCursor->bits->height);
+
+ XCBCreatePixmap(xnestConnection,
+ 1,
+ mask,
+ (XCBDRAWABLE) xnestDefaultWindows[pScreen->myNum],
+ pCursor->bits->width,
+ pCursor->bits->height);
+
+ pad = XCBGetSetup(xnestConnection)->bitmap_format_scanline_pad;
+ ximage = XCBImageCreate(xnestConnection,
+ 1,
+ XCBImageFormatXYBitmap,
+ 0,
+ (BYTE *)pCursor->bits->source,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ pad,//8,//BitmapPad(xnestConnection),
+ 0);
+ XCBImageInit(ximage);
+
+ XCBImagePut(xnestConnection,
+ (XCBDRAWABLE) source,
+ xnestBitmapGC,
+ ximage,
+ 0,
+ 0,
+ 0,
+ 0,
+ pCursor->bits->width,
+ pCursor->bits->height);
+
+ XFree(ximage);
+
+ ximage = XCBImageCreate(xnestConnection,
+ 1,
+ XCBImageFormatXYBitmap,
+ 0,
+ (BYTE *)pCursor->bits->mask,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ pad,//8,//BitmapPad(xnestConnection),
+ 0);
+ XCBImageInit(ximage);
+
+ XCBImagePut(xnestConnection,
+ (XCBDRAWABLE)mask,
+ xnestBitmapGC,
+ ximage,
+ 0, 0, 0, 0,
+ pCursor->bits->width,
+ pCursor->bits->height);
+
+ XFree(ximage);
+
+ pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor));
+ c = XCBCURSORNew(xnestConnection);
+ xnestCursorPriv(pCursor, pScreen)->cursor = c.xid;
+ XCBCreateCursor(xnestConnection,
+ c,
+ source,
+ mask,
+ pCursor->foreRed,
+ pCursor->foreGreen,
+ pCursor->foreBlue,
+ pCursor->backRed,
+ pCursor->backGreen,
+ pCursor->backBlue,
+ pCursor->bits->xhot,
+ pCursor->bits->yhot);
+
+ XCBFreePixmap(xnestConnection, source);
+ XCBFreePixmap(xnestConnection, mask);
+
+ return True;
}
-Bool
-xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
- XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
- xfree(xnestCursorPriv(pCursor, pScreen));
- return True;
+ XCBCURSOR c;
+ c.xid = xnestCursor(pCursor, pScreen);
+ XCBFreeCursor(xnestConnection, c);
+ xfree(xnestCursorPriv(pCursor, pScreen));
+ return True;
}
-void
-xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
+void xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
{
- XColor fg_color, bg_color;
-
- fg_color.red = pCursor->foreRed;
- fg_color.green = pCursor->foreGreen;
- fg_color.blue = pCursor->foreBlue;
-
- bg_color.red = pCursor->backRed;
- bg_color.green = pCursor->backGreen;
- bg_color.blue = pCursor->backBlue;
-
- XRecolorCursor(xnestDisplay,
- xnestCursor(pCursor, pScreen),
- &fg_color, &bg_color);
+ XCBCURSOR c;
+ c.xid = xnestCursor(pCursor, pScreen);
+ XCBRecolorCursor(xnestConnection,
+ c,
+ pCursor->foreRed,
+ pCursor->foreGreen,
+ pCursor->foreBlue,
+
+ pCursor->backRed,
+ pCursor->backGreen,
+ pCursor->backBlue);
}
void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
{
+ XCBParamsCW params;
if (pCursor)
{
- XDefineCursor(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- xnestCursor(pCursor, pScreen));
+ params.cursor = xnestCursor(pCursor, pScreen);
+ XCBAuxChangeWindowAttributes(xnestConnection,
+ xnestDefaultWindows[pScreen->myNum],
+ XCBCWCursor,
+ ¶ms);
}
}
-void
-xnestMoveCursor (ScreenPtr pScreen, int x, int y)
+void xnestMoveCursor (ScreenPtr pScreen, int x, int y)
{
}
diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c
index fa84576..db158f6 100644
--- a/hw/xnest/Display.c
+++ b/hw/xnest/Display.c
@@ -1,15 +1,15 @@
/* $Xorg: Display.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/Display.c,v 3.4 2001/10/28 03:34:10 tsi Exp $ */
@@ -19,8 +19,10 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
+
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -35,161 +37,235 @@ is" without express or implied warranty.
#include "icon"
#include "screensaver"
+XCBConnection *xnestConnection = NULL;
+XCBVISUALTYPE **xnestVisuals = NULL;
+int xnestNumVisuals;
+CARD8 *xnestDepthForVisual = NULL;
+int xnestDefaultVisualIndex;
+XCBCOLORMAP *xnestDefaultColormaps = NULL;
+int xnestNumDefaultColormaps;
+CARD8 *xnestDepths = NULL;
+int xnestNumDepth;
+XCBFORMAT *xnestPixmapFormats = NULL;
+int xnestNumPixmapFormats;
+CARD32 xnestBlackPixel;
+CARD32 xnestWhitePixel;
+XCBDRAWABLE xnestDefaultDrawables[MAXDEPTH + 1];
+XCBPIXMAP xnestIconBitmap;
+XCBPIXMAP xnestScreenSaverPixmap;
+XCBGCONTEXT xnestBitmapGC;
+unsigned long xnestEventMask;
+
-Display *xnestDisplay = NULL;
-XVisualInfo *xnestVisuals;
-int xnestNumVisuals;
-int xnestDefaultVisualIndex;
-Colormap *xnestDefaultColormaps;
-int xnestNumDefaultColormaps;
-int *xnestDepths;
-int xnestNumDepths;
-XPixmapFormatValues *xnestPixmapFormats;
-int xnestNumPixmapFormats;
-Pixel xnestBlackPixel;
-Pixel xnestWhitePixel;
-Drawable xnestDefaultDrawables[MAXDEPTH + 1];
-Pixmap xnestIconBitmap;
-Pixmap xnestScreenSaverPixmap;
-XlibGC xnestBitmapGC;
-unsigned long xnestEventMask;
+static XCBVISUALTYPE **xnestListVisuals(XCBConnection *c, CARD8 **depths, int *numvisuals)
+{
+ XCBVISUALTYPEIter viter;
+ XCBDEPTHIter diter;
+ XCBSCREEN *screen;
+ XCBVISUALTYPE **vis = NULL;
+ /*reserve for NULL termination*/
+ int nvis = 1;
+ int i = 0;
+
+ screen = XCBSetupRootsIter(XCBGetSetup(c)).data;
+ diter = XCBSCREENAllowedDepthsIter(screen);
+ for (; diter.rem; XCBDEPTHNext(&diter)) {
+ viter = XCBDEPTHVisualsIter (diter.data);
+ nvis += viter.rem;
+ vis = xrealloc(vis, sizeof(XCBVISUALTYPE) * (nvis+1));
+ *depths = xrealloc(*depths, sizeof(CARD8) * (nvis+1));
+ vis[nvis-1] = NULL;
+ for ( ; viter.rem; XCBVISUALTYPENext(&viter)){
+ (*depths)[i] = diter.data->depth;
+ vis[i++] = viter.data;
+ }
+ }
+ *numvisuals = nvis-1;
+ return vis;
+}
+
+static CARD8 *xnestListDepths(XCBConnection *c, int *numdepths)
+{
+ XCBDEPTHIter diter;
+ CARD8 *depths = NULL;
+ XCBSCREEN *screen;
+ int ndepth = 0;
+ int i=0;
+
+ screen = XCBSetupRootsIter(XCBGetSetup(c)).data;
+ diter = XCBSCREENAllowedDepthsIter(screen);
+
+ ndepth = diter.rem;
+ depths = xalloc(sizeof(CARD8)*(ndepth+1));
+ for (; diter.rem; XCBDEPTHNext(&diter)) {
+ depths[i++]=diter.data->depth;
+ }
+ *numdepths = ndepth-1;
+ return depths;
+}
-void
-xnestOpenDisplay(int argc, char *argv[])
+void xnestOpenDisplay(int argc, char *argv[])
{
- XVisualInfo vi;
- long mask;
- int i, j;
-
- if (!xnestDoFullGeneration) return;
-
- xnestCloseDisplay();
-
- xnestDisplay = XOpenDisplay(xnestDisplayName);
- if (xnestDisplay == NULL)
- FatalError("Unable to open display \"%s\".\n",
- XDisplayName(xnestDisplayName));
-
- if (xnestSynchronize)
- XSynchronize(xnestDisplay, True);
-
- mask = VisualScreenMask;
- vi.screen = DefaultScreen(xnestDisplay);
- xnestVisuals = XGetVisualInfo(xnestDisplay, mask, &vi, &xnestNumVisuals);
- if (xnestNumVisuals == 0 || xnestVisuals == NULL)
- FatalError("Unable to find any visuals.\n");
-
- if (xnestUserDefaultClass || xnestUserDefaultDepth) {
- xnestDefaultVisualIndex = UNDEFINED;
- for (i = 0; i < xnestNumVisuals; i++)
- if ((!xnestUserDefaultClass ||
- xnestVisuals[i].class == xnestDefaultClass)
- &&
- (!xnestUserDefaultDepth ||
- xnestVisuals[i].depth == xnestDefaultDepth)) {
- xnestDefaultVisualIndex = i;
- break;
- }
- if (xnestDefaultVisualIndex == UNDEFINED)
- FatalError("Unable to find desired default visual.\n");
- }
- else {
- vi.visualid = XVisualIDFromVisual(DefaultVisual(xnestDisplay,
- DefaultScreen(xnestDisplay)));
- xnestDefaultVisualIndex = 0;
- for (i = 0; i < xnestNumVisuals; i++)
- if (vi.visualid == xnestVisuals[i].visualid)
- xnestDefaultVisualIndex = i;
- }
-
- xnestNumDefaultColormaps = xnestNumVisuals;
- xnestDefaultColormaps = (Colormap *)xalloc(xnestNumDefaultColormaps *
- sizeof(Colormap));
- for (i = 0; i < xnestNumDefaultColormaps; i++)
- xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- xnestVisuals[i].visual,
- AllocNone);
-
- xnestDepths = XListDepths(xnestDisplay, DefaultScreen(xnestDisplay),
- &xnestNumDepths);
-
- xnestPixmapFormats = XListPixmapFormats(xnestDisplay,
- &xnestNumPixmapFormats);
-
- xnestBlackPixel = BlackPixel(xnestDisplay, DefaultScreen(xnestDisplay));
- xnestWhitePixel = WhitePixel(xnestDisplay, DefaultScreen(xnestDisplay));
-
- if (xnestParentWindow != (Window) 0)
- xnestEventMask = StructureNotifyMask;
- else
- xnestEventMask = 0L;
-
- for (i = 0; i <= MAXDEPTH; i++)
- xnestDefaultDrawables[i] = None;
-
- for (i = 0; i < xnestNumPixmapFormats; i++)
- for (j = 0; j < xnestNumDepths; j++)
- if (xnestPixmapFormats[i].depth == 1 ||
- xnestPixmapFormats[i].depth == xnestDepths[j]) {
- xnestDefaultDrawables[xnestPixmapFormats[i].depth] =
- XCreatePixmap(xnestDisplay, DefaultRootWindow(xnestDisplay),
- 1, 1, xnestPixmapFormats[i].depth);
- }
-
- xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL);
-
- if (!(xnestUserGeometry & XValue))
- xnestX = 0;
-
- if (!(xnestUserGeometry & YValue))
- xnestY = 0;
-
- if (xnestParentWindow == 0) {
- if (!(xnestUserGeometry & WidthValue))
- xnestWidth = 3 * DisplayWidth(xnestDisplay,
- DefaultScreen(xnestDisplay)) / 4;
-
- if (!(xnestUserGeometry & HeightValue))
- xnestHeight = 3 * DisplayHeight(xnestDisplay,
- DefaultScreen(xnestDisplay)) / 4;
- }
-
- if (!xnestUserBorderWidth)
- xnestBorderWidth = 1;
-
- xnestIconBitmap =
- XCreateBitmapFromData(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- (char *)icon_bits,
- icon_width,
- icon_height);
-
- xnestScreenSaverPixmap =
- XCreatePixmapFromBitmapData(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- (char *)screensaver_bits,
- screensaver_width,
- screensaver_height,
- xnestWhitePixel,
- xnestBlackPixel,
- DefaultDepth(xnestDisplay,
- DefaultScreen(xnestDisplay)));
+ int screennum;
+ XCBSCREEN *screen;
+ XCBVISUALID vid = {None};
+ XCBDRAWABLE root;
+ int i, j;
+ char *display;
+
+ if (!xnestDoFullGeneration) return;
+ xnestCloseDisplay();
+
+ /* try connecting to the server. */
+ xnestConnection = XCBConnect(xnestDisplayName, &screennum);
+ if (xnestConnection == NULL) { /* failure to connect */
+ /* prettify the display name */
+ display = xnestDisplayName;
+ if (!display || !*display) {
+ display = getenv("DISPLAY");
+ if (!display)
+ display = "";
+ }
+ FatalError("Unable to open display \"%s\".\n", display);
+ }
+
+ xnestDepths = xnestListDepths(xnestConnection, &xnestNumDepth);
+ xnestVisuals = xnestListVisuals(xnestConnection, &xnestDepthForVisual, &xnestNumVisuals);
+ screen = XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data;
+ root = (XCBDRAWABLE)XCBSetupRootsIter(XCBGetSetup(xnestConnection)).data->root;
+
+ if (!xnestVisuals)
+ FatalError("Unable to find any visuals");
+ if (xnestUserDefaultClass || xnestUserDefaultDepth) {
+ for (i=0; i < xnestNumVisuals; i++) {
+ if ((!xnestUserDefaultClass || xnestVisuals[i]->_class == xnestDefaultClass) &&
+ (!xnestUserDefaultDepth || xnestDepthForVisual[i] == xnestDefaultDepth)) {
+ xnestDefaultVisualIndex = i;
+ }
+ }
+ } else {
+ screen = XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data;
+ vid = screen->root_visual;
+ for (i=0; i<xnestNumVisuals ; i++) {
+ if ( vid.id == xnestVisuals[i]->visual_id.id) {
+ xnestDefaultVisualIndex = i;
+ break;
+ }
+ }
+ }
+
+ xnestNumDefaultColormaps = xnestNumVisuals;
+ xnestDefaultColormaps = xalloc(xnestNumDefaultColormaps * sizeof(XCBCOLORMAP));
+ for (i=0; i<xnestNumDefaultColormaps; i++) {
+ xnestDefaultColormaps[i] = XCBCOLORMAPNew(xnestConnection);
+ XCBCreateColormap(xnestConnection, /*connection*/
+ AllocNone,
+ xnestDefaultColormaps[i],
+ screen->root,
+ xnestVisuals[i]->visual_id);
+ }
+
+ xnestPixmapFormats = XCBSetupPixmapFormats(XCBGetSetup(xnestConnection));
+ xnestNumPixmapFormats = XCBSetupPixmapFormatsLength(XCBGetSetup(xnestConnection));
+
+ xnestBlackPixel = screen->black_pixel;
+ xnestWhitePixel = screen->white_pixel;
+
+ if (xnestParentWindow.xid != 0)
+ xnestEventMask = XCBEventMaskStructureNotify;
+ else
+ xnestEventMask = 0L;
+
+ for (i=0; i<= MAXDEPTH; i++)
+ xnestDefaultDrawables[i].pixmap.xid = None;
+
+ for (i=0; i <= MAXDEPTH; i++)
+ xnestDefaultDrawables[i].pixmap.xid = None;
+
+ for (i=0; i < xnestNumPixmapFormats; i++) {
+ for (j=0; j < xnestNumDepth; j++) {
+ if ((xnestPixmapFormats[i].depth == xnestDepths[j])||
+ (xnestPixmapFormats[i].depth == 1 )) {
+ xnestDefaultDrawables[xnestPixmapFormats[i].depth].pixmap = XCBPIXMAPNew(xnestConnection);
+ XCBCreatePixmap(xnestConnection,
+ xnestPixmapFormats[i].depth,
+ xnestDefaultDrawables[xnestPixmapFormats[i].depth].pixmap,
+ root,
+ 1, 1);
+ }
+ }
+ }
+
+ xnestBitmapGC = XCBGCONTEXTNew(xnestConnection);
+ XCBCreateGC(xnestConnection,
+ xnestBitmapGC,
+ root,
+ 0,
+ NULL);
+
+ if (!(xnestUserGeometry & XValue))
+ xnestX = 0;
+ if (!(xnestUserGeometry & YValue))
+ xnestY = 0;
+
+ if (xnestParentWindow.xid == 0) {
+ if (!(xnestUserGeometry & WidthValue))
+ xnestWidth = 3 * screen->width_in_pixels / 4;
+
+ if (!(xnestUserGeometry & HeightValue))
+ xnestHeight = 3 * screen->height_in_pixels / 4;
+ }
+
+ if (!xnestUserBorderWidth)
+ xnestBorderWidth = 1;
+ xnestIconBitmap = XCBPIXMAPNew(xnestConnection);
+ XCBCreatePixmap(xnestConnection, /*connection*/
+ 1, /*depth*/
+ xnestIconBitmap, /*pixmap*/
+ root, /*drawable*/
+ icon_width,icon_height); /*width,height*/
+ XCBPutImage(xnestConnection, /*connection*/
+ XCBImageFormatXYBitmap, /*format*/
+ (XCBDRAWABLE)xnestIconBitmap, /*drawable*/
+ xnestBitmapGC, /*gc*/
+ icon_width,icon_height, /*width, height*/
+ 0,0, /*dst_x, dst_y*/
+ 0, /*pad*/
+ 1, /*depth*/
+ sizeof(icon_bits), /*length..correct??*/
+ icon_bits); /*bits*/
+
+ xnestScreenSaverPixmap = XCBPIXMAPNew(xnestConnection);
+ XCBCreatePixmap(xnestConnection, /*connection*/
+ 1, /*depth*/
+ xnestScreenSaverPixmap, /*pixmap*/
+ root, /*drawable*/
+ icon_width,icon_height); /*width,height*/
+ XCBPutImage(xnestConnection, /*connection*/
+ XCBImageFormatXYPixmap, /*format*/
+ (XCBDRAWABLE)xnestScreenSaverPixmap,/*drawable*/
+ xnestBitmapGC, /*gc*/
+ icon_width,icon_height, /*width, height*/
+ 0,0, /*dst_x, dst_y*/
+ 0, /*pad*/
+ 1, /*depth*/
+ sizeof(icon_bits), /*length..correct??*/
+ icon_bits); /*bits*/
+
}
-void
-xnestCloseDisplay()
+void xnestCloseDisplay()
{
- if (!xnestDoFullGeneration || !xnestDisplay) return;
+ if (!xnestDoFullGeneration || !xnestConnection) return;
- /*
- If xnestDoFullGeneration all x resources will be destroyed upon closing
- the display connection. There is no need to generate extra protocol.
- */
-
- xfree(xnestDefaultColormaps);
- XFree(xnestVisuals);
- XFree(xnestDepths);
- XFree(xnestPixmapFormats);
- XCloseDisplay(xnestDisplay);
+ /*
+ If xnestDoFullGeneration all x resources will be destroyed upon closing
+ the display connection. There is no need to generate extra protocol.
+ */
+
+ xfree(xnestDefaultColormaps);
+ XFree(xnestVisuals);
+ XFree(xnestDepths);
+ /*XFree(xnestPixmapFormats); freeing this crashes Xnest...*/
+ XCBDisconnect(xnestConnection);
}
diff --git a/hw/xnest/Display.h b/hw/xnest/Display.h
index 85aedc5..3ec03b6 100644
--- a/hw/xnest/Display.h
+++ b/hw/xnest/Display.h
@@ -22,25 +22,27 @@ is" without express or implied warranty.
#define MAXDEPTH 32
#define MAXVISUALSPERDEPTH 256
-extern Display *xnestDisplay;
-extern XVisualInfo *xnestVisuals;
-extern int xnestNumVisuals;
-extern int xnestDefaultVisualIndex;
-extern Colormap *xnestDefaultColormaps;
-extern int xnestNumDefaultClormaps;
-extern int *xnestDepths;
-extern int xnestNumDepths;
-extern XPixmapFormatValues *xnestPixmapFormats;
-extern int xnestNumPixmapFormats;
-extern Pixel xnestBlackPixel;
-extern Pixel xnestWhitePixel;
-extern Drawable xnestDefaultDrawables[MAXDEPTH + 1];
-extern Pixmap xnestIconBitmap;
-extern Pixmap xnestScreenSaverPixmap;
-extern XlibGC xnestBitmapGC;
-extern unsigned long xnestEventMask;
+extern XCBConnection *xnestConnection;
+extern XCBVISUALTYPE **xnestVisuals;
+extern CARD8 *xnestDepthForVisual;
+extern int xnestNumVisuals;
+extern int xnestDefaultVisualIndex;
+extern XCBCOLORMAP *xnestDefaultColormaps;
+extern int xnestNumDefaultColormaps;
+extern CARD8 *xnestDepths;
+extern int xnestNumDepth;
+extern XCBFORMAT *xnestPixmapFormats;
+extern int xnestNumPixmapFormats;
+extern CARD32 xnestBlackPixel;
+extern CARD32 xnestWhitePixel;
+extern XCBDRAWABLE xnestDefaultDrawables[MAXDEPTH + 1];
+extern XCBPIXMAP xnestIconBitmap;
+extern XCBPIXMAP xnestScreenSaverPixmap;
+extern XCBGCONTEXT xnestBitmapGC;
+extern unsigned long xnestEventMask;
void xnestOpenDisplay(int argc, char *argv[]);
void xnestCloseDisplay(void);
+
#endif /* XNESTCOMMON_H */
diff --git a/hw/xnest/Drawable.h b/hw/xnest/Drawable.h
index 7b96bdf..61b9ded 100644
--- a/hw/xnest/Drawable.h
+++ b/hw/xnest/Drawable.h
@@ -20,9 +20,6 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "XNPixmap.h"
-#define xnestDrawable(pDrawable) \
- ((pDrawable)->type == DRAWABLE_WINDOW ? \
- xnestWindow((WindowPtr)pDrawable) : \
- xnestPixmap((PixmapPtr)pDrawable))
+XCBDRAWABLE xnestDrawable(DrawablePtr pDrawable);
#endif /* XNESTDRAWABLE_H */
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index 3d52027..804ae47 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -1,15 +1,15 @@
/* $Xorg: Events.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/Events.c,v 1.2 2001/08/01 00:44:57 tsi Exp $ */
@@ -18,9 +18,10 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
#define NEED_EVENTS
-#include <X11/Xproto.h>
+#include <X11/XCB/xproto.h>
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -43,184 +44,186 @@ is" without express or implied warranty.
CARD32 lastEventTime = 0;
-void
-ProcessInputEvents()
+void ProcessInputEvents()
{
- mieqProcessInputEvents();
- miPointerUpdate();
+ mieqProcessInputEvents();
+ miPointerUpdate();
}
-int
-TimeSinceLastInputEvent()
+int TimeSinceLastInputEvent()
{
if (lastEventTime == 0)
lastEventTime = GetTimeInMillis();
return GetTimeInMillis() - lastEventTime;
}
-void
-SetTimeSinceLastInputEvent()
+void SetTimeSinceLastInputEvent()
{
- lastEventTime = GetTimeInMillis();
+ lastEventTime = GetTimeInMillis();
}
-static Bool
-xnestExposurePredicate(Display *display, XEvent *event, char *args)
+static Bool xnestExposurePredicate(Display *display, XEvent *event, char *args)
{
- return (event->type == Expose || event->type == ProcessedExpose);
+ return (event->type == Expose || event->type == ProcessedExpose);
}
-static Bool
-xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
+static Bool xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
{
- return !xnestExposurePredicate(display, event, args);
+ return !xnestExposurePredicate(display, event, args);
}
-void
-xnestCollectExposures()
+void xnestCollectExposures()
{
- XEvent X;
- WindowPtr pWin;
- RegionRec Rgn;
- BoxRec Box;
-
- while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
- pWin = xnestWindowPtr(X.xexpose.window);
-
- if (pWin) {
- Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
- Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
- Box.x2 = Box.x1 + X.xexpose.width;
- Box.y2 = Box.y1 + X.xexpose.height;
-
- REGION_INIT(pWin->drawable.pScreen, &Rgn, &Box, 1);
-
- miWindowExposures(pWin, &Rgn, NullRegion);
+ XCBGenericEvent *e;
+ XCBExposeEvent *evt;
+ WindowPtr pWin;
+ RegionRec Rgn;
+ BoxRec Box;
+
+ e = XCBPeekNextEvent(xnestConnection);
+ while ((e->response_type & ~0x80) == XCBExpose) {
+ evt = (XCBExposeEvent *)XCBWaitForEvent(xnestConnection);
+ pWin = xnestWindowPtr(evt->window);
+
+ if (pWin) {
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + evt->x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + evt->y;
+ Box.x2 = Box.x1 + evt->width;
+ Box.y2 = Box.y1 + evt->height;
+
+ REGION_INIT(pWin->drawable.pScreen, &Rgn, &Box, 1);
+
+ miWindowExposures(pWin, &Rgn, NullRegion);
+ }
+ e = XCBPeekNextEvent(xnestConnection);
}
- }
}
-void
-xnestQueueKeyEvent(int type, unsigned int keycode)
+void xnestQueueKeyEvent(int type, unsigned int keycode)
{
- xEvent x;
- x.u.u.type = type;
- x.u.u.detail = keycode;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
-}
-
-void
-xnestCollectEvents()
-{
- XEvent X;
- xEvent x;
- ScreenPtr pScreen;
-
- while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
- switch (X.type) {
- case KeyPress:
- xnestUpdateModifierState(X.xkey.state);
- xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
- break;
-
- case KeyRelease:
- xnestUpdateModifierState(X.xkey.state);
- xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
- break;
-
- case ButtonPress:
- xnestUpdateModifierState(X.xkey.state);
- x.u.u.type = ButtonPress;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
- break;
-
- case ButtonRelease:
- xnestUpdateModifierState(X.xkey.state);
- x.u.u.type = ButtonRelease;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
- break;
-
- case MotionNotify:
+ xEvent x;
+ x.u.u.type = type;
+ x.u.u.detail = keycode;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
+ mieqEnqueue(&x);
+}
+
+void xnestCollectEvents()
+{
+ XCBGenericEvent *e;
+ XCBMotionNotifyEvent *pev;
+ XCBEnterNotifyEvent *eev;
+ XCBLeaveNotifyEvent *lev;
+ XCBGenericEvent ev;
+ ScreenPtr pScreen;
+
+ e = XCBPeekNextEvent(xnestConnection);
+ while ((e->response_type & ~0x80) != XCBExpose) {
+ e = XCBWaitForEvent(xnestConnection);
+ switch (e->response_type) {
+ case XCBKeyPress:
+ xnestUpdateModifierState(((XCBKeyPressEvent *)e)->state);
+ xnestQueueKeyEvent(XCBKeyPress, ((XCBKeyPressEvent *)e)->detail.id);
+ break;
+
+ case XCBKeyRelease:
+ xnestUpdateModifierState(((XCBKeyReleaseEvent *)e)->state);
+ xnestQueueKeyEvent(KeyRelease, ((XCBKeyReleaseEvent *)e)->detail.id);
+ break;
+
+ case XCBButtonPress:
+ xnestUpdateModifierState(((XCBButtonPressEvent *)e)->state);
+ ((XCBButtonPressEvent *)e)->time.id = lastEventTime = GetTimeInMillis();
+ memcpy(&ev, e, sizeof(XCBGenericEvent));
+ mieqEnqueue((xEventPtr) &ev);
+ break;
+
+ case XCBButtonRelease:
+ xnestUpdateModifierState(((XCBButtonReleaseEvent *)e)->state);
+ ((XCBButtonReleaseEvent *)e)->time.id = lastEventTime = GetTimeInMillis();
+ memcpy(&ev, e, sizeof(XCBGenericEvent));
+ mieqEnqueue((xEventPtr) &ev);
+ break;
+
+ case XCBMotionNotify:
#if 0
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xmotion.x;
- x.u.keyButtonPointer.rootY = X.xmotion.y;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ x.u.u.type = MotionNotify;
+ x.u.keyButtonPointer.rootX = X.xmotion.x;
+ x.u.keyButtonPointer.rootY = X.xmotion.y;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
+ mieqEnqueue(&x);
#endif
- miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y,
- lastEventTime = GetTimeInMillis());
- break;
-
- case FocusIn:
- if (X.xfocus.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xfocus.window);
- if (pScreen)
- xnestDirectInstallColormaps(pScreen);
- }
- break;
-
- case FocusOut:
- if (X.xfocus.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xfocus.window);
- if (pScreen)
- xnestDirectUninstallColormaps(pScreen);
- }
- break;
-
- case KeymapNotify:
- break;
-
- case EnterNotify:
- if (X.xcrossing.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xcrossing.window);
- if (pScreen) {
- NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y);
+ pev = (XCBMotionNotifyEvent *)e;
+ miPointerAbsoluteCursor (pev->event_x, pev->event_y,
+ lastEventTime = GetTimeInMillis());
+ break;
+
+ case XCBFocusIn:
+ if (((XFocusInEvent *)e)->detail != XCBNotifyDetailInferior) {
+ pScreen = xnestScreen(((XCBFocusInEvent *)e)->event);
+ if (pScreen)
+ xnestDirectInstallColormaps(pScreen);
+ }
+ break;
+
+ case XCBFocusOut:
+ if (((XFocusOutEvent *)e)->detail != XCBNotifyDetailInferior) {
+ pScreen = xnestScreen(((XCBFocusOutEvent *)e)->event);
+ if (pScreen)
+ xnestDirectInstallColormaps(pScreen);
+ }
+ break;
+
+ case XCBKeymapNotify:
+ break;
+
+ case XCBEnterNotify:
+ eev = (XCBEnterNotifyEvent *)e;
+ if (eev->detail != XCBNotifyDetailInferior) {
+ pScreen = xnestScreen(eev->event);
+ if (pScreen) {
+ NewCurrentScreen(pScreen, eev->event_x, eev->event_y);
#if 0
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xcrossing.x;
- x.u.keyButtonPointer.rootY = X.xcrossing.y;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ x.u.u.type = MotionNotify;
+ x.u.keyButtonPointer.rootX = X.xcrossing.x;
+ x.u.keyButtonPointer.rootY = X.xcrossing.y;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
+ mieqEnqueue(&x);
#endif
- miPointerAbsoluteCursor (X.xcrossing.x, X.xcrossing.y,
- lastEventTime = GetTimeInMillis());
- xnestDirectInstallColormaps(pScreen);
- }
- }
- break;
-
- case LeaveNotify:
- if (X.xcrossing.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xcrossing.window);
- if (pScreen) {
- xnestDirectUninstallColormaps(pScreen);
- }
- }
- break;
-
- case DestroyNotify:
- if (xnestParentWindow != (Window) 0 &&
- X.xdestroywindow.window == xnestParentWindow)
- exit (0);
- break;
-
- case CirculateNotify:
- case ConfigureNotify:
- case GravityNotify:
- case MapNotify:
- case ReparentNotify:
- case UnmapNotify:
- break;
-
- default:
- ErrorF("xnest warning: unhandled event\n");
- break;
+ miPointerAbsoluteCursor (eev->event_x, eev->event_y,
+ lastEventTime = GetTimeInMillis());
+ xnestDirectInstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case XCBLeaveNotify:
+ lev = (XCBLeaveNotifyEvent *)e;
+ if (lev->detail != XCBNotifyDetailInferior) {
+ pScreen = xnestScreen(lev->event);
+ if (pScreen) {
+ xnestDirectUninstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case XCBDestroyNotify:
+ if (xnestParentWindow.xid != (CARD32) 0 &&
+ ((XCBDestroyNotifyEvent *)e)->event.xid == xnestParentWindow.xid)
+ exit (0);
+ break;
+
+ case XCBCirculateNotify:
+ case XCBConfigureNotify:
+ case XCBGravityNotify:
+ case XCBMapNotify:
+ case XCBReparentNotify:
+ case XCBUnmapNotify:
+ break;
+
+ default:
+ ErrorF("xnest warning: unhandled event\n");
+ break;
+ }
}
- }
}
diff --git a/hw/xnest/Font.c b/hw/xnest/Font.c
index d86816e..c247dc1 100644
--- a/hw/xnest/Font.c
+++ b/hw/xnest/Font.c
@@ -1,15 +1,15 @@
/* $Xorg: Font.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/Font.c,v 3.6 2003/07/16 01:38:51 dawes Exp $ */
@@ -18,9 +18,9 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xatom.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
#include "misc.h"
#include "regionstr.h"
#include <X11/fonts/font.h>
@@ -34,58 +34,60 @@ is" without express or implied warranty.
int xnestFontPrivateIndex;
-Bool
-xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
+Bool xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
{
- pointer priv;
- Atom name_atom, value_atom;
- int nprops;
- FontPropPtr props;
- int i;
- char *name;
-
- FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
-
- if (requestingClient && XpClientIsPrintClient(requestingClient, NULL))
- return True;
-
- name_atom = MakeAtom("FONT", 4, True);
- value_atom = 0L;
-
- nprops = pFont->info.nprops;
- props = pFont->info.props;
-
- for (i = 0; i < nprops; i++)
- if (props[i].name == name_atom) {
- value_atom = props[i].value;
- break;
- }
+ pointer priv;
+ XCBFONT font;
+ XCBATOM name_atom, value_atom;
+
+ int nprops;
+ FontPropPtr props;
+ int i;
+ char *name;
+
+ FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
+
+ if (requestingClient && XpClientIsPrintClient(requestingClient, NULL))
+ return True;
+
+ name_atom.xid = MakeAtom("FONT", 4, True);
+ value_atom.xid = 0L;
+
+ nprops = pFont->info.nprops;
+ props = pFont->info.props;
- if (!value_atom) return False;
+ for (i = 0; i < nprops; i++)
+ if (props[i].name == name_atom.xid) {
+ value_atom.xid = props[i].value;
+ break;
+ }
- name = (char *)NameForAtom(value_atom);
+ if (!value_atom.xid) return False;
- if (!name) return False;
+ name = (char *)NameForAtom(value_atom.xid);
- priv = (pointer)xalloc(sizeof(xnestPrivFont));
- FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
-
- xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
+ if (!name) return False;
- if (!xnestFontStruct(pFont)) return False;
-
- return True;
+ priv = (pointer)xalloc(sizeof(xnestPrivFont));
+ FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
+
+ xnestFontPriv(pFont)->font = XCBFONTNew(xnestConnection);
+ XCBOpenFont(xnestConnection, font, strlen(name), name);
+
+ if (!xnestFont(pFont).xid)
+ return False;
+
+ return True;
}
-Bool
-xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
+Bool xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
{
- if (xnestFontPriv(pFont)) {
- if (xnestFontStruct(pFont))
- XFreeFont(xnestDisplay, xnestFontStruct(pFont));
- xfree(xnestFontPriv(pFont));
- FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
- }
- return True;
+ if (xnestFontPriv(pFont)) {
+ if (xnestFont(pFont).xid)
+ XCBCloseFont(xnestConnection, xnestFont(pFont));
+ xfree(xnestFontPriv(pFont));
+ FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
+ }
+ return True;
}
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index e46b48f..2cc16eb 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -1,15 +1,15 @@
/* $Xorg: GC.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/GC.c,v 3.6 2001/10/28 03:34:11 tsi Exp $ */
@@ -18,8 +18,10 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/xcb_aux.h>
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
@@ -40,301 +42,320 @@ is" without express or implied warranty.
int xnestGCPrivateIndex;
static GCFuncs xnestFuncs = {
- xnestValidateGC,
- xnestChangeGC,
- xnestCopyGC,
- xnestDestroyGC,
- xnestChangeClip,
- xnestDestroyClip,
- xnestCopyClip,
+ xnestValidateGC,
+ xnestChangeGC,
+ xnestCopyGC,
+ xnestDestroyGC,
+ xnestChangeClip,
+ xnestDestroyClip,
+ xnestCopyClip,
};
static GCOps xnestOps = {
- xnestFillSpans,
- xnestSetSpans,
- xnestPutImage,
- xnestCopyArea,
- xnestCopyPlane,
- xnestPolyPoint,
- xnestPolylines,
- xnestPolySegment,
- xnestPolyRectangle,
- xnestPolyArc,
- xnestFillPolygon,
- xnestPolyFillRect,
- xnestPolyFillArc,
- xnestPolyText8,
- xnestPolyText16,
- xnestImageText8,
- xnestImageText16,
- xnestImageGlyphBlt,
- xnestPolyGlyphBlt,
- xnestPushPixels
+ xnestFillSpans,
+ xnestSetSpans,
+ xnestPutImage,
+ xnestCopyArea,
+ xnestCopyPlane,
+ xnestPolyPoint,
+ xnestPolylines,
+ xnestPolySegment,
+ xnestPolyRectangle,
+ xnestPolyArc,
+ xnestFillPolygon,
+ xnestPolyFillRect,
+ xnestPolyFillArc,
+ xnestPolyText8,
+ xnestPolyText16,
+ xnestImageText8,
+ xnestImageText16,
+ xnestImageGlyphBlt,
+ xnestPolyGlyphBlt,
+ xnestPushPixels
};
-Bool
-xnestCreateGC(GCPtr pGC)
+Bool xnestCreateGC(GCPtr pGC)
{
- pGC->clientClipType = CT_NONE;
- pGC->clientClip = NULL;
-
- pGC->funcs = &xnestFuncs;
- pGC->ops = &xnestOps;
-
- pGC->miTranslate = 1;
-
- xnestGCPriv(pGC)->gc = XCreateGC(xnestDisplay,
- xnestDefaultDrawables[pGC->depth],
- 0L, NULL);
- xnestGCPriv(pGC)->nClipRects = 0;
+ pGC->clientClipType = CT_NONE;
+ pGC->clientClip = NULL;
- return True;
+ pGC->funcs = &xnestFuncs;
+ pGC->ops = &xnestOps;
+
+ pGC->miTranslate = 1;
+
+ xnestGCPriv(pGC)->gc = XCBGCONTEXTNew(xnestConnection);
+ XCBCreateGC(xnestConnection,
+ xnestGCPriv(pGC)->gc,
+ xnestDefaultDrawables[pGC->depth],
+ 0L,
+ NULL);
+ xnestGCPriv(pGC)->nClipRects = 0;
+
+ return True;
}
-void
-xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
+ pGC->lastWinOrg.x = pDrawable->x;
+ pGC->lastWinOrg.y = pDrawable->y;
}
-void
-xnestChangeGC(GCPtr pGC, unsigned long mask)
+void xnestChangeGC(GCPtr pGC, unsigned long mask)
{
- XGCValues values;
-
- if (mask & GCFunction)
- values.function = pGC->alu;
-
- if (mask & GCPlaneMask)
- values.plane_mask = pGC->planemask;
-
- if (mask & GCForeground)
- values.foreground = xnestPixel(pGC->fgPixel);
-
- if (mask & GCBackground)
- values.background = xnestPixel(pGC->bgPixel);
-
- if (mask & GCLineWidth)
- values.line_width = pGC->lineWidth;
-
- if (mask & GCLineStyle)
- values.line_style = pGC->lineStyle;
-
- if (mask & GCCapStyle)
- values.cap_style = pGC->capStyle;
-
- if (mask & GCJoinStyle)
- values.join_style = pGC->joinStyle;
-
- if (mask & GCFillStyle)
- values.fill_style = pGC->fillStyle;
-
- if (mask & GCFillRule)
- values.fill_rule = pGC->fillRule;
-
- if (mask & GCTile) {
- if (pGC->tileIsPixel)
- mask &= ~GCTile;
- else
- values.tile = xnestPixmap(pGC->tile.pixmap);
- }
-
- if (mask & GCStipple)
- values.stipple = xnestPixmap(pGC->stipple);
-
- if (mask & GCTileStipXOrigin)
- values.ts_x_origin = pGC->patOrg.x;
-
- if (mask & GCTileStipYOrigin)
- values.ts_y_origin = pGC->patOrg.y;
-
- if (mask & GCFont)
- values.font = xnestFont(pGC->font);
-
- if (mask & GCSubwindowMode)
- values.subwindow_mode = pGC->subWindowMode;
-
- if (mask & GCGraphicsExposures)
- values.graphics_exposures = pGC->graphicsExposures;
-
- if (mask & GCClipXOrigin)
- values.clip_x_origin = pGC->clipOrg.x;
-
- if (mask & GCClipYOrigin)
- values.clip_y_origin = pGC->clipOrg.y;
-
- if (mask & GCClipMask) /* this is handled in change clip */
- mask &= ~GCClipMask;
-
- if (mask & GCDashOffset)
- values.dash_offset = pGC->dashOffset;
-
- if (mask & GCDashList) {
- mask &= ~GCDashList;
- XSetDashes(xnestDisplay, xnestGC(pGC),
- pGC->dashOffset, (char *)pGC->dash, pGC->numInDashList);
- }
+ XCBParamsGC values;
+
+ if (mask & XCBGCFunction)
+ values.function = pGC->alu;
+
+ if (mask & XCBGCPlaneMask)
+ values.plane_mask = pGC->planemask;
+
+ if (mask & XCBGCForeground)
+ values.foreground = xnestPixel(pGC->fgPixel);
+
+ if (mask & XCBGCBackground)
+ values.background = xnestPixel(pGC->bgPixel);
+
+ if (mask & XCBGCLineWidth)
+ values.line_width = pGC->lineWidth;
+
+ if (mask & XCBGCLineStyle)
+ values.line_style = pGC->lineStyle;
+
+ if (mask & XCBGCCapStyle)
+ values.cap_style = pGC->capStyle;
+
+ if (mask & XCBGCJoinStyle)
+ values.join_style = pGC->joinStyle;
+
+ if (mask & XCBGCFillStyle)
+ values.fill_style = pGC->fillStyle;
+
+ if (mask & XCBGCFillRule)
+ values.fill_rule = pGC->fillRule;
+
+ if (mask & XCBGCTile) {
+ if (pGC->tileIsPixel)
+ mask &= ~GCTile;
+ else
+ values.tile = xnestPixmap(pGC->tile.pixmap).xid;
+ }
- if (mask & GCArcMode)
- values.arc_mode = pGC->arcMode;
+ if (mask & XCBGCStipple)
+ values.stipple = xnestPixmap(pGC->stipple).xid;
- if (mask)
- XChangeGC(xnestDisplay, xnestGC(pGC), mask, &values);
+ if (mask & XCBGCTileStippleOriginX)
+ values.tile_stipple_originX = pGC->patOrg.x;
+
+ if (mask & XCBGCTileStippleOriginY)
+ values.tile_stipple_originY = pGC->patOrg.y;
+
+ if (mask & XCBGCFont)
+ values.font = xnestFont(pGC->font).xid;
+
+ if (mask & XCBGCSubwindowMode)
+ values.subwindow_mode = pGC->subWindowMode;
+
+ if (mask & XCBGCGraphicsExposures)
+ values.graphics_exposures = pGC->graphicsExposures;
+
+ if (mask & XCBGCClipOriginY)
+ values.clip_originX = pGC->clipOrg.x;
+
+ if (mask & XCBGCClipOriginX)
+ values.clip_originY = pGC->clipOrg.y;
+
+ if (mask & XCBGCClipMask) /* this is handled in change clip */
+ mask &= ~GCClipMask;
+
+ if (mask & XCBGCDashOffset)
+ values.dash_offset = pGC->dashOffset;
+
+ if (mask & XCBGCDashList) {
+ mask &= ~GCDashList;
+ XCBSetDashes(xnestConnection,
+ xnestGC(pGC),
+ pGC->dashOffset,
+ pGC->numInDashList,
+ (BYTE *)pGC->dash);
+ }
+
+ if (mask & XCBGCArcMode)
+ values.arc_mode = pGC->arcMode;
+
+ if (mask)
+ XCBAuxChangeGC(xnestConnection, xnestGC(pGC), mask, &values);
}
-void
-xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
- XCopyGC(xnestDisplay, xnestGC(pGCSrc), mask, xnestGC(pGCDst));
+ XCBCopyGC(xnestConnection, xnestGC(pGCSrc), xnestGC(pGCDst), mask);
}
-void
-xnestDestroyGC(GCPtr pGC)
+void xnestDestroyGC(GCPtr pGC)
{
- XFreeGC(xnestDisplay, xnestGC(pGC));
+ XCBFreeGC(xnestConnection, xnestGC(pGC));
}
-void
-xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
+void xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
{
- int i, size;
- BoxPtr pBox;
- XRectangle *pRects;
+ int i, size;
+ BoxPtr pBox;
+ XCBRECTANGLE *pRects;
+ XCBParamsGC param;
- xnestDestroyClipHelper(pGC);
+ xnestDestroyClipHelper(pGC);
- switch(type)
+ switch(type)
{
- case CT_NONE:
- XSetClipMask(xnestDisplay, xnestGC(pGC), None);
- break;
-
- case CT_REGION:
- nRects = REGION_NUM_RECTS((RegionPtr)pValue);
- size = nRects * sizeof(*pRects);
- pRects = (XRectangle *) xalloc(size);
- pBox = REGION_RECTS((RegionPtr)pValue);
- for (i = nRects; i-- > 0; ) {
- pRects[i].x = pBox[i].x1;
- pRects[i].y = pBox[i].y1;
- pRects[i].width = pBox[i].x2 - pBox[i].x1;
- pRects[i].height = pBox[i].y2 - pBox[i].y1;
- }
- XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
- pRects, nRects, Unsorted);
- xfree((char *) pRects);
- break;
-
- case CT_PIXMAP:
- XSetClipMask(xnestDisplay, xnestGC(pGC),
- xnestPixmap((PixmapPtr)pValue));
- /*
- * Need to change into region, so subsequent uses are with
- * current pixmap contents.
- */
- pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pValue);
- (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue);
- pValue = pGC->clientClip;
- type = CT_REGION;
- break;
-
- case CT_UNSORTED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, Unsorted);
- break;
-
- case CT_YSORTED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, YSorted);
- break;
-
- case CT_YXSORTED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, YXSorted);
- break;
-
- case CT_YXBANDED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, YXBanded);
- break;
+ case CT_NONE:
+ param.mask = None;
+ XCBAuxChangeGC(xnestConnection, xnestGC(pGC), XCBGCClipMask, ¶m);
+ break;
+
+ case CT_REGION:
+ nRects = REGION_NUM_RECTS((RegionPtr)pValue);
+ size = nRects * sizeof(*pRects);
+ pRects = xalloc(size);
+ pBox = REGION_RECTS((RegionPtr)pValue);
+ for (i = nRects; i-- > 0; ) {
+ pRects[i].x = pBox[i].x1;
+ pRects[i].y = pBox[i].y1;
+ pRects[i].width = pBox[i].x2 - pBox[i].x1;
+ pRects[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+ XCBSetClipRectangles(xnestConnection,
+ XCBClipOrderingUnsorted,
+ xnestGC(pGC),
+ 0, 0,
+ nRects,
+ pRects);
+ xfree((char *) pRects);
+ break;
+
+ case CT_PIXMAP:
+ param.mask = xnestPixmap((PixmapPtr)pValue).xid;
+ XCBAuxChangeGC(xnestConnection, xnestGC(pGC), XCBGCClipMask, ¶m);
+ /*
+ * Need to change into region, so subsequent uses are with
+ * current pixmap contents.
+ */
+ pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pValue);
+ (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue);
+ pValue = pGC->clientClip;
+ type = CT_REGION;
+ break;
+
+ case CT_UNSORTED:
+ XCBSetClipRectangles(xnestConnection,
+ XCBClipOrderingUnsorted,
+ xnestGC(pGC),
+ pGC->clipOrg.x,
+ pGC->clipOrg.y,
+ nRects,
+ (XCBRECTANGLE *)pValue);
+ break;
+ case CT_YSORTED:
+ XCBSetClipRectangles(xnestConnection,
+ XCBClipOrderingYSorted,
+ xnestGC(pGC),
+ pGC->clipOrg.x,
+ pGC->clipOrg.y,
+ nRects,
+ pValue);
+ break;
+ case CT_YXSORTED:
+ XCBSetClipRectangles(xnestConnection,
+ XCBClipOrderingYXSorted,
+ xnestGC(pGC),
+ pGC->clipOrg.x,
+ pGC->clipOrg.y,
+ nRects,
+ pValue);
+ break;
+ case CT_YXBANDED:
+ XCBSetClipRectangles(xnestConnection,
+ XCBClipOrderingYXBanded,
+ xnestGC(pGC),
+ pGC->clipOrg.x,
+ pGC->clipOrg.y,
+ nRects,
+ pValue);
+ break;
}
- switch(type)
+ switch(type)
{
- default:
- break;
+ default:
+ break;
- case CT_UNSORTED:
- case CT_YSORTED:
- case CT_YXSORTED:
- case CT_YXBANDED:
-
- /*
- * other parts of server can only deal with CT_NONE,
- * CT_PIXMAP and CT_REGION client clips.
- */
- pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nRects,
- (xRectangle *)pValue, type);
- xfree(pValue);
- pValue = pGC->clientClip;
- type = CT_REGION;
+ case CT_UNSORTED:
+ case CT_YSORTED:
+ case CT_YXSORTED:
+ case CT_YXBANDED:
+
+ /*
+ * other parts of server can only deal with CT_NONE,
+ * CT_PIXMAP and CT_REGION client clips.
+ */
+ pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nRects,
+ (xRectangle *)pValue, type);
+ xfree(pValue);
+ pValue = pGC->clientClip;
+ type = CT_REGION;
- break;
+ break;
}
- pGC->clientClipType = type;
- pGC->clientClip = pValue;
- xnestGCPriv(pGC)->nClipRects = nRects;
+ pGC->clientClipType = type;
+ pGC->clientClip = pValue;
+ xnestGCPriv(pGC)->nClipRects = nRects;
}
-void
-xnestDestroyClip(GCPtr pGC)
+void xnestDestroyClip(GCPtr pGC)
{
- xnestDestroyClipHelper(pGC);
+ XCBParamsGC param;
+ param.mask = None;
+ xnestDestroyClipHelper(pGC);
+
+ XCBAuxChangeGC(xnestConnection, xnestGC(pGC), XCBGCClipMask, ¶m);
+
- XSetClipMask(xnestDisplay, xnestGC(pGC), None);
-
- pGC->clientClipType = CT_NONE;
- pGC->clientClip = NULL;
- xnestGCPriv(pGC)->nClipRects = 0;
+ pGC->clientClipType = CT_NONE;
+ pGC->clientClip = NULL;
+ xnestGCPriv(pGC)->nClipRects = 0;
}
-void
-xnestDestroyClipHelper(GCPtr pGC)
+void xnestDestroyClipHelper(GCPtr pGC)
{
- switch (pGC->clientClipType)
+ switch (pGC->clientClipType)
{
- default:
- case CT_NONE:
- break;
-
- case CT_REGION:
- REGION_DESTROY(pGC->pScreen, pGC->clientClip);
- break;
+ default:
+ case CT_NONE:
+ break;
+
+ case CT_REGION:
+ REGION_DESTROY(pGC->pScreen, pGC->clientClip);
+ break;
}
}
-void
-xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
+void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
{
- RegionPtr pRgn;
+ RegionPtr pRgn;
- switch (pGCSrc->clientClipType)
+ switch (pGCSrc->clientClipType)
{
- default:
- case CT_NONE:
- xnestDestroyClip(pGCDst);
- break;
-
- case CT_REGION:
- pRgn = REGION_CREATE(pGCDst->pScreen, NULL, 1);
- REGION_COPY(pGCDst->pScreen, pRgn, pGCSrc->clientClip);
- xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
- break;
+ default:
+ case CT_NONE:
+ xnestDestroyClip(pGCDst);
+ break;
+
+ case CT_REGION:
+ pRgn = REGION_CREATE(pGCDst->pScreen, NULL, 1);
+ REGION_COPY(pGCDst->pScreen, pRgn, pGCSrc->clientClip);
+ xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
+ break;
}
}
diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index 2334248..a49e1da 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -1,15 +1,15 @@
/* $Xorg: GCOps.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/GCOps.c,v 3.5 2003/07/16 01:38:51 dawes Exp $ */
@@ -17,9 +17,11 @@ is" without express or implied warranty.
#ifdef HAVE_XNEST_CONFIG_H
#include <xnest-config.h>
#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/xcb_image.h>
#include "regionstr.h"
#include <X11/fonts/fontstruct.h>
#include "gcstruct.h"
@@ -39,291 +41,373 @@ is" without express or implied warranty.
#include "Drawable.h"
#include "Visual.h"
-void
-xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints,
- int *pWidths, int fSorted)
+void xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints,
+ int *pWidths, int fSorted)
{
- ErrorF("xnest warning: function xnestFillSpans not implemented\n");
+ ErrorF("xnest warning: function xnestFillSpans not implemented\n");
}
-void
-xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
- xPoint *pPoints, int *pWidths, int nSpans, int fSorted)
+void xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
+ xPoint *pPoints, int *pWidths, int nSpans, int fSorted)
{
- ErrorF("xnest warning: function xnestSetSpans not implemented\n");
+ ErrorF("xnest warning: function xnestSetSpans not implemented\n");
}
-void
-xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
- int *pWidths, int nSpans, char *pBuffer)
+void xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
+ int *pWidths, int nSpans, char *pBuffer)
{
- ErrorF("xnest warning: function xnestGetSpans not implemented\n");
+ ErrorF("xnest warning: function xnestGetSpans not implemented\n");
}
-void
-xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight,
- ScreenPtr pScreen)
+void xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight,
+ ScreenPtr pScreen)
{
- unsigned int width, height;
+ XCBQueryBestSizeCookie c;
+ XCBQueryBestSizeRep *r;
- width = *pWidth;
- height = *pHeight;
- XQueryBestSize(xnestDisplay, class,
- xnestDefaultWindows[pScreen->myNum],
- width, height, &width, &height);
-
- *pWidth = width;
- *pHeight = height;
-}
+ c = XCBQueryBestSize(xnestConnection, class, (XCBDRAWABLE)xnestDefaultWindows[pScreen->myNum], *pWidth,*pHeight);
+ r = XCBQueryBestSizeReply(xnestConnection, c, NULL);
-void
-xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *pImage)
-{
- XImage *ximage;
-
- ximage = XCreateImage(xnestDisplay, xnestDefaultVisual(pDrawable->pScreen),
- depth, format, leftPad, (char *)pImage,
- w, h, BitmapPad(xnestDisplay),
- (format == ZPixmap) ?
- PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad));
-
- if (ximage) {
- XPutImage(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- ximage, 0, 0, x, y, w, h);
- XFree(ximage);
- }
+ *pWidth = r->width;
+ *pHeight = r->height;
}
-void
-xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *pImage)
+void xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
{
- XImage *ximage;
- int length;
-
- ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
- x, y, w, h, planeMask, format);
-
- if (ximage) {
- length = ximage->bytes_per_line * ximage->height;
-
- memmove(pImage, ximage->data, length);
-
- XDestroyImage(ximage);
- }
+ XCBImage *img;
+ img = XCBImageCreate(xnestConnection,
+ depth,
+ format,
+ 0, /*offset*/
+ (BYTE *)pImage,
+ w, h,
+ leftPad,
+ 0 /*bytes_per_line, initialized in XCBImageInit*/);
+ if (img) {
+ XCBImageInit(img);
+ XCBImagePut(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ img,
+ 0, 0, /*offsets*/
+ x, y,
+ w, h);
+ XCBImageDestroy(img);
+ }
}
-static Bool
-xnestBitBlitPredicate(Display *display, XEvent *event, char *args)
+void xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *pImage)
{
- return (event->type == GraphicsExpose || event->type == NoExpose);
-}
+ XCBImage *img;
+ int length;
-static RegionPtr
-xnestBitBlitHelper(GCPtr pGC)
-{
- if (!pGC->graphicsExposures)
- return NullRegion;
- else {
- XEvent event;
- RegionPtr pReg, pTmpReg;
- BoxRec Box;
- Bool pending, overlap;
+ img = XCBImageGet(xnestConnection,
+ xnestDrawable(pDrawable),
+ x, y,
+ w, h,
+ planeMask,
+ format);
- pReg = REGION_CREATE(pGC->pScreen, NULL, 1);
- pTmpReg = REGION_CREATE(pGC->pScreen, NULL, 1);
- if(!pReg || !pTmpReg) return NullRegion;
-
- pending = True;
- while (pending) {
- XIfEvent(xnestDisplay, &event, xnestBitBlitPredicate, NULL);
-
- switch (event.type) {
- case NoExpose:
- pending = False;
- break;
-
- case GraphicsExpose:
- Box.x1 = event.xgraphicsexpose.x;
- Box.y1 = event.xgraphicsexpose.y;
- Box.x2 = event.xgraphicsexpose.x + event.xgraphicsexpose.width;
- Box.y2 = event.xgraphicsexpose.y + event.xgraphicsexpose.height;
- REGION_RESET(pGC->pScreen, pTmpReg, &Box);
- REGION_APPEND(pGC->pScreen, pReg, pTmpReg);
- pending = event.xgraphicsexpose.count;
- break;
- }
+ if (img) {
+ length = img->bytes_per_line * img->height;
+ memmove(pImage, img->data, length);
+ XCBImageDestroy(img);
}
-
- REGION_DESTROY(pGC->pScreen, pTmpReg);
- REGION_VALIDATE(pGC->pScreen, pReg, &overlap);
- return(pReg);
- }
}
-RegionPtr
-xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty)
+static Bool xnestBitBlitPredicate(XCBGenericEvent *event)
{
- XCopyArea(xnestDisplay,
- xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
- xnestGC(pGC), srcx, srcy, width, height, dstx, dsty);
-
- return xnestBitBlitHelper(pGC);
+ return (event->response_type == XCBGraphicsExposure || event->response_type == XCBNoExposure);
}
-RegionPtr
-xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long plane)
+static RegionPtr xnestBitBlitHelper(GCPtr pGC)
{
- XCopyPlane(xnestDisplay,
- xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
- xnestGC(pGC), srcx, srcy, width, height, dstx, dsty, plane);
-
- return xnestBitBlitHelper(pGC);
+ if (!pGC->graphicsExposures)
+ return NullRegion;
+ else {
+ XCBGenericEvent *event;
+ XCBGraphicsExposureEvent *exp;
+ RegionPtr pReg, pTmpReg;
+ BoxRec Box;
+ Bool pending, overlap;
+
+ pReg = REGION_CREATE(pGC->pScreen, NULL, 1);
+ pTmpReg = REGION_CREATE(pGC->pScreen, NULL, 1);
+ if(!pReg || !pTmpReg)
+ return NullRegion;
+
+ pending = True;
+ while (pending) {
+ event = XCBPeekNextEvent(xnestConnection);
+ if (xnestBitBlitPredicate(event))
+ event = XCBWaitForEvent(xnestConnection);
+
+ switch (event->response_type) {
+ case XCBNoExposure:
+ pending = False;
+ break;
+
+ case XCBGraphicsExposure:
+ exp = (XCBGraphicsExposureEvent *) event;
+ Box.x1 = exp->x;
+ Box.y1 = exp->y;
+ Box.x2 = exp->x + exp->width;
+ Box.y2 = exp->y + exp->height;
+ REGION_RESET(pGC->pScreen, pTmpReg, &Box);
+ REGION_APPEND(pGC->pScreen, pReg, pTmpReg);
+ pending = exp->count;
+ break;
+ }
+ }
+
+ REGION_DESTROY(pGC->pScreen, pTmpReg);
+ REGION_VALIDATE(pGC->pScreen, pReg, &overlap);
+ return(pReg);
+ }
}
-void
-xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
- DDXPointPtr pPoints)
+RegionPtr xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty)
{
- XDrawPoints(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XPoint *)pPoints, nPoints, mode);
-}
+ XCBCopyArea(xnestConnection,
+ xnestDrawable(pSrcDrawable),
+ xnestDrawable(pDstDrawable),
+ xnestGC(pGC),
+ srcx, srcy,
+ dstx, dsty,
+ width, height);
-void
-xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
- DDXPointPtr pPoints)
-{
- XDrawLines(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XPoint *)pPoints, nPoints, mode);
+ return xnestBitBlitHelper(pGC);
}
-void
-xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
- xSegment *pSegments)
+RegionPtr xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane)
{
- XDrawSegments(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XSegment *)pSegments, nSegments);
-}
+ XCBCopyPlane(xnestConnection,
+ xnestDrawable(pSrcDrawable),
+ xnestDrawable(pDstDrawable),
+ xnestGC(pGC),
+ srcx, srcy,
+ dstx, dsty,
+ width, height,
+ plane);
-void
-xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
- xRectangle *pRectangles)
-{
- XDrawRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XRectangle *)pRectangles, nRectangles);
+ return xnestBitBlitHelper(pGC);
}
-void
-xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
+void xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
{
- XDrawArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XArc *)pArcs, nArcs);
+ XCBPolyPoint(xnestConnection,
+ mode,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ nPoints,
+ (XCBPOINT *)pPoints);
}
-void
-xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
- int nPoints, DDXPointPtr pPoints)
+void xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
{
- XFillPolygon(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XPoint *)pPoints, nPoints, shape, mode);
+ XCBPolyLine(xnestConnection,
+ mode,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ nPoints,
+ (XCBPOINT *)pPoints);
}
-void
-xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
- xRectangle *pRectangles)
+void xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
+ xSegment *pSegments)
{
- XFillRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XRectangle *)pRectangles, nRectangles);
+ XCBPolySegment(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ nSegments,
+ (XCBSEGMENT *)pSegments);
}
-void
-xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
+void xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
{
- XFillArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XArc *)pArcs, nArcs);
+ XCBPolyRectangle(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ nRectangles,
+ (XCBRECTANGLE *)pRectangles);
}
-int
-xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- char *string)
+void xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
{
- int width;
-
- XDrawString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, string, count);
-
- width = XTextWidth(xnestFontStruct(pGC->font), string, count);
-
- return width + x;
+ XCBPolyArc(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ nArcs,
+ (XCBARC *)pArcs);
}
-int
-xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- unsigned short *string)
+void xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
+ int nPoints, DDXPointPtr pPoints)
{
- int width;
-
- XDrawString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, (XChar2b *)string, count);
-
- width = XTextWidth16(xnestFontStruct(pGC->font), (XChar2b *)string, count);
-
- return width + x;
+ XCBFillPoly(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ shape,
+ mode,
+ nPoints,
+ (XCBPOINT *)pPoints);
}
-void
-xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- char *string)
+void xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
{
- XDrawImageString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, string, count);
+XCBPolyFillRectangle(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ nRectangles,
+ (XCBRECTANGLE*)pRectangles);
}
-void
-xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- unsigned short *string)
+void xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
{
- XDrawImageString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, (XChar2b *)string, count);
+ XCBPolyFillArc(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ nArcs,
+ (XCBARC *)pArcs);
}
-void
-xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- unsigned int nGlyphs, CharInfoPtr *pCharInfo,
- pointer pGlyphBase)
+int xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string)
{
- ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
-}
+ int width, i;
+ XCBCHAR2B *str;
+ XCBFONTABLE f;
+ XCBQueryTextExtentsCookie c;
+ XCBQueryTextExtentsRep *r;
+ XCBGenericError *e;
-void
-xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- unsigned int nGlyphs, CharInfoPtr *pCharInfo,
- pointer pGlyphBase)
-{
- ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
+ XCBPolyText8(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ x, y,
+ count,
+ (BYTE *)string);
+
+ f.font = xnestFont(pGC->font);
+ f.gcontext = xnestGC(pGC);
+ str = xalloc(count * sizeof(XCBCHAR2B));
+ for (i=0; i<count; i++) {
+ str[i].byte1 = string[i];
+ str[i].byte2 = '\0';
+ }
+ c = XCBQueryTextExtents(xnestConnection, f, count, str);
+ xfree(str);
+ r = XCBQueryTextExtentsReply(xnestConnection, c, NULL);
+ if (r)
+ if (!e)
+ width = r->overall_width;
+ /*handle error.. what's appropriate?*/
+ return width + x;
+}
+
+
+
+int xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string)
+{
+ int width = 0;
+ XCBFONTABLE f;
+ XCBQueryTextExtentsCookie c;
+ XCBQueryTextExtentsRep *r;
+ XCBGenericError *e;
+
+ XCBPolyText16(xnestConnection,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ x, y,
+ count*2,
+ (BYTE *)string);
+ f.font = xnestFont(pGC->font);
+ f.gcontext = xnestGC(pGC);
+ c = XCBQueryTextExtents(xnestConnection, f, count, (XCBCHAR2B*)string);
+ r = XCBQueryTextExtentsReply(xnestConnection, c, &e);
+ if (r)
+ if (!e)
+ width = r->overall_width;
+ /*handle error.. what's appropriate?*/
+ return width + x;
+}
+
+void xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string)
+{
+ XCBImageText8(xnestConnection,
+ count,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ x, y,
+ string);
+}
+
+void xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string)
+{
+ XCBImageText16(xnestConnection,
+ count,
+ xnestDrawable(pDrawable),
+ xnestGC(pGC),
+ x, y,
+ (XCBCHAR2B *)string);
+}
+
+void xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
+}
+
+void xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
+}
+
+void xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst,
+ int width, int height, int x, int y)
+{
+ XCBParamsGC param;
+ XCBRECTANGLE rect;
+ /* only works for solid bitmaps */
+ if (pGC->fillStyle == FillSolid)
+ {
+ param.stipple = xnestPixmap(pBitmap).xid;
+ param.tile_stipple_originX = x;
+ param.tile_stipple_originY = y;
+ param.fill_style = XCBFillStyleStippled;
+ XCBAuxChangeGC(xnestConnection, xnestGC(pGC),
+ XCBGCStipple | XCBGCTileStippleOriginX | XCBGCTileStippleOriginY | XCBGCFillStyle,
+ ¶m);
+ rect.x = x;
+ rect.y = y;
+ rect.width = width;
+ rect.height = height;
+ XCBPolyFillRectangle (xnestConnection,
+ xnestDrawable(pDst),
+ xnestGC(pGC),
+ 1,
+ &rect);
+ param.fill_style = XCBFillStyleSolid;
+ XCBAuxChangeGC(xnestConnection, xnestGC(pGC),
+ XCBGCFillStyle,
+ ¶m);
+ }
+ else
+ ErrorF("xnest warning: function xnestPushPixels not implemented\n");
}
-void
-xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst,
- int width, int height, int x, int y)
-{
- /* only works for solid bitmaps */
- if (pGC->fillStyle == FillSolid)
- {
- XSetStipple (xnestDisplay, xnestGC(pGC), xnestPixmap(pBitmap));
- XSetTSOrigin (xnestDisplay, xnestGC(pGC), x, y);
- XSetFillStyle (xnestDisplay, xnestGC(pGC), FillStippled);
- XFillRectangle (xnestDisplay, xnestDrawable(pDst),
- xnestGC(pGC), x, y, width, height);
- XSetFillStyle (xnestDisplay, xnestGC(pGC), FillSolid);
- }
- else
- ErrorF("xnest warning: function xnestPushPixels not implemented\n");
-}
diff --git a/hw/xnest/Handlers.c b/hw/xnest/Handlers.c
index 9915502..2cb8461 100644
--- a/hw/xnest/Handlers.c
+++ b/hw/xnest/Handlers.c
@@ -18,8 +18,9 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -37,7 +38,7 @@ void
xnestBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
{
xnestCollectExposures();
- XFlush(xnestDisplay);
+ XCBFlush(xnestConnection);
}
void
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index dcbd724..c217527 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -17,9 +17,10 @@ is" without express or implied warranty.
#ifdef HAVE_XNEST_CONFIG_H
#include <xnest-config.h>
#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
+/*so we don't cause conflits with xcb.h*/
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -51,27 +52,29 @@ void
InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
{
int i, j;
+ const XCBSetup *setup;
xnestOpenDisplay(argc, argv);
+ setup = XCBGetSetup(xnestConnection);
- screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
- screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
- screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
- screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
+ screenInfo->imageByteOrder = setup->image_byte_order;
+ screenInfo->bitmapScanlineUnit = setup->bitmap_format_scanline_unit;
+ screenInfo->bitmapScanlinePad = setup->bitmap_format_scanline_pad;
+ screenInfo->bitmapBitOrder = setup->bitmap_format_bit_order;
screenInfo->numPixmapFormats = 0;
for (i = 0; i < xnestNumPixmapFormats; i++)
- for (j = 0; j < xnestNumDepths; j++)
+ for (j = 0; j < xnestNumDepth; j++)
if ((xnestPixmapFormats[i].depth == 1) ||
(xnestPixmapFormats[i].depth == xnestDepths[j])) {
- screenInfo->formats[screenInfo->numPixmapFormats].depth =
- xnestPixmapFormats[i].depth;
- screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
- xnestPixmapFormats[i].bits_per_pixel;
- screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
- xnestPixmapFormats[i].scanline_pad;
- screenInfo->numPixmapFormats++;
- break;
+ screenInfo->formats[screenInfo->numPixmapFormats].depth =
+ xnestPixmapFormats[i].depth;
+ screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
+ xnestPixmapFormats[i].bits_per_pixel;
+ screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
+ xnestPixmapFormats[i].scanline_pad;
+ screenInfo->numPixmapFormats++;
+ break;
}
xnestWindowPrivateIndex = AllocateWindowPrivateIndex();
@@ -99,7 +102,7 @@ InitInput(int argc, char *argv[])
mieqInit((DevicePtr)xnestKeyboardDevice, (DevicePtr)xnestPointerDevice);
- AddEnabledDevice(XConnectionNumber(xnestDisplay));
+ AddEnabledDevice(XCBGetFileDescriptor(xnestConnection));
RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
}
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 9b4f1a1..8700728 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -1,16 +1,16 @@
/* $Xorg: Keyboard.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
-/* $XdotOrg: xserver/xorg/hw/xnest/Keyboard.c,v 1.9 2006/03/27 22:25:56 daniels Exp $ */
+/* $XdotOrg: xserver/xorg/hw/xnest/Keyboard.c,v 1.10 2006-05-29 11:14:03 daniels Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/Keyboard.c,v 1.9 2003/09/13 21:33:09 dawes Exp $ */
@@ -20,9 +20,10 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/xcb_keysyms.h>
#include "screenint.h"
#include "inputstr.h"
#include "misc.h"
@@ -44,25 +45,25 @@ is" without express or implied warranty.
extern Bool
XkbQueryExtension(
- Display * /* dpy */,
- int * /* opcodeReturn */,
- int * /* eventBaseReturn */,
- int * /* errorBaseReturn */,
- int * /* majorRtrn */,
- int * /* minorRtrn */
-);
+ Display * /* dpy */,
+ int * /* opcodeReturn */,
+ int * /* eventBaseReturn */,
+ int * /* errorBaseReturn */,
+ int * /* majorRtrn */,
+ int * /* minorRtrn */
+ );
extern XkbDescPtr XkbGetKeyboard(
- Display * /* dpy */,
- unsigned int /* which */,
- unsigned int /* deviceSpec */
-);
+ Display * /* dpy */,
+ unsigned int /* which */,
+ unsigned int /* deviceSpec */
+ );
extern Status XkbGetControls(
- Display * /* dpy */,
- unsigned long /* which */,
- XkbDescPtr /* desc */
-);
+ Display * /* dpy */,
+ unsigned long /* which */,
+ XkbDescPtr /* desc */
+ );
#ifndef XKB_BASE_DIRECTORY
#define XKB_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb/"
@@ -90,224 +91,242 @@ extern Status XkbGetControls(
DeviceIntPtr xnestKeyboardDevice = NULL;
-void
-xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
+void xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
{
- XBell(xnestDisplay, volume);
+ XCBBell(xnestConnection, volume);
}
-void
-xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
+void xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
{
#if 0
- unsigned long value_mask;
- XKeyboardControl values;
- int i;
-
- value_mask = KBKeyClickPercent |
- KBBellPercent |
- KBBellPitch |
- KBBellDuration |
- KBAutoRepeatMode;
-
- values.key_click_percent = ctrl->click;
- values.bell_percent = ctrl->bell;
- values.bell_pitch = ctrl->bell_pitch;
- values.bell_duration = ctrl->bell_duration;
- values.auto_repeat_mode = ctrl->autoRepeat ?
- AutoRepeatModeOn : AutoRepeatModeOff;
-
- XChangeKeyboardControl(xnestDisplay, value_mask, &values);
-
- /*
- value_mask = KBKey | KBAutoRepeatMode;
- At this point, we need to walk through the vector and compare it
- to the current server vector. If there are differences, report them.
- */
-
- value_mask = KBLed | KBLedMode;
- for (i = 1; i <= 32; i++) {
- values.led = i;
- values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff;
+ unsigned long value_mask;
+ XKeyboardControl values;
+ int i;
+
+ value_mask = KBKeyClickPercent |
+ KBBellPercent |
+ KBBellPitch |
+ KBBellDuration |
+ KBAutoRepeatMode;
+
+ values.key_click_percent = ctrl->click;
+ values.bell_percent = ctrl->bell;
+ values.bell_pitch = ctrl->bell_pitch;
+ values.bell_duration = ctrl->bell_duration;
+ values.auto_repeat_mode = ctrl->autoRepeat ?
+ AutoRepeatModeOn : AutoRepeatModeOff;
+
XChangeKeyboardControl(xnestDisplay, value_mask, &values);
- }
+
+ /*
+ value_mask = KBKey | KBAutoRepeatMode;
+ At this point, we need to walk through the vector and compare it
+ to the current server vector. If there are differences, report them.
+ */
+
+ value_mask = KBLed | KBLedMode;
+ for (i = 1; i <= 32; i++) {
+ values.led = i;
+ values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff;
+ XChangeKeyboardControl(xnestDisplay, value_mask, &values);
+ }
#endif
}
-int
-xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
+int xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
{
- XModifierKeymap *modifier_keymap;
- KeySym *keymap;
- int mapWidth;
- int min_keycode, max_keycode;
- KeySymsRec keySyms;
- CARD8 modmap[MAP_LENGTH];
- int i, j;
- XKeyboardState values;
+ const XCBSetup *setup;
+ XCBGetModifierMappingCookie modmapcook;
+ XCBGetModifierMappingRep *modmaprep;
+ XCBGetKeyboardMappingCookie keymapcook;
+ XCBGetKeyboardMappingRep *keymaprep;
+ XCBGetKeyboardControlCookie ctlcook;
+ XCBGetKeyboardControlRep *ctlvals;
+ XCBKEYCODE *modifier_keymap;
+ XCBKEYSYM *keymap;
+ int keycodes_per_mod;
+ int mapWidth;
+ XCBKEYCODE min_keycode, max_keycode;
+ KeySymsRec keySyms;
+ CARD8 modmap[MAP_LENGTH];
+ int i, j;
- switch (onoff)
+ switch (onoff)
{
- case DEVICE_INIT:
- modifier_keymap = XGetModifierMapping(xnestDisplay);
- XDisplayKeycodes(xnestDisplay, &min_keycode, &max_keycode);
-#ifdef _XSERVER64
- {
- KeySym64 *keymap64;
- int i, len;
- keymap64 = XGetKeyboardMapping(xnestDisplay,
- min_keycode,
- max_keycode - min_keycode + 1,
- &mapWidth);
- len = (max_keycode - min_keycode + 1) * mapWidth;
- keymap = (KeySym *)xalloc(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
-
- for (i = 0; i < MAP_LENGTH; i++)
- modmap[i] = 0;
- for (j = 0; j < 8; j++)
- for(i = 0; i < modifier_keymap->max_keypermod; i++) {
- CARD8 keycode;
- if ((keycode =
- modifier_keymap->
- modifiermap[j * modifier_keymap->max_keypermod + i]))
- modmap[keycode] |= 1<<j;
- }
- XFreeModifiermap(modifier_keymap);
-
- keySyms.minKeyCode = min_keycode;
- keySyms.maxKeyCode = max_keycode;
- keySyms.mapWidth = mapWidth;
- keySyms.map = keymap;
-
+ case DEVICE_INIT:
+ modmapcook = XCBGetModifierMapping(xnestConnection);
+ modmaprep = XCBGetModifierMappingReply(xnestConnection, modmapcook, NULL);
+ modifier_keymap = XCBGetModifierMappingKeycodes(modmaprep);
+ keycodes_per_mod = modmaprep->keycodes_per_modifier;
+ setup = XCBGetSetup(xnestConnection);
+ min_keycode = setup->min_keycode;
+ max_keycode = setup->max_keycode;
+#if 0
+//#ifdef _XSERVER64
+ {
+ KeySym64 *keymap64;
+ int i, len;
+ keymap64 = XGetKeyboardMapping(xnestDisplay,
+ min_keycode,
+ max_keycode - min_keycode + 1,
+ &mapWidth);
+ len = (max_keycode - min_keycode + 1) * mapWidth;
+ keymap = (KeySym *)xalloc(len * sizeof(KeySym));
+ for(i = 0; i < len; ++i)
+ keymap[i] = keymap64[i];
+ XFree(keymap64);
+ }
+//#else
+#endif
+ keymapcook = XCBGetKeyboardMapping(xnestConnection,
+ min_keycode,
+ min_keycode.id-max_keycode.id+1);
+ keymaprep = XCBGetKeyboardMappingReply(xnestConnection, keymapcook, NULL);
+ keymap = XCBGetKeyboardMappingKeysyms(keymaprep);
+ mapWidth = keymaprep->length;
+ //XFree(keymap); Do we leak? X doesn't like freeing this...
+ /*#endif*/
+
+ for (i = 0; i < MAP_LENGTH; i++)
+ modmap[i] = 0;
+ for (j = 0; j < 8; j++)
+ for(i = 0; i < keycodes_per_mod; i++) {
+ CARD8 keycode;
+ if ((keycode = modifier_keymap[j * keycodes_per_mod + i].id))
+ modmap[keycode] |= 1<<j;
+ }
+ //XFree(modifier_keymap); Freeing this also doesn't want to work..
+
+ keySyms.minKeyCode = min_keycode.id;
+ keySyms.maxKeyCode = max_keycode.id;
+ keySyms.mapWidth = mapWidth;
+ keySyms.map = (KeySym *)keymap;
+/*
#ifdef XKB
- if (noXkbExtension) {
+ if (noXkbExtension) {
XkbError:
-#endif
- XGetKeyboardControl(xnestDisplay, &values);
-
- memmove((char *) defaultKeyboardControl.autoRepeats,
- (char *) values.auto_repeats, sizeof(values.auto_repeats));
-
- InitKeyboardDeviceStruct(&pDev->public, &keySyms, modmap,
- xnestBell, xnestChangeKeyboardControl);
+#endif*/
+ ctlcook = XCBGetKeyboardControl(xnestConnection);
+ ctlvals = XCBGetKeyboardControlReply(xnestConnection, ctlcook, NULL);
+ memmove(defaultKeyboardControl.autoRepeats,
+ ctlvals->auto_repeats,
+ sizeof(ctlvals->auto_repeats));
+ InitKeyboardDeviceStruct(&pDev->public,
+ &keySyms,
+ modmap,
+ xnestBell,
+ xnestChangeKeyboardControl);
+/*
#ifdef XKB
- } else {
- FILE *file;
- XkbConfigRtrnRec config;
-
- XkbComponentNamesRec names;
- char *rules, *model, *layout, *variants, *options;
-
- XkbDescPtr xkb;
- int op, event, error, major, minor;
-
- if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) {
- ErrorF("Unable to initialize XKEYBOARD extension.\n");
- goto XkbError;
- }
- xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
- if (xkb == NULL || xkb->geom == NULL) {
- ErrorF("Couldn't get keyboard.\n");
- goto XkbError;
- }
- XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
-
- memset(&names, 0, sizeof(XkbComponentNamesRec));
- rules = XKB_DFLT_RULES_FILE;
- model = XKB_DFLT_KB_MODEL;
- layout = XKB_DFLT_KB_LAYOUT;
- variants = XKB_DFLT_KB_VARIANT;
- options = XKB_DFLT_KB_OPTIONS;
-
- XkbSetRulesDflts(rules, model, layout, variants, options);
- XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modmap,
- xnestBell, xnestChangeKeyboardControl);
- XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
- XkbFreeKeyboard(xkb, 0, False);
- }
+ } else {
+ FILE *file;
+ XkbConfigRtrnRec config;
+
+ XkbComponentNamesRec names;
+ char *rules, *model, *layout, *variants, *options;
+
+ XkbDescPtr xkb;
+ int op, event, error, major, minor;
+
+ if (XkbQueryExtension(xnestConnection, &op, &event, &error, &major, &minor) == 0) {
+ ErrorF("Unable to initialize XKEYBOARD extension.\n");
+ goto XkbError;
+ }
+ xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
+ if (xkb == NULL || xkb->geom == NULL) {
+ ErrorF("Couldn't get keyboard.\n");
+ goto XkbError;
+ }
+ XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
+
+ memset(&names, 0, sizeof(XkbComponentNamesRec));
+ rules = XKB_DFLT_RULES_FILE;
+ model = XKB_DFLT_KB_MODEL;
+ layout = XKB_DFLT_KB_LAYOUT;
+ variants = XKB_DFLT_KB_VARIANT;
+ options = XKB_DFLT_KB_OPTIONS;
+
+ XkbSetRulesDflts(rules, model, layout, variants, options);
+ XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modmap,
+ xnestBell, xnestChangeKeyboardControl);
+ XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
+ XkbFreeKeyboard(xkb, 0, False);
+ }
#endif
#ifdef _XSERVER64
- xfree(keymap);
-#else
- XFree(keymap);
-#endif
- break;
- case DEVICE_ON:
- xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_OFF:
- xnestEventMask &= ~XNEST_KEYBOARD_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_CLOSE:
- break;
+ xfree(keymap);
+#else*/
+ //XFree(keymap); or this...
+/*#endif*/
+ break;
+ case DEVICE_ON:
+ xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XCBChangeWindowAttributes(xnestConnection, xnestDefaultWindows[i],
+ XCBCWEventMask, &xnestEventMask);
+ break;
+ case DEVICE_OFF:
+ xnestEventMask &= ~XNEST_KEYBOARD_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XCBChangeWindowAttributes(xnestConnection, xnestDefaultWindows[i],
+ XCBCWEventMask, &xnestEventMask);
+ break;
+ case DEVICE_CLOSE:
+ break;
}
- return Success;
+ return Success;
}
-Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+Bool LegalModifier(unsigned int key, DevicePtr pDev)
{
- return TRUE;
+ return TRUE;
}
-void
+ void
xnestUpdateModifierState(unsigned int state)
{
- DeviceIntPtr pDev = xnestKeyboardDevice;
- KeyClassPtr keyc = pDev->key;
- int i;
- CARD8 mask;
-
- state = state & 0xff;
-
- if (keyc->state == state)
- return;
-
- for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
- int key;
-
- /* Modifier is down, but shouldn't be
- */
- if ((keyc->state & mask) && !(state & mask)) {
- int count = keyc->modifierKeyCount[i];
-
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->modifierMap[key] & mask) {
- int bit;
- BYTE *kptr;
-
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
-
- if (*kptr & bit)
- xnestQueueKeyEvent(KeyRelease, key);
-
- if (--count == 0)
- break;
- }
- }
+ DeviceIntPtr pDev = xnestKeyboardDevice;
+ KeyClassPtr keyc = pDev->key;
+ int i;
+ CARD8 mask;
+
+ state = state & 0xff;
+
+ if (keyc->state == state)
+ return;
+
+ for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
+ int key;
+
+ /* Modifier is down, but shouldn't be
+ */
+ if ((keyc->state & mask) && !(state & mask)) {
+ int count = keyc->modifierKeyCount[i];
+
+ for (key = 0; key < MAP_LENGTH; key++){
+ if (keyc->modifierMap[key] & mask) {
+ int bit;
+ BYTE *kptr;
+
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+
+ if (*kptr & bit)
+ xnestQueueKeyEvent(KeyRelease, key);
+
+ if (--count == 0)
+ break;
+ }
+ }
- /* Modifier shoud be down, but isn't
- */
- if (!(keyc->state & mask) && (state & mask))
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->modifierMap[key] & mask) {
- xnestQueueKeyEvent(KeyPress, key);
- break;
- }
- }
+ /* Modifier shoud be down, but isn't
+ */
+ if (!(keyc->state & mask) && (state & mask))
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->modifierMap[key] & mask) {
+ xnestQueueKeyEvent(KeyPress, key);
+ break;
+ }
+ }
+ }
}
diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am
index 67a2e98..37a7648 100644
--- a/hw/xnest/Makefile.am
+++ b/hw/xnest/Makefile.am
@@ -7,6 +7,7 @@ SRCS = Args.c \
Cursor.c \
Display.c \
Display.h \
+ Drawable.c\
Drawable.h \
Events.c \
Events.h \
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index 046b739..19bfcf9 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -18,8 +18,10 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/xcb_image.h>
#include "regionstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
@@ -65,13 +67,15 @@ xnestCreatePixmap(ScreenPtr pScreen, int
#else
pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
#endif
- if (width && height)
- xnestPixmapPriv(pPixmap)->pixmap =
- XCreatePixmap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- width, height, depth);
- else
- xnestPixmapPriv(pPixmap)->pixmap = 0;
+ if (width && height){
+ xnestPixmapPriv(pPixmap)->pixmap = XCBPIXMAPNew(xnestConnection);
+ XCBCreatePixmap(xnestConnection,
+ depth,
+ xnestPixmapPriv(pPixmap)->pixmap,
+ (XCBDRAWABLE)xnestDefaultWindows[pScreen->myNum],
+ width, height);
+ } else
+ xnestPixmapPriv(pPixmap)->pixmap.xid = 0;
return pPixmap;
}
@@ -81,7 +85,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap)
{
if(--pPixmap->refcnt)
return TRUE;
- XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
+ XCBFreePixmap(xnestConnection, xnestPixmap(pPixmap));
xfree(pPixmap);
return TRUE;
}
@@ -89,21 +93,24 @@ xnestDestroyPixmap(PixmapPtr pPixmap)
RegionPtr
xnestPixmapToRegion(PixmapPtr pPixmap)
{
- XImage *ximage;
+ XCBImage *ximage;
register RegionPtr pReg, pTmpReg;
register int x, y;
unsigned long previousPixel, currentPixel;
BoxRec Box;
Bool overlap;
- ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0,
- pPixmap->drawable.width, pPixmap->drawable.height,
- 1, XYPixmap);
+ ximage = XCBImageGet(xnestConnection,
+ (XCBDRAWABLE)xnestPixmap(pPixmap),
+ 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height,
+ 1,
+ XYPixmap);
pReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
pTmpReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
if(!pReg || !pTmpReg) {
- XDestroyImage(ximage);
+ XCBImageDestroy(ximage);
return NullRegion;
}
@@ -112,7 +119,7 @@ xnestPixmapToRegion(PixmapPtr pPixmap)
Box.y2 = y + 1;
previousPixel = 0L;
for (x = 0; x < pPixmap->drawable.width; x++) {
- currentPixel = XGetPixel(ximage, x, y);
+ currentPixel = XCBImageGetPixel(ximage, x, y);
if (previousPixel != currentPixel) {
if (previousPixel == 0L) {
/* left edge */
@@ -136,7 +143,7 @@ xnestPixmapToRegion(PixmapPtr pPixmap)
}
REGION_DESTROY(pPixmap->drawable.pScreen, pTmpReg);
- XDestroyImage(ximage);
+ XCBImageDestroy(ximage);
REGION_VALIDATE(pPixmap->drawable.pScreen, pReg, &overlap);
diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index 1533a06..4837ce2 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -18,7 +18,8 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
#include <X11/Xproto.h>
#include "screenint.h"
#include "inputstr.h"
@@ -37,43 +38,50 @@ is" without express or implied warranty.
DeviceIntPtr xnestPointerDevice = NULL;
-void
-xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
+void xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
{
- XChangePointerControl(xnestDisplay, True, True,
- ctrl->num, ctrl->den, ctrl->threshold);
+ XCBChangePointerControl(xnestConnection,
+ ctrl->num, ctrl->den,
+ ctrl->threshold,
+ True, True);
}
-int
-xnestPointerProc(DeviceIntPtr pDev, int onoff)
+int xnestPointerProc(DeviceIntPtr pDev, int onoff)
{
- CARD8 map[MAXBUTTONS];
- int nmap;
- int i;
+ CARD8 map[MAXBUTTONS];
+ XCBGetPointerMappingCookie c;
+ XCBGetPointerMappingRep *r;
+ int nmap;
+ int i;
- switch (onoff)
+ switch (onoff)
{
- case DEVICE_INIT:
- nmap = XGetPointerMapping(xnestDisplay, map, MAXBUTTONS);
- for (i = 0; i <= nmap; i++)
- map[i] = i; /* buttons are already mapped */
- InitPointerDeviceStruct(&pDev->public, map, nmap,
- miPointerGetMotionEvents,
- xnestChangePointerControl,
- miPointerGetMotionBufferSize());
- break;
- case DEVICE_ON:
- xnestEventMask |= XNEST_POINTER_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_OFF:
- xnestEventMask &= ~XNEST_POINTER_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_CLOSE:
- break;
+ case DEVICE_INIT:
+ c = XCBGetPointerMapping(xnestConnection);
+ r = XCBGetPointerMappingReply(xnestConnection, c, NULL);
+ nmap = r->map_len;
+ XFree(r);
+ for (i = 0; i <= nmap; i++)
+ map[i] = i; /* buttons are already mapped */
+ InitPointerDeviceStruct(&pDev->public, map, nmap,
+ miPointerGetMotionEvents,
+ xnestChangePointerControl,
+ miPointerGetMotionBufferSize());
+ break;
+ case DEVICE_ON:
+ xnestEventMask |= XNEST_POINTER_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XCBChangeWindowAttributes(xnestConnection, xnestDefaultWindows[i],
+ XCBCWEventMask, &xnestEventMask);
+ break;
+ case DEVICE_OFF:
+ xnestEventMask &= ~XNEST_POINTER_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XCBChangeWindowAttributes(xnestConnection, xnestDefaultWindows[i],
+ XCBCWEventMask, &xnestEventMask);
+ break;
+ case DEVICE_CLOSE:
+ break;
}
- return Success;
+ return Success;
}
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 660e54f..671d057 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -1,15 +1,15 @@
/* $Xorg: Screen.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.12 2003/11/14 22:25:59 dawes Exp $ */
@@ -18,8 +18,11 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/xcb_icccm.h>
#include "scrnintstr.h"
#include "dix.h"
#include "mi.h"
@@ -44,8 +47,8 @@ is" without express or implied warranty.
#include "mipointer.h"
#include "Args.h"
-Window xnestDefaultWindows[MAXSCREENS];
-Window xnestScreenSaverWindows[MAXSCREENS];
+XCBWINDOW xnestDefaultWindows[MAXSCREENS];
+XCBWINDOW xnestScreenSaverWindows[MAXSCREENS];
#ifdef GLXEXT
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
@@ -55,69 +58,67 @@ extern void GlxWrapInitVisuals(miInitVis
int xnestScreenGeneration = -1;
#endif
-ScreenPtr
-xnestScreen(Window window)
+ScreenPtr xnestScreen(XCBWINDOW window)
{
- int i;
-
- for (i = 0; i < xnestNumScreens; i++)
- if (xnestDefaultWindows[i] == window)
- return screenInfo.screens[i];
+ int i;
- return NULL;
+ for (i = 0; i < xnestNumScreens; i++)
+ if (xnestDefaultWindows[i].xid == window.xid)
+ return screenInfo.screens[i];
+
+ return NULL;
}
-static int
-offset(unsigned long mask)
+static int offset(unsigned long mask)
{
- int count;
-
- for (count = 0; !(mask & 1) && count < 32; count++)
- mask >>= 1;
-
- return count;
+ int count;
+
+ for (count = 0; !(mask & 1) && count < 32; count++)
+ mask >>= 1;
+
+ return count;
}
-static Bool
-xnestSaveScreen(ScreenPtr pScreen, int what)
+static Bool xnestSaveScreen(ScreenPtr pScreen, int what)
{
- if (xnestSoftwareScreenSaver)
- return False;
- else {
- switch (what) {
- case SCREEN_SAVER_ON:
- XMapRaised(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetScreenSaverColormapWindow(pScreen);
- break;
-
- case SCREEN_SAVER_OFF:
- XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetInstalledColormapWindows(pScreen);
- break;
-
- case SCREEN_SAVER_FORCER:
- lastEventTime = GetTimeInMillis();
- XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetInstalledColormapWindows(pScreen);
- break;
-
- case SCREEN_SAVER_CYCLE:
- XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetInstalledColormapWindows(pScreen);
- break;
+ if (xnestSoftwareScreenSaver)
+ return False;
+ else {
+ switch (what) {
+ case SCREEN_SAVER_ON:
+ XCBCirculateWindow(xnestConnection,
+ XCBCirculateRaiseLowest,
+ xnestScreenSaverWindows[pScreen->myNum]);
+ XCBMapWindow(xnestConnection, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetScreenSaverColormapWindow(pScreen);
+ break;
+
+ case SCREEN_SAVER_OFF:
+ XCBUnmapWindow(xnestConnection, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+
+ case SCREEN_SAVER_FORCER:
+ lastEventTime = GetTimeInMillis();
+ XCBUnmapWindow(xnestConnection, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+
+ case SCREEN_SAVER_CYCLE:
+ XCBUnmapWindow(xnestConnection, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+ }
+ return True;
}
- return True;
- }
}
-static Bool
-xnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+static Bool xnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{
return FALSE;
}
-static void
-xnestCrossScreen(ScreenPtr pScreen, Bool entering)
+static void xnestCrossScreen(ScreenPtr pScreen, Bool entering)
{
}
@@ -136,323 +137,325 @@ static miPointerSpriteFuncRec xnestPoint
xnestMoveCursor,
};
-Bool
-xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
+Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
{
- VisualPtr visuals;
- DepthPtr depths;
- int numVisuals, numDepths;
- int i, j, depthIndex;
- unsigned long valuemask;
- XSetWindowAttributes attributes;
- XWindowAttributes gattributes;
- XSizeHints sizeHints;
- VisualID defaultVisual;
- int rootDepth;
-
- if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex,
- sizeof(xnestPrivWin)) &&
- AllocateGCPrivate(pScreen, xnestGCPrivateIndex,
- sizeof(xnestPrivGC))))
- return False;
+ VisualPtr visuals;
+ DepthPtr depths;
+ int numVisuals, numDepths;
+ int i, j, depthIndex;
+ unsigned long valuemask;
+ XCBGetGeometryRep *rattr;
+ XCBGetGeometryCookie cattr;
+ XCBParamsCW param;
+ SizeHints *sizeHints;
+ VisualID defaultVisual;
+ int rootDepth;
+ XCBSCREEN *screen;
+
+ if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex,
+ sizeof(xnestPrivWin)) &&
+ AllocateGCPrivate(pScreen, xnestGCPrivateIndex,
+ sizeof(xnestPrivGC))))
+ return False;
#ifdef PIXPRIV
- if (xnestScreenGeneration != serverGeneration) {
- if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
- return False;
- xnestScreenGeneration = serverGeneration;
- }
-
- if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
- sizeof (xnestPrivPixmap)))
- return False;
-#endif
- visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
- numVisuals = 0;
-
- depths = (DepthPtr)xalloc(MAXDEPTH * sizeof(DepthRec));
- depths[0].depth = 1;
- depths[0].numVids = 0;
- depths[0].vids = (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
- numDepths = 1;
-
- for (i = 0; i < xnestNumVisuals; i++) {
- visuals[numVisuals].class = xnestVisuals[i].class;
- visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i].bits_per_rgb;
- visuals[numVisuals].ColormapEntries = xnestVisuals[i].colormap_size;
- visuals[numVisuals].nplanes = xnestVisuals[i].depth;
- visuals[numVisuals].redMask = xnestVisuals[i].red_mask;
- visuals[numVisuals].greenMask = xnestVisuals[i].green_mask;
- visuals[numVisuals].blueMask = xnestVisuals[i].blue_mask;
- visuals[numVisuals].offsetRed = offset(xnestVisuals[i].red_mask);
- visuals[numVisuals].offsetGreen = offset(xnestVisuals[i].green_mask);
- visuals[numVisuals].offsetBlue = offset(xnestVisuals[i].blue_mask);
-
- /* Check for and remove duplicates. */
- for (j = 0; j < numVisuals; j++) {
- if (visuals[numVisuals].class == visuals[j].class &&
- visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
- visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
- visuals[numVisuals].nplanes == visuals[j].nplanes &&
- visuals[numVisuals].redMask == visuals[j].redMask &&
- visuals[numVisuals].greenMask == visuals[j].greenMask &&
- visuals[numVisuals].blueMask == visuals[j].blueMask &&
- visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
- visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
- visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
- break;
+ if (xnestScreenGeneration != serverGeneration) {
+ if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
+ return False;
+ xnestScreenGeneration = serverGeneration;
}
- if (j < numVisuals)
- break;
- visuals[numVisuals].vid = FakeClientID(0);
+ if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
+ sizeof (xnestPrivPixmap)))
+ return False;
+#endif
+ visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
+ numVisuals = 0;
- depthIndex = UNDEFINED;
- for (j = 0; j < numDepths; j++)
- if (depths[j].depth == xnestVisuals[i].depth) {
- depthIndex = j;
- break;
- }
-
- if (depthIndex == UNDEFINED) {
- depthIndex = numDepths;
- depths[depthIndex].depth = xnestVisuals[i].depth;
- depths[depthIndex].numVids = 0;
- depths[depthIndex].vids =
- (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
- numDepths++;
- }
- if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
- FatalError("Visual table overflow");
+ depths = (DepthPtr)xalloc(MAXDEPTH * sizeof(DepthRec));
+ depths[0].depth = 1;
+ depths[0].numVids = 0;
+ depths[0].vids = (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+ numDepths = 1;
+
+ for (i = 0; i < xnestNumVisuals; i++) {
+ visuals[numVisuals].class = xnestVisuals[i]->_class;
+ visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i]->bits_per_rgb_value;
+ visuals[numVisuals].ColormapEntries = xnestVisuals[i]->colormap_entries;
+ visuals[numVisuals].nplanes = xnestDepthForVisual[i];
+ visuals[numVisuals].redMask = xnestVisuals[i]->red_mask;
+ visuals[numVisuals].greenMask = xnestVisuals[i]->green_mask;
+ visuals[numVisuals].blueMask = xnestVisuals[i]->blue_mask;
+ visuals[numVisuals].offsetRed = offset(xnestVisuals[i]->red_mask);
+ visuals[numVisuals].offsetGreen = offset(xnestVisuals[i]->green_mask);
+ visuals[numVisuals].offsetBlue = offset(xnestVisuals[i]->blue_mask);
+
+ /* Check for and remove duplicates. */
+ for (j = 0; j < numVisuals; j++) {
+ if (visuals[numVisuals].class == visuals[j].class &&
+ visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
+ visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
+ visuals[numVisuals].nplanes == visuals[j].nplanes &&
+ visuals[numVisuals].redMask == visuals[j].redMask &&
+ visuals[numVisuals].greenMask == visuals[j].greenMask &&
+ visuals[numVisuals].blueMask == visuals[j].blueMask &&
+ visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
+ visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
+ visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
+ break;
+ }
+ if (j < numVisuals)
+ break;
+
+ visuals[numVisuals].vid = FakeClientID(0);
+
+ depthIndex = UNDEFINED;
+ for (j = 0; j < numDepths; j++)
+ if (depths[j].depth == xnestDepthForVisual[i]) {
+ depthIndex = j;
+ break;
+ }
+
+ if (depthIndex == UNDEFINED) {
+ depthIndex = numDepths;
+ depths[depthIndex].depth = xnestDepthForVisual[i];
+ depths[depthIndex].numVids = 0;
+ depths[depthIndex].vids =
+ (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+ numDepths++;
+ }
+ if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
+ FatalError("Visual table overflow");
+ }
+ depths[depthIndex].vids[depths[depthIndex].numVids] =
+ visuals[numVisuals].vid;
+ depths[depthIndex].numVids++;
+
+ numVisuals++;
}
- depths[depthIndex].vids[depths[depthIndex].numVids] =
- visuals[numVisuals].vid;
- depths[depthIndex].numVids++;
-
- numVisuals++;
- }
- visuals = (VisualPtr)xrealloc(visuals, numVisuals * sizeof(VisualRec));
+ visuals = (VisualPtr)xrealloc(visuals, numVisuals * sizeof(VisualRec));
- defaultVisual = visuals[xnestDefaultVisualIndex].vid;
- rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
+ defaultVisual = visuals[xnestDefaultVisualIndex].vid;
+ rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
#ifdef GLXEXT
- {
- miInitVisualsProcPtr proc = NULL;
+ {
+ miInitVisualsProcPtr proc = NULL;
- GlxWrapInitVisuals(&proc);
- /* GlxInitVisuals ignores the last three arguments. */
- proc(&visuals, &depths, &numVisuals, &numDepths,
- &rootDepth, &defaultVisual, 0, 0, 0);
- }
+ GlxWrapInitVisuals(&proc);
+ /* GlxInitVisuals ignores the last three arguments. */
+ proc(&visuals, &depths, &numVisuals, &numDepths,
+ &rootDepth, &defaultVisual, 0, 0, 0);
+ }
#endif
- if (xnestParentWindow != 0) {
- XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
- xnestWidth = gattributes.width;
- xnestHeight = gattributes.height;
- }
-
- /* myNum */
- /* id */
- miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth,
- rootDepth,
- numDepths, depths,
- defaultVisual, /* root visual */
- numVisuals, visuals);
-
-/* miInitializeBackingStore(pScreen); */
-
- pScreen->defColormap = (Colormap) FakeClientID(0);
- pScreen->minInstalledCmaps = MINCMAPS;
- pScreen->maxInstalledCmaps = MAXCMAPS;
- pScreen->backingStoreSupport = NotUseful;
- pScreen->saveUnderSupport = NotUseful;
- pScreen->whitePixel = xnestWhitePixel;
- pScreen->blackPixel = xnestBlackPixel;
- /* rgf */
- /* GCperDepth */
- /* PixmapPerDepth */
- pScreen->devPrivate = NULL;
- /* WindowPrivateLen */
- /* WindowPrivateSizes */
- /* totalWindowSize */
- /* GCPrivateLen */
- /* GCPrivateSizes */
- /* totalGCSize */
-
- /* Random screen procedures */
-
- pScreen->QueryBestSize = xnestQueryBestSize;
- pScreen->SaveScreen = xnestSaveScreen;
- pScreen->GetImage = xnestGetImage;
- pScreen->GetSpans = xnestGetSpans;
- pScreen->PointerNonInterestBox = NULL;
- pScreen->SourceValidate = NULL;
-
- /* Window Procedures */
-
- pScreen->CreateWindow = xnestCreateWindow;
- pScreen->DestroyWindow = xnestDestroyWindow;
- pScreen->PositionWindow = xnestPositionWindow;
- pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes;
- pScreen->RealizeWindow = xnestRealizeWindow;
- pScreen->UnrealizeWindow = xnestUnrealizeWindow;
- pScreen->PostValidateTree = NULL;
- pScreen->WindowExposures = xnestWindowExposures;
- pScreen->PaintWindowBackground = xnestPaintWindowBackground;
- pScreen->PaintWindowBorder = xnestPaintWindowBorder;
- pScreen->CopyWindow = xnestCopyWindow;
- pScreen->ClipNotify = xnestClipNotify;
-
- /* Pixmap procedures */
-
- pScreen->CreatePixmap = xnestCreatePixmap;
- pScreen->DestroyPixmap = xnestDestroyPixmap;
-
- /* Backing store procedures */
-
- pScreen->SaveDoomedAreas = NULL;
- pScreen->RestoreAreas = NULL;
- pScreen->ExposeCopy = NULL;
- pScreen->TranslateBackingStore = NULL;
- pScreen->ClearBackingStore = NULL;
- pScreen->DrawGuarantee = NULL;
-
- /* Font procedures */
-
- pScreen->RealizeFont = xnestRealizeFont;
- pScreen->UnrealizeFont = xnestUnrealizeFont;
-
- /* GC procedures */
-
- pScreen->CreateGC = xnestCreateGC;
-
- /* Colormap procedures */
-
- pScreen->CreateColormap = xnestCreateColormap;
- pScreen->DestroyColormap = xnestDestroyColormap;
- pScreen->InstallColormap = xnestInstallColormap;
- pScreen->UninstallColormap = xnestUninstallColormap;
- pScreen->ListInstalledColormaps = xnestListInstalledColormaps;
- pScreen->StoreColors = xnestStoreColors;
- pScreen->ResolveColor = xnestResolveColor;
-
- pScreen->BitmapToRegion = xnestPixmapToRegion;
-
- /* OS layer procedures */
-
- pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
- pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
- pScreen->blockData = NULL;
- pScreen->wakeupData = NULL;
-
- miPointerInitialize (pScreen, &xnestPointerSpriteFuncs,
- &xnestPointerCursorFuncs, True);
-
- pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay,
- DefaultScreen(xnestDisplay)) /
- DisplayWidth(xnestDisplay,
- DefaultScreen(xnestDisplay));
- pScreen->mmHeight = xnestHeight * DisplayHeightMM(xnestDisplay,
- DefaultScreen(xnestDisplay)) /
- DisplayHeight(xnestDisplay,
- DefaultScreen(xnestDisplay));
+ if (xnestParentWindow.xid != 0) {
+
+ cattr = XCBGetGeometry(xnestConnection, (XCBDRAWABLE)xnestParentWindow);
+ rattr = XCBGetGeometryReply(xnestConnection, cattr, NULL);
+ xnestWidth = rattr->width;
+ xnestHeight = rattr->height;
+ free(rattr);
+ }
+
+ /* myNum */
+ /* id */
+ miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth,
+ rootDepth,
+ numDepths, depths,
+ defaultVisual, /* root visual */
+ numVisuals, visuals);
+
+ /* miInitializeBackingStore(pScreen); */
+
+ pScreen->defColormap = (Colormap) FakeClientID(0);
+ pScreen->minInstalledCmaps = MINCMAPS;
+ pScreen->maxInstalledCmaps = MAXCMAPS;
+ pScreen->backingStoreSupport = NotUseful;
+ pScreen->saveUnderSupport = NotUseful;
+ pScreen->whitePixel = xnestWhitePixel;
+ pScreen->blackPixel = xnestBlackPixel;
+ /* rgf */
+ /* GCperDepth */
+ /* PixmapPerDepth */
+ pScreen->devPrivate = NULL;
+ /* WindowPrivateLen */
+ /* WindowPrivateSizes */
+ /* totalWindowSize */
+ /* GCPrivateLen */
+ /* GCPrivateSizes */
+ /* totalGCSize */
+
+ /* Random screen procedures */
+
+ pScreen->QueryBestSize = xnestQueryBestSize;
+ pScreen->SaveScreen = xnestSaveScreen;
+ pScreen->GetImage = xnestGetImage;
+ pScreen->GetSpans = xnestGetSpans;
+ pScreen->PointerNonInterestBox = NULL;
+ pScreen->SourceValidate = NULL;
+
+ /* Window Procedures */
+
+ pScreen->CreateWindow = xnestCreateWindow;
+ pScreen->DestroyWindow = xnestDestroyWindow;
+ pScreen->PositionWindow = xnestPositionWindow;
+ pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes;
+ pScreen->RealizeWindow = xnestRealizeWindow;
+ pScreen->UnrealizeWindow = xnestUnrealizeWindow;
+ pScreen->PostValidateTree = NULL;
+ pScreen->WindowExposures = xnestWindowExposures;
+ pScreen->PaintWindowBackground = xnestPaintWindowBackground;
+ pScreen->PaintWindowBorder = xnestPaintWindowBorder;
+ pScreen->CopyWindow = xnestCopyWindow;
+ pScreen->ClipNotify = xnestClipNotify;
+
+ /* Pixmap procedures */
+
+ pScreen->CreatePixmap = xnestCreatePixmap;
+ pScreen->DestroyPixmap = xnestDestroyPixmap;
+
+ /* Backing store procedures */
+
+ pScreen->SaveDoomedAreas = NULL;
+ pScreen->RestoreAreas = NULL;
+ pScreen->ExposeCopy = NULL;
+ pScreen->TranslateBackingStore = NULL;
+ pScreen->ClearBackingStore = NULL;
+ pScreen->DrawGuarantee = NULL;
+
+ /* Font procedures */
+
+ pScreen->RealizeFont = xnestRealizeFont;
+ pScreen->UnrealizeFont = xnestUnrealizeFont;
+
+ /* GC procedures */
+
+ pScreen->CreateGC = xnestCreateGC;
+
+ /* Colormap procedures */
+
+ pScreen->CreateColormap = xnestCreateColormap;
+ pScreen->DestroyColormap = xnestDestroyColormap;
+ pScreen->InstallColormap = xnestInstallColormap;
+ pScreen->UninstallColormap = xnestUninstallColormap;
+ pScreen->ListInstalledColormaps = xnestListInstalledColormaps;
+ pScreen->StoreColors = xnestStoreColors;
+ pScreen->ResolveColor = xnestResolveColor;
+
+ pScreen->BitmapToRegion = xnestPixmapToRegion;
+
+ /* OS layer procedures */
+
+ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
+ pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
+ pScreen->blockData = NULL;
+ pScreen->wakeupData = NULL;
+
+ miPointerInitialize (pScreen, &xnestPointerSpriteFuncs,
+ &xnestPointerCursorFuncs, True);
+
+ screen = XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data;
+ pScreen->mmWidth = xnestWidth * screen->width_in_millimeters / screen->width_in_pixels;
+ pScreen->mmHeight = xnestHeight * screen->height_in_millimeters / screen->height_in_pixels;
- /* overwrite miCloseScreen with our own */
- pScreen->CloseScreen = xnestCloseScreen;
+ /* overwrite miCloseScreen with our own */
+ pScreen->CloseScreen = xnestCloseScreen;
- if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
- return FALSE;
+ if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
+ return FALSE;
#ifdef SHAPE
- /* overwrite miSetShape with our own */
- pScreen->SetShape = xnestSetShape;
+ /* overwrite miSetShape with our own */
+ pScreen->SetShape = xnestSetShape;
#endif /* SHAPE */
- /* devPrivates */
+ /* devPrivates */
#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32)
-
- if (xnestDoFullGeneration) {
- valuemask = CWBackPixel | CWEventMask | CWColormap;
- attributes.background_pixel = xnestWhitePixel;
- attributes.event_mask = xnestEventMask;
- attributes.colormap = xnestDefaultVisualColormap(xnestDefaultVisual(pScreen));
-
- if (xnestParentWindow != 0) {
- xnestDefaultWindows[pScreen->myNum] = xnestParentWindow;
- XSelectInput (xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- xnestEventMask);
- } else
- xnestDefaultWindows[pScreen->myNum] =
- XCreateWindow(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- xnestX + POSITION_OFFSET,
- xnestY + POSITION_OFFSET,
- xnestWidth, xnestHeight,
- xnestBorderWidth,
- pScreen->rootDepth,
- InputOutput,
- xnestDefaultVisual(pScreen),
- valuemask, &attributes);
-
- if (!xnestWindowName)
- xnestWindowName = argv[0];
-
- sizeHints.flags = PPosition | PSize | PMaxSize;
- sizeHints.x = xnestX + POSITION_OFFSET;
- sizeHints.y = xnestY + POSITION_OFFSET;
- sizeHints.width = sizeHints.max_width = xnestWidth;
- sizeHints.height = sizeHints.max_height = xnestHeight;
- if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
- sizeHints.flags |= USPosition;
- if (xnestUserGeometry & WidthValue || xnestUserGeometry & HeightValue)
- sizeHints.flags |= USSize;
- XSetStandardProperties(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- xnestWindowName,
- xnestWindowName,
- xnestIconBitmap,
- argv, argc, &sizeHints);
-
- XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]);
-
- valuemask = CWBackPixmap | CWColormap;
- attributes.background_pixmap = xnestScreenSaverPixmap;
- attributes.colormap =
- DefaultColormap(xnestDisplay, DefaultScreen(xnestDisplay));
- xnestScreenSaverWindows[pScreen->myNum] =
- XCreateWindow(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- 0, 0, xnestWidth, xnestHeight, 0,
- DefaultDepth(xnestDisplay, DefaultScreen(xnestDisplay)),
- InputOutput,
- DefaultVisual(xnestDisplay, DefaultScreen(xnestDisplay)),
- valuemask, &attributes);
- }
-
- if (!xnestCreateDefaultColormap(pScreen)) return False;
-
- return True;
+ if (xnestDoFullGeneration) {
+
+ valuemask = XCBCWBackPixel | XCBCWEventMask | XCBCWColormap;
+ param.back_pixel = xnestWhitePixel;
+ param.event_mask = xnestEventMask;
+ param.colormap = xnestDefaultVisualColormap(xnestGetDefaultVisual(pScreen)).xid;
+
+ if (xnestParentWindow.xid != 0) {
+ xnestDefaultWindows[pScreen->myNum] = xnestParentWindow;
+ XCBChangeWindowAttributes(xnestConnection,
+ xnestDefaultWindows[pScreen->myNum],
+ XCBCWEventMask,
+ &xnestEventMask);
+ } else
+ xnestDefaultWindows[pScreen->myNum] = XCBWINDOWNew(xnestConnection);
+ XCBAuxCreateWindow(xnestConnection,
+ pScreen->rootDepth,
+ xnestDefaultWindows[pScreen->myNum],
+ screen->root,
+ xnestX + POSITION_OFFSET,
+ xnestY + POSITION_OFFSET,
+ xnestWidth, xnestHeight,
+ xnestBorderWidth,
+ InputOutput,
+ xnestGetDefaultVisual(pScreen)->visual_id,
+ valuemask,
+ ¶m);
+
+ if (!xnestWindowName)
+ xnestWindowName = argv[0];
+
+ sizeHints = AllocSizeHints();
+ SizeHintsSetFlagPPosition(sizeHints);
+ SizeHintsSetFlagPSize(sizeHints);
+ SizeHintsSetFlagPMaxSize(sizeHints);
+ SizeHintsSetPosition(sizeHints, False, xnestX + POSITION_OFFSET, xnestY + POSITION_OFFSET);
+ SizeHintsSetSize(sizeHints, 0, xnestWidth, xnestHeight);
+ SizeHintsSetMaxSize(sizeHints, xnestWidth, xnestHeight);
+ if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
+ SizeHintsSetFlagUSPosition(sizeHints);
+ if (xnestUserGeometry & WidthValue || xnestUserGeometry & HeightValue)
+ SizeHintsSetFlagUSSize(sizeHints);
+ /*FIXME: set name and the like properly!*/
+ SetWMNormalHints(xnestConnection, xnestDefaultWindows[pScreen->myNum], sizeHints);
+ XCBMapWindow(xnestConnection, xnestDefaultWindows[pScreen->myNum]);
+
+ valuemask = CWBackPixmap | CWColormap;
+ param.back_pixmap = xnestScreenSaverPixmap.xid;
+ param.colormap = screen->default_colormap.xid;
+ xnestScreenSaverWindows[pScreen->myNum] = XCBWINDOWNew(xnestConnection);
+ XCBAuxCreateWindow(xnestConnection,
+ screen->root_depth,
+ xnestScreenSaverWindows[pScreen->myNum],
+ xnestDefaultWindows[pScreen->myNum],
+ 0, 0, /*x, y*/
+ xnestWidth, xnestHeight,
+ 0, /*border width*/
+ InputOutput, /*class*/
+ screen->root_visual,
+ valuemask,
+ ¶m);
+ }
+
+ if (!xnestCreateDefaultColormap(pScreen)) return False;
+
+ return True;
}
-Bool
-xnestCloseScreen(int index, ScreenPtr pScreen)
+Bool xnestCloseScreen(int index, ScreenPtr pScreen)
{
- int i;
-
- for (i = 0; i < pScreen->numDepths; i++)
- xfree(pScreen->allowedDepths[i].vids);
- xfree(pScreen->allowedDepths);
- xfree(pScreen->visuals);
- xfree(pScreen->devPrivate);
-
- /*
- If xnestDoFullGeneration all x resources will be destroyed upon closing
- the display connection. There is no need to generate extra protocol.
- */
+ int i;
- return True;
+ for (i = 0; i < pScreen->numDepths; i++)
+ xfree(pScreen->allowedDepths[i].vids);
+ xfree(pScreen->allowedDepths);
+ xfree(pScreen->visuals);
+ xfree(pScreen->devPrivate);
+
+ /*
+ If xnestDoFullGeneration all x resources will be destroyed upon closing
+ the display connection. There is no need to generate extra protocol.
+ */
+
+ return True;
}
diff --git a/hw/xnest/Screen.h b/hw/xnest/Screen.h
index f35a287..e5cc21b 100644
--- a/hw/xnest/Screen.h
+++ b/hw/xnest/Screen.h
@@ -17,10 +17,10 @@ is" without express or implied warranty.
#ifndef XNESTSCREEN_H
#define XNESTSCREEN_H
-extern Window xnestDefaultWindows[MAXSCREENS];
-extern Window xnestScreenSaverWindows[MAXSCREENS];
+extern XCBWINDOW xnestDefaultWindows[MAXSCREENS];
+extern XCBWINDOW xnestScreenSaverWindows[MAXSCREENS];
-ScreenPtr xnestScreen(Window window);
+ScreenPtr xnestScreen(XCBWINDOW window);
Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]);
Bool xnestCloseScreen(int index, ScreenPtr pScreen);
diff --git a/hw/xnest/Visual.c b/hw/xnest/Visual.c
index bbdb71e..6bdd843 100644
--- a/hw/xnest/Visual.c
+++ b/hw/xnest/Visual.c
@@ -1,15 +1,15 @@
/* $Xorg: Visual.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86$ */
@@ -18,8 +18,9 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xproto.h>
#include "scrnintstr.h"
#include "dix.h"
#include "mi.h"
@@ -29,44 +30,50 @@ is" without express or implied warranty.
#include "Display.h"
#include "Visual.h"
-Visual *
-xnestVisual(VisualPtr pVisual)
+XCBVISUALTYPE *xnestVisual(VisualPtr pVisual)
{
- int i;
+ int i;
- for (i = 0; i < xnestNumVisuals; i++)
- if (pVisual->class == xnestVisuals[i].class &&
- pVisual->bitsPerRGBValue == xnestVisuals[i].bits_per_rgb &&
- pVisual->ColormapEntries == xnestVisuals[i].colormap_size &&
- pVisual->nplanes == xnestVisuals[i].depth &&
- pVisual->redMask == xnestVisuals[i].red_mask &&
- pVisual->greenMask == xnestVisuals[i].green_mask &&
- pVisual->blueMask == xnestVisuals[i].blue_mask)
- return xnestVisuals[i].visual;
+ for (i = 0; i < xnestNumVisuals; i++)
+ if (pVisual->class == xnestVisuals[i]->_class &&
+ pVisual->bitsPerRGBValue == xnestVisuals[i]->bits_per_rgb_value &&
+ pVisual->ColormapEntries == xnestVisuals[i]->colormap_entries &&
+ /*pVisual->nplanes == xnestVisuals[i]->depth && er. help*/
+ pVisual->redMask == xnestVisuals[i]->red_mask &&
+ pVisual->greenMask == xnestVisuals[i]->green_mask &&
+ pVisual->blueMask == xnestVisuals[i]->blue_mask)
+ return xnestVisuals[i];
- return NULL;
+ return NULL;
}
-Visual *
-xnestVisualFromID(ScreenPtr pScreen, VisualID visual)
+XCBVISUALTYPE *xnestVisualFromID(ScreenPtr pScreen, XCBVISUALID visual)
{
- int i;
-
- for (i = 0; i < pScreen->numVisuals; i++)
- if (pScreen->visuals[i].vid == visual)
- return xnestVisual(&pScreen->visuals[i]);
+ int i;
- return NULL;
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == visual.id)
+ return xnestVisual(&pScreen->visuals[i]);
+
+ return NULL;
}
-Colormap
-xnestDefaultVisualColormap(Visual *visual)
+XCBVISUALTYPE *xnestGetDefaultVisual(ScreenPtr pScreen)
{
- int i;
-
- for (i = 0; i < xnestNumVisuals; i++)
- if (xnestVisuals[i].visual == visual)
- return xnestDefaultColormaps[i];
-
- return None;
+ XCBVISUALID v;
+
+ v.id = pScreen->rootVisual;
+ return xnestVisualFromID(pScreen, v);
+}
+
+XCBCOLORMAP xnestDefaultVisualColormap(XCBVISUALTYPE *visual)
+{
+ int i;
+ XCBCOLORMAP noneCmap = { 0 };
+
+ for (i = 0; i < xnestNumVisuals; i++)
+ if (xnestVisuals[i] == visual)
+ return xnestDefaultColormaps[i];
+
+ return noneCmap;
}
diff --git a/hw/xnest/Visual.h b/hw/xnest/Visual.h
index dfa74db..dd1bc1d 100644
--- a/hw/xnest/Visual.h
+++ b/hw/xnest/Visual.h
@@ -17,11 +17,10 @@ is" without express or implied warranty.
#ifndef XNESTVISUAL_H
#define XNESTVISUAL_H
-Visual *xnestVisual(VisualPtr pVisual);
-Visual *xnestVisualFromID(ScreenPtr pScreen, VisualID visual);
-Colormap xnestDefaultVisualColormap(Visual *visual);
+XCBVISUALTYPE *xnestVisual(VisualPtr pVisual);
+XCBVISUALTYPE *xnestVisualFromID(ScreenPtr pScreen, XCBVISUALID visual);
+XCBCOLORMAP xnestDefaultVisualColormap(XCBVISUALTYPE *visual);
-#define xnestDefaultVisual(pScreen) \
- xnestVisualFromID((pScreen), (pScreen)->rootVisual)
+XCBVISUALTYPE* xnestGetDefaultVisual(ScreenPtr pScreen);
#endif /* XNESTVISUAL_H */
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index f652c34..ddcec9d 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -1,15 +1,15 @@
/* $Xorg: Window.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
/*
-Copyright 1993 by Davor Matic
+ Copyright 1993 by Davor Matic
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation. Davor Matic makes no representations about
+ the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
*/
/* $XFree86: xc/programs/Xserver/hw/xnest/Window.c,v 3.7 2001/10/28 03:34:11 tsi Exp $ */
@@ -18,8 +18,12 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/shape.h>
+
#include "gcstruct.h"
#include "window.h"
#include "windowstr.h"
@@ -43,516 +47,501 @@ is" without express or implied warranty.
int xnestWindowPrivateIndex;
-static int
-xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
+static int xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
+{
+ XnestWindowMatch *wm = (XnestWindowMatch *)ptr;
+ if (wm->window.xid == xnestWindow(pWin).xid) {
+ wm->pWin = pWin;
+ return WT_STOPWALKING;
+ }
+ else
+ return WT_WALKCHILDREN;
+}
+
+WindowPtr xnestWindowPtr(XCBWINDOW window)
+{
+ XnestWindowMatch wm;
+ int i;
+
+ wm.pWin = NullWindow;
+ wm.window = window;
+
+ for (i = 0; i < xnestNumScreens; i++) {
+ WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm);
+ if (wm.pWin) break;
+ }
+
+ return wm.pWin;
+}
+
+Bool xnestCreateWindow(WindowPtr pWin)
{
- xnestWindowMatch *wm = (xnestWindowMatch *)ptr;
- if (wm->window == xnestWindow(pWin)) {
- wm->pWin = pWin;
- return WT_STOPWALKING;
- }
- else
- return WT_WALKCHILDREN;
-}
-
-WindowPtr
-xnestWindowPtr(Window window)
-{
- xnestWindowMatch wm;
- int i;
-
- wm.pWin = NullWindow;
- wm.window = window;
-
- for (i = 0; i < xnestNumScreens; i++) {
- WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm);
- if (wm.pWin) break;
- }
-
- return wm.pWin;
-}
-
-Bool
-xnestCreateWindow(WindowPtr pWin)
-{
- unsigned long mask;
- XSetWindowAttributes attributes;
- Visual *visual;
- ColormapPtr pCmap;
-
- if (pWin->drawable.class == InputOnly) {
- mask = 0L;
- visual = CopyFromParent;
- }
- else {
- mask = CWEventMask | CWBackingStore;
- attributes.event_mask = ExposureMask;
- attributes.backing_store = NotUseful;
-
- if (pWin->parent) {
- if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) {
- visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
- mask |= CWColormap;
- if (pWin->optional->colormap) {
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
- attributes.colormap = xnestColormap(pCmap);
- }
- else
- attributes.colormap = xnestDefaultVisualColormap(visual);
- }
- else
- visual = CopyFromParent;
- }
- else { /* root windows have their own colormaps at creation time */
- visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
- mask |= CWColormap;
- attributes.colormap = xnestColormap(pCmap);
- }
- }
-
- xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay,
- xnestWindowParent(pWin),
- pWin->origin.x -
- wBorderWidth(pWin),
- pWin->origin.y -
- wBorderWidth(pWin),
- pWin->drawable.width,
- pWin->drawable.height,
- pWin->borderWidth,
- pWin->drawable.depth,
- pWin->drawable.class,
- visual,
- mask, &attributes);
- xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
- xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->width = pWin->drawable.width;
- xnestWindowPriv(pWin)->height = pWin->drawable.height;
- xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
- xnestWindowPriv(pWin)->sibling_above = None;
- if (pWin->nextSib)
- xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+ unsigned long mask;
+ XCBParamsCW param;
+ XCBVISUALTYPE *visual;
+ XCBVISUALID vid;
+ ColormapPtr pCmap;
+
+ if (pWin->drawable.class == XCBWindowClassInputOnly) {
+ mask = 0L;
+ visual = XCBCopyFromParent;
+ }
+ else {
+ mask = XCBCWEventMask | XCBCWBackingStore;
+ param.event_mask = XCBEventMaskExposure;
+ param.backing_store = XCBBackingStoreNotUseful;
+
+ if (pWin->parent) {
+ if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) {
+ vid.id = wVisual(pWin);
+ visual = xnestVisualFromID(pWin->drawable.pScreen, vid);
+ mask |= XCBCWColormap;
+ if (pWin->optional->colormap) {
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
+ param.colormap = xnestColormap(pCmap).xid;
+ }
+ else
+ param.colormap = xnestDefaultVisualColormap(visual).xid;
+ }
+ else
+ visual = XCBCopyFromParent;
+ }
+ else { /* root windows have their own colormaps at creation time */
+ vid.id = wVisual(pWin);
+ visual = xnestVisualFromID(pWin->drawable.pScreen, vid);
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
+ mask |= CWColormap;
+ param.colormap = xnestColormap(pCmap).xid;
+ }
+ }
+
+ xnestWindowPriv(pWin)->window = XCBWINDOWNew(xnestConnection);
+ XCBAuxCreateWindow(xnestConnection,
+ pWin->drawable.depth,
+ xnestWindowPriv(pWin)->window,
+ xnestWindowParent(pWin),
+ pWin->origin.x - wBorderWidth(pWin),
+ pWin->origin.y - wBorderWidth(pWin),
+ pWin->drawable.width,
+ pWin->drawable.height,
+ pWin->borderWidth,
+ pWin->drawable.class,
+ visual->visual_id,
+ mask,
+ ¶m);
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->width = pWin->drawable.width;
+ xnestWindowPriv(pWin)->height = pWin->drawable.height;
+ xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
+ xnestWindowPriv(pWin)->sibling_above.xid = 0;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
#ifdef SHAPE
- xnestWindowPriv(pWin)->bounding_shape =
- REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
- xnestWindowPriv(pWin)->clip_shape =
- REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+ xnestWindowPriv(pWin)->bounding_shape =
+ REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+ xnestWindowPriv(pWin)->clip_shape =
+ REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
#endif /* SHAPE */
- if (!pWin->parent) /* only the root window will have the right colormap */
- xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
-
- return True;
+ if (!pWin->parent) /* only the root window will have the right colormap */
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+
+ return True;
}
-Bool
-xnestDestroyWindow(WindowPtr pWin)
-{
- if (pWin->nextSib)
- xnestWindowPriv(pWin->nextSib)->sibling_above =
- xnestWindowPriv(pWin)->sibling_above;
+Bool xnestDestroyWindow(WindowPtr pWin)
+{
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above =
+ xnestWindowPriv(pWin)->sibling_above;
#ifdef SHAPE
- REGION_DESTROY(pWin->drawable.pScreen,
- xnestWindowPriv(pWin)->bounding_shape);
- REGION_DESTROY(pWin->drawable.pScreen,
- xnestWindowPriv(pWin)->clip_shape);
+ REGION_DESTROY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->bounding_shape);
+ REGION_DESTROY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->clip_shape);
#endif
- XDestroyWindow(xnestDisplay, xnestWindow(pWin));
- xnestWindowPriv(pWin)->window = None;
+ XCBDestroyWindow(xnestConnection, xnestWindow(pWin));
+ xnestWindowPriv(pWin)->window.xid = None;
- if (pWin->optional && pWin->optional->colormap && pWin->parent)
- xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+ if (pWin->optional && pWin->optional->colormap && pWin->parent)
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
- return True;
+ return True;
}
-Bool
-xnestPositionWindow(WindowPtr pWin, int x, int y)
+Bool xnestPositionWindow(WindowPtr pWin, int x, int y)
{
- xnestConfigureWindow(pWin,
- CWParent |
- CWX | CWY |
- CWWidth | CWHeight |
- CWBorderWidth);
-
- return True;
+ xnestConfigureWindow(pWin,
+ XCBConfigWindowSibling | XCBConfigWindowX | XCBConfigWindowY |
+ XCBConfigWindowWidth | XCBConfigWindowHeight | XCBConfigWindowBorderWidth);
+ return True;
}
-void
-xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
+void xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
{
- unsigned int valuemask;
- XWindowChanges values;
+ unsigned int valuemask;
+ XCBParamsConfigureWindow values;
- if (mask & CWParent &&
- xnestWindowPriv(pWin)->parent != xnestWindowParent(pWin)) {
- XReparentWindow(xnestDisplay, xnestWindow(pWin),
- xnestWindowParent(pWin),
- pWin->origin.x - wBorderWidth(pWin),
- pWin->origin.y - wBorderWidth(pWin));
- xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
- xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->sibling_above = None;
- if (pWin->nextSib)
- xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
- }
-
- valuemask = 0;
-
- if (mask & CWX &&
- xnestWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) {
- valuemask |= CWX;
- values.x =
- xnestWindowPriv(pWin)->x =
- pWin->origin.x - wBorderWidth(pWin);
- }
-
- if (mask & CWY &&
- xnestWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) {
- valuemask |= CWY;
- values.y =
- xnestWindowPriv(pWin)->y =
- pWin->origin.y - wBorderWidth(pWin);
- }
-
- if (mask & CWWidth &&
- xnestWindowPriv(pWin)->width != pWin->drawable.width) {
- valuemask |= CWWidth;
- values.width =
- xnestWindowPriv(pWin)->width =
- pWin->drawable.width;
- }
-
- if (mask & CWHeight &&
- xnestWindowPriv(pWin)->height != pWin->drawable.height) {
- valuemask |= CWHeight;
- values.height =
- xnestWindowPriv(pWin)->height =
- pWin->drawable.height;
- }
-
- if (mask & CWBorderWidth &&
- xnestWindowPriv(pWin)->border_width != pWin->borderWidth) {
- valuemask |= CWBorderWidth;
- values.border_width =
- xnestWindowPriv(pWin)->border_width =
- pWin->borderWidth;
- }
-
- if (valuemask)
- XConfigureWindow(xnestDisplay, xnestWindow(pWin), valuemask, &values);
-
- if (mask & CWStackingOrder &&
- xnestWindowPriv(pWin)->sibling_above != xnestWindowSiblingAbove(pWin)) {
- WindowPtr pSib;
-
- /* find the top sibling */
- for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib);
-
- /* the top sibling */
- valuemask = CWStackMode;
- values.stack_mode = Above;
- XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
- xnestWindowPriv(pSib)->sibling_above = None;
-
- /* the rest of siblings */
- for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) {
- valuemask = CWSibling | CWStackMode;
- values.sibling = xnestWindowSiblingAbove(pSib);
- values.stack_mode = Below;
- XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
- xnestWindowPriv(pSib)->sibling_above = xnestWindowSiblingAbove(pSib);
- }
- }
-}
-
-Bool
-xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- XSetWindowAttributes attributes;
-
- if (mask & CWBackPixmap)
- switch (pWin->backgroundState) {
- case None:
- attributes.background_pixmap = None;
- break;
-
- case ParentRelative:
- attributes.background_pixmap = ParentRelative;
- break;
-
- case BackgroundPixmap:
- attributes.background_pixmap = xnestPixmap(pWin->background.pixmap);
- break;
-
- case BackgroundPixel:
- mask &= ~CWBackPixmap;
- break;
- }
-
- if (mask & CWBackPixel) {
- if (pWin->backgroundState == BackgroundPixel)
- attributes.background_pixel = xnestPixel(pWin->background.pixel);
- else
- mask &= ~CWBackPixel;
- }
-
- if (mask & CWBorderPixmap) {
- if (pWin->borderIsPixel)
- mask &= ~CWBorderPixmap;
- else
- attributes.border_pixmap = xnestPixmap(pWin->border.pixmap);
- }
-
- if (mask & CWBorderPixel) {
- if (pWin->borderIsPixel)
- attributes.border_pixel = xnestPixel(pWin->border.pixel);
- else
- mask &= ~CWBorderPixel;
- }
-
- if (mask & CWBitGravity)
- attributes.bit_gravity = pWin->bitGravity;
-
- if (mask & CWWinGravity) /* dix does this for us */
- mask &= ~CWWinGravity;
+ if (mask & XCBConfigWindowSibling &&
+ xnestWindowPriv(pWin)->parent.xid != xnestWindowParent(pWin).xid) {
+ XCBReparentWindow(xnestConnection,
+ xnestWindow(pWin),
+ xnestWindowParent(pWin),
+ pWin->origin.x - wBorderWidth(pWin),
+ pWin->origin.y - wBorderWidth(pWin));
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->sibling_above.xid = None;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+ }
- if (mask & CWBackingStore) /* this is really not useful */
- mask &= ~CWBackingStore;
+ valuemask = 0;
- if (mask & CWBackingPlanes) /* this is really not useful */
- mask &= ~CWBackingPlanes;
+ if (mask & CWX && xnestWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) {
+ valuemask |= CWX;
+ values.x = xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ }
- if (mask & CWBackingPixel) /* this is really not useful */
- mask &= ~CWBackingPixel;
+ if (mask & CWY && xnestWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) {
+ valuemask |= CWY;
+ values.y = xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ }
- if (mask & CWOverrideRedirect)
- attributes.override_redirect = pWin->overrideRedirect;
+ if (mask & CWWidth && xnestWindowPriv(pWin)->width != pWin->drawable.width) {
+ valuemask |= CWWidth;
+ values.width = xnestWindowPriv(pWin)->width = pWin->drawable.width;
+ }
- if (mask & CWSaveUnder) /* this is really not useful */
- mask &= ~CWSaveUnder;
+ if (mask & CWHeight && xnestWindowPriv(pWin)->height != pWin->drawable.height) {
+ valuemask |= CWHeight;
+ values.height = xnestWindowPriv(pWin)->height = pWin->drawable.height;
+ }
- if (mask & CWEventMask) /* events are handled elsewhere */
- mask &= ~CWEventMask;
+ if (mask & CWBorderWidth && xnestWindowPriv(pWin)->border_width != pWin->borderWidth) {
+ valuemask |= CWBorderWidth;
+ values.border_width = xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
+ }
- if (mask & CWDontPropagate) /* events are handled elsewhere */
- mask &= ~CWDontPropagate;
+ if (valuemask)
+ XCBAuxConfigureWindow(xnestConnection, xnestWindow(pWin), valuemask, &values);
- if (mask & CWColormap) {
- ColormapPtr pCmap;
-
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
+ if (mask & XCBConfigWindowStackMode && xnestWindowPriv(pWin)->sibling_above.xid != xnestWindowSiblingAbove(pWin)) {
+ WindowPtr pSib;
- attributes.colormap = xnestColormap(pCmap);
+ /* find the top sibling */
+ for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib);
- xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
- }
+ /* the top sibling */
+ valuemask = CWStackMode;
+ values.stack_mode = Above;
+ XCBAuxConfigureWindow(xnestConnection, xnestWindow(pSib), valuemask, &values);
+ xnestWindowPriv(pSib)->sibling_above.xid = None;
+
+ /* the rest of siblings */
+ for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) {
+ valuemask = CWSibling | CWStackMode;
+ values.sibling = xnestWindowSiblingAbove(pSib);
+ values.stack_mode = Below;
+ XCBAuxConfigureWindow(xnestConnection, xnestWindow(pSib), valuemask, &values);
+ xnestWindowPriv(pSib)->sibling_above.xid = xnestWindowSiblingAbove(pSib);
+ }
+ }
+}
+
+Bool xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ XCBParamsCW param;
- if (mask & CWCursor) /* this is handeled in cursor code */
- mask &= ~CWCursor;
-
- if (mask)
- XChangeWindowAttributes(xnestDisplay, xnestWindow(pWin),
- mask, &attributes);
-
- return True;
+ if (mask & XCBCWBackPixmap)
+ switch (pWin->backgroundState) {
+ case None:
+ param.back_pixmap = None;
+ break;
+
+ case ParentRelative:
+ param.back_pixmap = ParentRelative;
+ break;
+
+ case BackgroundPixmap:
+ param.back_pixmap = xnestPixmap(pWin->background.pixmap).xid;
+ break;
+
+ case BackgroundPixel:
+ mask &= ~CWBackPixmap;
+ break;
+ }
+
+ if (mask & CWBackPixel) {
+ if (pWin->backgroundState == BackgroundPixel)
+ param.back_pixel = xnestPixel(pWin->background.pixel);
+ else
+ mask &= ~CWBackPixel;
+ }
+
+ if (mask & CWBorderPixmap) {
+ if (pWin->borderIsPixel)
+ mask &= ~CWBorderPixmap;
+ else
+ param.border_pixmap = xnestPixmap(pWin->border.pixmap).xid;
+ }
+
+ if (mask & CWBorderPixel) {
+ if (pWin->borderIsPixel)
+ param.border_pixel = xnestPixel(pWin->border.pixel);
+ else
+ mask &= ~CWBorderPixel;
+ }
+
+ if (mask & CWBitGravity)
+ param.bit_gravity = pWin->bitGravity;
+
+ if (mask & CWWinGravity) /* dix does this for us */
+ mask &= ~CWWinGravity;
+
+ if (mask & CWBackingStore) /* this is really not useful */
+ mask &= ~CWBackingStore;
+
+ if (mask & CWBackingPlanes) /* this is really not useful */
+ mask &= ~CWBackingPlanes;
+
+ if (mask & CWBackingPixel) /* this is really not useful */
+ mask &= ~CWBackingPixel;
+
+ if (mask & CWOverrideRedirect)
+ param.override_redirect = pWin->overrideRedirect;
+
+ if (mask & CWSaveUnder) /* this is really not useful */
+ mask &= ~CWSaveUnder;
+
+ if (mask & CWEventMask) /* events are handled elsewhere */
+ mask &= ~CWEventMask;
+
+ if (mask & CWDontPropagate) /* events are handled elsewhere */
+ mask &= ~CWDontPropagate;
+
+ if (mask & CWColormap) {
+ ColormapPtr pCmap;
+
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
+
+ param.colormap = xnestColormap(pCmap).xid;
+
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+ }
+
+ if (mask & CWCursor) /* this is handeled in cursor code */
+ mask &= ~CWCursor;
+
+ if (mask)
+ XCBAuxChangeWindowAttributes(xnestConnection, xnestWindow(pWin), mask, ¶m);
+
+ return True;
}
-Bool
-xnestRealizeWindow(WindowPtr pWin)
+Bool xnestRealizeWindow(WindowPtr pWin)
{
- xnestConfigureWindow(pWin, CWStackingOrder);
+ xnestConfigureWindow(pWin, XCBConfigWindowStackMode);
#ifdef SHAPE
- xnestShapeWindow(pWin);
+ xnestShapeWindow(pWin);
#endif /* SHAPE */
- XMapWindow(xnestDisplay, xnestWindow(pWin));
+ XCBMapWindow(xnestConnection, xnestWindow(pWin));
- return True;
+ return True;
}
-Bool
-xnestUnrealizeWindow(WindowPtr pWin)
+Bool xnestUnrealizeWindow(WindowPtr pWin)
{
- XUnmapWindow(xnestDisplay, xnestWindow(pWin));
-
- return True;
+ XCBUnmapWindow(xnestConnection, xnestWindow(pWin));
+ return True;
}
-void
-xnestPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
+void xnestPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
{
- int i;
- BoxPtr pBox;
+ int i;
+ BoxPtr pBox;
- xnestConfigureWindow(pWin, CWWidth | CWHeight);
+ xnestConfigureWindow(pWin, XCBConfigWindowWidth | XCBConfigWindowHeight);
- pBox = REGION_RECTS(pRegion);
- for (i = 0; i < REGION_NUM_RECTS(pRegion); i++)
- XClearArea(xnestDisplay, xnestWindow(pWin),
- pBox[i].x1 - pWin->drawable.x,
- pBox[i].y1 - pWin->drawable.y,
- pBox[i].x2 - pBox[i].x1,
- pBox[i].y2 - pBox[i].y1,
- False);
+ pBox = REGION_RECTS(pRegion);
+ for (i = 0; i < REGION_NUM_RECTS(pRegion); i++)
+ XCBClearArea(xnestConnection,
+ False,
+ xnestWindow(pWin),
+ pBox[i].x1 - pWin->drawable.x,
+ pBox[i].y1 - pWin->drawable.y,
+ pBox[i].x2 - pBox[i].x1,
+ pBox[i].y2 - pBox[i].y1);
}
-void
-xnestPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what)
+void xnestPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what)
{
- xnestConfigureWindow(pWin, CWBorderWidth);
+ xnestConfigureWindow(pWin, CWBorderWidth);
}
-void
-xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion)
+void xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion)
{
}
-void
-xnestClipNotify(WindowPtr pWin, int dx, int dy)
+void xnestClipNotify(WindowPtr pWin, int dx, int dy)
{
- xnestConfigureWindow(pWin, CWStackingOrder);
+ xnestConfigureWindow(pWin, XCBConfigWindowStackMode);
#ifdef SHAPE
- xnestShapeWindow(pWin);
+ xnestShapeWindow(pWin);
#endif /* SHAPE */
}
-static Bool
-xnestWindowExposurePredicate(Display *display, XEvent *event, XPointer ptr)
-{
- return (event->type == Expose && event->xexpose.window == *(Window *)ptr);
-}
+/*static Bool xnestWindowExposurePredicate(XEvent *event, XCBWINDOW win)
+ {
+ return (event->type == XCBExpose && event->xexpose.window == *(Window *)ptr);
+ }*/
-void
-xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
+void xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
{
- XEvent event;
- Window window;
- BoxRec Box;
-
- XSync(xnestDisplay, False);
-
- window = xnestWindow(pWin);
-
- while (XCheckIfEvent(xnestDisplay, &event,
- xnestWindowExposurePredicate, (char *)&window)) {
-
- Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + event.xexpose.x;
- Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + event.xexpose.y;
- Box.x2 = Box.x1 + event.xexpose.width;
- Box.y2 = Box.y1 + event.xexpose.height;
-
- event.xexpose.type = ProcessedExpose;
-
- if (RECT_IN_REGION(pWin->drawable.pScreen, pRgn, &Box) != rgnIN)
- XPutBackEvent(xnestDisplay, &event);
- }
-
- miWindowExposures(pWin, pRgn, other_exposed);
-}
-
-#ifdef SHAPE
-void
-xnestSetShape(WindowPtr pWin)
-{
- xnestShapeWindow(pWin);
- miSetShape(pWin);
-}
-
-static Bool
-xnestRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
-{
- BoxPtr pBox1, pBox2;
- unsigned int n1, n2;
-
- if (pReg1 == pReg2) return True;
+ XCBGenericEvent event;
+ XCBWINDOW window;
+ BoxRec Box;
- if (pReg1 == NullRegion || pReg2 == NullRegion) return False;
+ XCBSync(xnestConnection, NULL);
- pBox1 = REGION_RECTS(pReg1);
- n1 = REGION_NUM_RECTS(pReg1);
+ window = xnestWindow(pWin);
+ /* Commenting this will probably lead to excessive expose events, but since XCB doesn't give the
+ * correct primitives, what to do?
+ while (XCheckIfEvent(xnestConnection, &event, xnestWindowExposurePredicate, (char *)&window)) {
- pBox2 = REGION_RECTS(pReg2);
- n2 = REGION_NUM_RECTS(pReg2);
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + event.xexpose.x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + event.xexpose.y;
+ Box.x2 = Box.x1 + event.xexpose.width;
+ Box.y2 = Box.y1 + event.xexpose.height;
- if (n1 != n2) return False;
+ event.xexpose.type = ProcessedExpose;
- if (pBox1 == pBox2) return True;
+ if (RECT_IN_REGION(pWin->drawable.pScreen, pRgn, &Box) != rgnIN)
+ XPutBackEvent(xnestDisplay, &event);
+ }*/
- if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec))) return False;
-
- return True;
+ miWindowExposures(pWin, pRgn, other_exposed);
}
-void
-xnestShapeWindow(WindowPtr pWin)
+#ifdef SHAPE
+void xnestSetShape(WindowPtr pWin)
{
- Region reg;
- BoxPtr pBox;
- XRectangle rect;
- int i;
+ xnestShapeWindow(pWin);
+ miSetShape(pWin);
+}
- if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape,
- wBoundingShape(pWin))) {
-
- if (wBoundingShape(pWin)) {
- REGION_COPY(pWin->drawable.pScreen,
- xnestWindowPriv(pWin)->bounding_shape, wBoundingShape(pWin));
-
- reg = XCreateRegion();
- pBox = REGION_RECTS(xnestWindowPriv(pWin)->bounding_shape);
- for (i = 0;
- i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape);
- i++) {
- rect.x = pBox[i].x1;
- rect.y = pBox[i].y1;
- rect.width = pBox[i].x2 - pBox[i].x1;
- rect.height = pBox[i].y2 - pBox[i].y1;
- XUnionRectWithRegion(&rect, reg, reg);
- }
- XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
- ShapeBounding, 0, 0, reg, ShapeSet);
- XDestroyRegion(reg);
- }
- else {
- REGION_EMPTY(pWin->drawable.pScreen,
- xnestWindowPriv(pWin)->bounding_shape);
-
- XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
- ShapeBounding, 0, 0, None, ShapeSet);
- }
- }
-
- if (!xnestRegionEqual(xnestWindowPriv(pWin)->clip_shape,
- wClipShape(pWin))) {
-
- if (wClipShape(pWin)) {
- REGION_COPY(pWin->drawable.pScreen,
- xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin));
-
- reg = XCreateRegion();
- pBox = REGION_RECTS(xnestWindowPriv(pWin)->clip_shape);
- for (i = 0;
- i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->clip_shape);
- i++) {
- rect.x = pBox[i].x1;
- rect.y = pBox[i].y1;
- rect.width = pBox[i].x2 - pBox[i].x1;
- rect.height = pBox[i].y2 - pBox[i].y1;
- XUnionRectWithRegion(&rect, reg, reg);
- }
- XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
- ShapeClip, 0, 0, reg, ShapeSet);
- XDestroyRegion(reg);
+static Bool xnestRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
+{
+ BoxPtr pBox1, pBox2;
+ unsigned int n1, n2;
+
+ if (pReg1 == pReg2)
+ return True;
+
+ if (pReg1 == NullRegion || pReg2 == NullRegion)
+ return False;
+
+ pBox1 = REGION_RECTS(pReg1);
+ n1 = REGION_NUM_RECTS(pReg1);
+
+ pBox2 = REGION_RECTS(pReg2);
+ n2 = REGION_NUM_RECTS(pReg2);
+
+ if (n1 != n2)
+ return False;
+
+ if (pBox1 == pBox2)
+ return True;
+
+ if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec)))
+ return False;
+
+ return True;
+}
+
+void xnestShapeWindow(WindowPtr pWin)
+{
+ Region reg;
+ BoxPtr pBox;
+ XCBPIXMAP pmap;
+ XCBRECTANGLE *rect;
+ int i;
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape,
+ wBoundingShape(pWin))) {
+
+ if (wBoundingShape(pWin)) {
+ REGION_COPY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->bounding_shape, wBoundingShape(pWin));
+
+ pBox = REGION_RECTS(xnestWindowPriv(pWin)->bounding_shape);
+ rect = xalloc(sizeof(XCBRECTANGLE) * REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape));
+ for (i = 0; i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape); i++) {
+ rect[i].x = pBox[i].x1;
+ rect[i].y = pBox[i].y1;
+ rect[i].width = pBox[i].x2 - pBox[i].x1;
+ rect[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+ XCBShapeRectangles(xnestConnection,
+ XCBShapeSOUnion,
+ XCBShapeSKClip, /*HELP! What's the difference? Which do I use?*/
+ 0, /*HELP! What's valid here, what does it do?*/
+ xnestWindow(pWin),
+ 0, 0, /*x, y offsets*/
+ REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape),
+ rect);
+ XFree(rect);
+
+ }
+ else {
+ REGION_EMPTY(pWin->drawable.pScreen, xnestWindowPriv(pWin)->bounding_shape);
+ pmap.xid = 0;
+ XCBShapeMask(xnestConnection,
+ XCBShapeSOSet,
+ XCBShapeSKClip, /*what's the difference?*/
+ xnestWindow(pWin),
+ 0, 0,
+ pmap);
+ }
}
- else {
- REGION_EMPTY(pWin->drawable.pScreen,
- xnestWindowPriv(pWin)->clip_shape);
-
- XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
- ShapeClip, 0, 0, None, ShapeSet);
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->clip_shape,
+ wClipShape(pWin))) {
+
+ if (wClipShape(pWin)) {
+ REGION_COPY(pWin->drawable.pScreen, xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin));
+
+ rect = xalloc(sizeof(XCBRECTANGLE) * REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape));
+ pBox = REGION_RECTS(xnestWindowPriv(pWin)->clip_shape);
+ for (i = 0; i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->clip_shape); i++) {
+ rect[i].x = pBox[i].x1;
+ rect[i].y = pBox[i].y1;
+ rect[i].width = pBox[i].x2 - pBox[i].x1;
+ rect[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+ XCBShapeRectangles(xnestConnection,
+ XCBShapeSOUnion,
+ XCBShapeSKClip, /*HELP! What's the difference? Which do I use?*/
+ 0, /*HELP! What's valid here, what does it do?*/
+ xnestWindow(pWin),
+ 0, 0, /*x, y offsets*/
+ REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape),
+ rect);
+ XFree(rect);
+ }
+ else {
+ REGION_EMPTY(pWin->drawable.pScreen, xnestWindowPriv(pWin)->clip_shape);
+ pmap.xid = 0;
+ XCBShapeMask(xnestConnection,
+ XCBShapeSOSet,
+ XCBShapeSKClip, /*HELP! What's the difference? Which do I use?*/
+ xnestWindow(pWin),
+ 0, 0,
+ pmap);
+ }
}
- }
}
#endif /* SHAPE */
diff --git a/hw/xnest/XNFont.h b/hw/xnest/XNFont.h
index 7fb4017..2e33267 100644
--- a/hw/xnest/XNFont.h
+++ b/hw/xnest/XNFont.h
@@ -19,7 +19,9 @@ is" without express or implied warranty.
#define XNESTFONT_H
typedef struct {
- XFontStruct *font_struct;
+ /*where is this used? do I need a XFontStruct-like thing?*/
+// XFontStruct *font_struct;
+ XCBFONT font;
} xnestPrivFont;
extern int xnestFontPrivateIndex;
@@ -27,9 +29,7 @@ extern int xnestFontPrivateIndex;
#define xnestFontPriv(pFont) \
((xnestPrivFont *)FontGetPrivate(pFont, xnestFontPrivateIndex))
-#define xnestFontStruct(pFont) (xnestFontPriv(pFont)->font_struct)
-
-#define xnestFont(pFont) (xnestFontStruct(pFont)->fid)
+#define xnestFont(pFont) (xnestFontPriv(pFont)->font)
Bool xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont);
Bool xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h
index 56939cc..6438a1a 100644
--- a/hw/xnest/XNGC.h
+++ b/hw/xnest/XNGC.h
@@ -20,7 +20,7 @@ is" without express or implied warranty.
/* This file uses the GC definition form Xlib.h as XlibGC. */
typedef struct {
- XlibGC gc;
+ XCBGCONTEXT gc;
int nClipRects;
} xnestPrivGC;
diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h
index fab1843..6d98095 100644
--- a/hw/xnest/XNPixmap.h
+++ b/hw/xnest/XNPixmap.h
@@ -22,7 +22,7 @@ extern int xnestPixmapPrivateIndex;
#endif
typedef struct {
- Pixmap pixmap;
+ XCBPIXMAP pixmap;
} xnestPrivPixmap;
#ifdef PIXPRIV
diff --git a/hw/xnest/XNWindow.h b/hw/xnest/XNWindow.h
index 3a57646..2d80547 100644
--- a/hw/xnest/XNWindow.h
+++ b/hw/xnest/XNWindow.h
@@ -18,14 +18,14 @@ is" without express or implied warranty.
#define XNESTWINDOW_H
typedef struct {
- Window window;
- Window parent;
+ XCBWINDOW window;
+ XCBWINDOW parent;
int x;
int y;
unsigned int width;
unsigned int height;
unsigned int border_width;
- Window sibling_above;
+ XCBWINDOW sibling_above;
#ifdef SHAPE
RegionPtr bounding_shape;
RegionPtr clip_shape;
@@ -34,8 +34,8 @@ typedef struct {
typedef struct {
WindowPtr pWin;
- Window window;
-} xnestWindowMatch;
+ XCBWINDOW window;
+} XnestWindowMatch;
extern int xnestWindowPrivateIndex;
@@ -50,15 +50,13 @@ extern int xnestWindowPrivateIndex;
xnestDefaultWindows[pWin->drawable.pScreen->myNum])
#define xnestWindowSiblingAbove(pWin) \
- ((pWin)->prevSib ? xnestWindow((pWin)->prevSib) : None)
+ ((pWin)->prevSib ? xnestWindow((pWin)->prevSib).xid : None)
#define xnestWindowSiblingBelow(pWin) \
((pWin)->nextSib ? xnestWindow((pWin)->nextSib) : None)
-#define CWParent CWSibling
-#define CWStackingOrder CWStackMode
-WindowPtr xnestWindowPtr(Window window);
+WindowPtr xnestWindowPtr(XCBWINDOW window);
Bool xnestCreateWindow(WindowPtr pWin);
Bool xnestDestroyWindow(WindowPtr pWin);
Bool xnestPositionWindow(WindowPtr pWin, int x, int y);
More information about the xorg-commit
mailing list