Example #1
0
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
    int ret = TRUE;
    int err = Success;
    ScreenPtr pScreen = pWin->drawable.pScreen;
    RootWinPropPtr pProp;
    CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
                                       dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);

    DebugF("xf86CreateRootWindow(%p)\n", pWin);

    if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
        /* Can't find hook we are hung on */
        xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */,
                   "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
                   (void *)xf86CreateRootWindow,
                   (void *)pScreen->CreateWindow );
    }

    /* Unhook this function ... */
    pScreen->CreateWindow = CreateWindow;
    dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);

    /* ... and call the previous CreateWindow fuction, if any */
    if (NULL!=pScreen->CreateWindow) {
        ret = (*pScreen->CreateWindow)(pWin);
    }

    /* Now do our stuff */
    if (xf86RegisteredPropertiesTable != NULL) {
        if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
            for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
                    pProp != NULL && err==Success;
                    pProp = pProp->next )
            {
                Atom prop;

                prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
                err = dixChangeWindowProperty(serverClient, pWin,
                                              prop, pProp->type,
                                              pProp->format, PropModeReplace,
                                              pProp->size, pProp->data,
                                              FALSE);
            }

            /* Look at err */
            ret &= (err==Success);

        } else {
            xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
                    "non-root window %p (parent %p)\n",
                    (void *)pWin, (void *)pWin->parent);
            ret = FALSE;
        }
    }

    DebugF("xf86CreateRootWindow() returns %d\n", ret);
    return ret;
}
Bool
PsCreateWindow(WindowPtr pWin)
{
  PsWindowPrivPtr pPriv;

#if 0
    Bool status = Success;
    ScreenPtr pScreen = pWin->drawable.pScreen;
    PsScreenPrivPtr pScreenPriv = (PsScreenPrivPtr) 
	dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey);
    PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
	dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);

    /*
     * Initialize this window's private struct.
     */
    pWinPriv->jobFileName = (char *)NULL;
    pWinPriv->pJobFile = (FILE *)NULL;
    pWinPriv->pageFileName = (char *)NULL;
    pWinPriv->pPageFile = (FILE *)NULL;
    
    if(pWin->parent == (WindowPtr)NULL)  /* root window? */
    {
	Atom propName; /* type = XA_STRING */
	char *propVal;
	int i;
        XrmDatabase rmdb = pScreenPriv->resDB;

        /*
         * Put the defaults spec'd in the config files in properties on this
	 * screen's root window.
         */
	for(i = 0; propStrings[i] != (char *)NULL; i++)
	{
            if((propVal = _DtPrintGetPrinterResource(pWin, rmdb, 
						     propStrings[i])) !=
	       (char *)NULL)
	    {
                propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
				    TRUE);
	        dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
					8, PropModeReplace, strlen(propVal),
					(pointer)propVal, FALSE);
	        xfree(propVal);
	    }
	}
    }

    return status;
#endif

  pPriv = (PsWindowPrivPtr)
      dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
  pPriv->validContext = 0;

  return TRUE;
}
Example #3
0
/* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */
void
AppleWMSetScreenOrigin(WindowPtr pWin)
{
    int32_t data[2];

    data[0] = pWin->drawable.pScreen->x + darwinMainScreenX;
    data[1] = pWin->drawable.pScreen->y + darwinMainScreenY;

    dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
                            XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
}
Example #4
0
static void
AddVTAtoms(CallbackListPtr *pcbl, void *data, void *screen)
{
#define VT_ATOM_NAME         "XFree86_VT"
    int err, HasVT = 1;
    ScreenPtr pScreen = screen;
    Atom VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
    Atom HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
                              TRUE);

    err = dixChangeWindowProperty(serverClient, pScreen->root, VTAtom,
                                  XA_INTEGER, 32, PropModeReplace, 1,
                                  &xf86Info.vtno, FALSE);

    err |= dixChangeWindowProperty(serverClient, pScreen->root, HasVTAtom,
                                   XA_INTEGER, 32, PropModeReplace, 1,
                                   &HasVT, FALSE);

    if (err != Success)
        xf86DrvMsg(pScreen->myNum, X_WARNING,
                   "Failed to register VT properties\n");
}
Example #5
0
static void
AddSeatId(CallbackListPtr *pcbl, void *data, void *screen)
{
    ScreenPtr pScreen = screen;
    Atom SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE);
    int err;

    err = dixChangeWindowProperty(serverClient, pScreen->root, SeatAtom,
                                  XA_STRING, 8, PropModeReplace,
                                  strlen(data) + 1, data, FALSE);

    if (err != Success)
        xf86DrvMsg(pScreen->myNum, X_WARNING,
                   "Failed to register seat property\n");
}
static void
xprSetNativeProperty(RootlessWindowPtr pFrame)
{
    xp_error err;
    unsigned int native_id;
    long data;

    err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id);
    if (err == Success) {
        /* FIXME: move this to AppleWM extension */

        data = native_id;
        dixChangeWindowProperty(serverClient, pFrame->win,
                                xa_native_window_id(),
                                XA_INTEGER, 32, PropModeReplace, 1, &data,
                                TRUE);
    }
}
Example #7
0
static Bool
XkbWriteRulesProp(ClientPtr client, pointer closure)
{
int 			len,out;
Atom			name;
char *			pval;

    len= (XkbRulesUsed?strlen(XkbRulesUsed):0);
    len+= (XkbModelUsed?strlen(XkbModelUsed):0);
    len+= (XkbLayoutUsed?strlen(XkbLayoutUsed):0);
    len+= (XkbVariantUsed?strlen(XkbVariantUsed):0);
    len+= (XkbOptionsUsed?strlen(XkbOptionsUsed):0);
    if (len<1)
	return TRUE;

    len+= 5; /* trailing NULs */

    name= MakeAtom(_XKB_RF_NAMES_PROP_ATOM,strlen(_XKB_RF_NAMES_PROP_ATOM),1);
    if (name==None) {
	ErrorF("[xkb] Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
	return TRUE;
    }
    pval= (char*) malloc(len);
    if (!pval) {
	ErrorF("[xkb] Allocation error: %s proprerty not created\n",
						_XKB_RF_NAMES_PROP_ATOM);
	return TRUE;
    }
    out= 0;
    if (XkbRulesUsed) {
	strcpy(&pval[out],XkbRulesUsed);
	out+= strlen(XkbRulesUsed);
    }
    pval[out++]= '\0';
    if (XkbModelUsed) {
	strcpy(&pval[out],XkbModelUsed);
	out+= strlen(XkbModelUsed);
    } 
    pval[out++]= '\0';
    if (XkbLayoutUsed) {
	strcpy(&pval[out],XkbLayoutUsed);
	out+= strlen(XkbLayoutUsed);
    }
    pval[out++]= '\0';
    if (XkbVariantUsed) {
	strcpy(&pval[out],XkbVariantUsed);
	out+= strlen(XkbVariantUsed);
    }
    pval[out++]= '\0';
    if (XkbOptionsUsed) {
	strcpy(&pval[out],XkbOptionsUsed);
	out+= strlen(XkbOptionsUsed);
    }
    pval[out++]= '\0';
    if (out!=len) {
	ErrorF("[xkb] Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
								out,len);
    }
    dixChangeWindowProperty(serverClient, screenInfo.screens[0]->root, name, XA_STRING, 8,
			    PropModeReplace, len, pval, TRUE);
    free(pval);
    return TRUE;
}