Add support for using back-end server root window.

This commit is contained in:
David Reveman 2008-07-09 18:06:28 -04:00
parent ffeb2ade90
commit 3078ea3bfd
9 changed files with 78 additions and 66 deletions

View file

@ -529,7 +529,8 @@ static int ProcDMXAddScreen(ClientPtr client)
}
}
status = dmxAttachScreen(physicalScreen, &attr, NULL, NULL, 0, NULL, 0, 0);
status = dmxAttachScreen(physicalScreen, &attr, 0, NULL, NULL, 0, NULL,
0, 0);
xfree(name);

View file

@ -141,6 +141,8 @@ typedef struct _DMXScreenInfo {
char *authData;
int authDataLen;
int beUseRoot;
/*---------- Screen window information ----------*/
Window scrnWin; /**< "Screen" window on backend display */

View file

@ -136,6 +136,7 @@ handle_attach_screen (DBusMessage *message,
ret = dmxAttachScreen (screen,
&attr,
TRUE,
auth_type,
data,
size,

View file

@ -1710,6 +1710,7 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
int
dmxAttachScreen (int idx,
DMXScreenAttributesPtr attr,
int useRoot,
const char *authType,
const char *authData,
int authDataLen,
@ -1763,6 +1764,8 @@ dmxAttachScreen (int idx,
/* Save old info */
oldDMXScreen = *dmxScreen;
dmxScreen->beUseRoot = useRoot;
/* Copy the display name to the new screen */
dmxScreen->display = strdup(attr->displayName);

View file

@ -124,6 +124,7 @@ typedef void (*dmxErrorSetProcPtr) (void *error,
extern int dmxAttachScreen (int idx,
DMXScreenAttributesPtr attr,
int useRoot,
const char *authType,
const char *authData,
int authDataLen,

View file

@ -1421,32 +1421,34 @@ void dmxBEScreenInit(int idx, ScreenPtr pScreen)
/* Create root window for screen */
mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
attribs.background_pixel = dmxScreen->beBlackPixel;
attribs.event_mask = (KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
| KeymapStateMask
| FocusChangeMask);
attribs.event_mask = StructureNotifyMask;
attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex];
attribs.override_redirect = True;
dmxScreen->scrnWin =
XCreateWindow(dmxScreen->beDisplay,
DefaultRootWindow(dmxScreen->beDisplay),
dmxScreen->scrnX,
dmxScreen->scrnY,
dmxScreen->scrnWidth,
dmxScreen->scrnHeight,
0,
pScreen->rootDepth,
InputOutput,
dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
mask,
&attribs);
if (!dmxScreen->beUseRoot)
{
dmxScreen->scrnWin =
XCreateWindow(dmxScreen->beDisplay,
DefaultRootWindow(dmxScreen->beDisplay),
dmxScreen->scrnX,
dmxScreen->scrnY,
dmxScreen->scrnWidth,
dmxScreen->scrnHeight,
0,
pScreen->rootDepth,
InputOutput,
dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
mask,
&attribs);
}
else
{
dmxScreen->scrnWin = DefaultRootWindow (dmxScreen->beDisplay);
XSetWindowBackground (dmxScreen->beDisplay, dmxScreen->scrnWin,
attribs.background_pixel);
XSelectInput (dmxScreen->beDisplay, dmxScreen->scrnWin,
attribs.event_mask);
}
dmxPropertyWindow(dmxScreen);
/*
@ -1473,10 +1475,6 @@ void dmxBEScreenInit(int idx, ScreenPtr pScreen)
}
#ifdef RANDR
XSelectInput (dmxScreen->beDisplay,
DefaultRootWindow (dmxScreen->beDisplay),
StructureNotifyMask);
if (dmxScreen->beRandr)
XRRSelectInput (dmxScreen->beDisplay,
DefaultRootWindow (dmxScreen->beDisplay),
@ -1486,11 +1484,8 @@ void dmxBEScreenInit(int idx, ScreenPtr pScreen)
RROutputPropertyNotifyMask);
#endif
XMapWindow (dmxScreen->beDisplay, dmxScreen->scrnWin);
XSetInputFocus (dmxScreen->beDisplay, dmxScreen->scrnWin,
RevertToPointerRoot,
CurrentTime);
if (!dmxScreen->beUseRoot)
XMapWindow (dmxScreen->beDisplay, dmxScreen->scrnWin);
if (dmxShadowFB) {
mask = (GCFunction
@ -1965,10 +1960,13 @@ void dmxBECloseScreen(ScreenPtr pScreen)
XLIB_EPILOGUE (dmxScreen);
dmxScreen->noCursor = (Cursor)0;
XLIB_PROLOGUE (dmxScreen);
XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
XLIB_EPILOGUE (dmxScreen);
if (!dmxScreen->beUseRoot)
{
XLIB_PROLOGUE (dmxScreen);
XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
XLIB_EPILOGUE (dmxScreen);
}
dmxScreen->scrnWin = (Window)0;
if (dmxShadowFB) {

View file

@ -84,12 +84,33 @@ Window dmxCreateRootWindow(WindowPtr pWindow)
dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
Window parent;
Visual *visual;
unsigned long mask;
unsigned long mask = 0;
XSetWindowAttributes attribs;
ColormapPtr pCmap;
dmxColormapPrivPtr pCmapPriv;
Window win = None;
mask = CWEventMask;
attribs.event_mask = ExposureMask;
/* Incorporate new attributes, if needed */
if (pWinPriv->attribMask) {
dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
mask |= pWinPriv->attribMask;
}
if (dmxScreen->beUseRoot)
{
XLIB_PROLOGUE (dmxScreen);
XChangeWindowAttributes (dmxScreen->beDisplay,
DefaultRootWindow (dmxScreen->beDisplay),
mask, &attribs);
XLIB_EPILOGUE (dmxScreen);
dmxSync (dmxScreen, False);
return DefaultRootWindow (dmxScreen->beDisplay);
}
/* Create root window */
parent = dmxScreen->scrnWin; /* This is our "Screen" window */
@ -98,18 +119,11 @@ Window dmxCreateRootWindow(WindowPtr pWindow)
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel;
attribs.event_mask = ExposureMask;
mask |= CWBackingStore | CWColormap | CWBorderPixel;
attribs.backing_store = NotUseful;
attribs.colormap = pCmapPriv->cmap;
attribs.border_pixel = 0;
/* Incorporate new attributes, if needed */
if (pWinPriv->attribMask) {
dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
mask |= pWinPriv->attribMask;
}
XLIB_PROLOGUE (dmxScreen);
win = XCreateWindow(dmxScreen->beDisplay,
parent,
@ -137,7 +151,7 @@ void dmxResizeScreenWindow(ScreenPtr pScreen,
unsigned int m;
XWindowChanges c;
if (!dmxScreen->beDisplay)
if (!dmxScreen->beDisplay || dmxScreen->beUseRoot)
return;
/* Handle resizing on back-end server */
@ -164,7 +178,7 @@ void dmxResizeRootWindow(WindowPtr pRoot,
XWindowChanges c;
/* Handle resizing on back-end server */
if (dmxScreen->beDisplay) {
if (dmxScreen->beDisplay && !dmxScreen->beUseRoot) {
m = CWX | CWY | CWWidth | CWHeight;
c.x = x;
c.y = y;
@ -179,7 +193,7 @@ void dmxResizeRootWindow(WindowPtr pRoot,
if (w == 0 || h == 0) {
if (pWinPriv->mapped) {
if (dmxScreen->beDisplay)
if (dmxScreen->beDisplay && !dmxScreen->beUseRoot)
{
XLIB_PROLOGUE (dmxScreen);
dmxSetIgnore (dmxScreen, NextRequest (dmxScreen->beDisplay));
@ -189,7 +203,7 @@ void dmxResizeRootWindow(WindowPtr pRoot,
pWinPriv->mapped = FALSE;
}
} else if (!pWinPriv->mapped) {
if (dmxScreen->beDisplay)
if (dmxScreen->beDisplay && !dmxScreen->beUseRoot)
{
XLIB_PROLOGUE (dmxScreen);
dmxSetIgnore (dmxScreen, NextRequest (dmxScreen->beDisplay));

View file

@ -621,15 +621,7 @@ void dmxBackendInit(DevicePtr pDev)
/* Finish initialization using computed values or constants. */
dmxBackendComputeCenter(priv);
priv->eventMask = (KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
| KeymapStateMask
| FocusChangeMask);
priv->eventMask = StructureNotifyMask;
priv->myScreen = dmxScreen->index;
priv->lastX = priv->centerX;
priv->lastY = priv->centerY;

View file

@ -292,10 +292,10 @@ int dmxCommonKbdOn(DevicePtr pDev)
GETPRIVFROMPDEV;
if (priv->be) dmxCommonSaveState(priv);
priv->eventMask |= DMX_KEYBOARD_EVENT_MASK;
//XSelectInput(priv->display, priv->window, priv->eventMask);
// if (priv->be)
// XSetInputFocus(priv->display, priv->window, RevertToPointerRoot,
// CurrentTime);
XSelectInput(priv->display, priv->window, priv->eventMask);
if (priv->be)
XSetInputFocus(priv->display, priv->window, RevertToPointerRoot,
CurrentTime);
return -1;
}
@ -304,7 +304,7 @@ void dmxCommonKbdOff(DevicePtr pDev)
{
GETPRIVFROMPDEV;
priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK;
//XSelectInput(priv->display, priv->window, priv->eventMask);
XSelectInput(priv->display, priv->window, priv->eventMask);
dmxCommonRestoreState(priv);
}
@ -460,10 +460,10 @@ void dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
static void *dmxCommonXSelect(DMXScreenInfo *dmxScreen, void *closure)
{
/* myPrivate *priv = closure;
myPrivate *priv = closure;
XLIB_PROLOGUE (dmxScreen);
XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask);
XLIB_EPILOGUE (dmxScreen);*/
XLIB_EPILOGUE (dmxScreen);
return NULL;
}