Beispiel #1
0
Bool
PclCreateWindow(
    register WindowPtr pWin)
{
    PclWindowPrivPtr pPriv;
    
#if 0
    Bool status = Success;
    ScreenPtr pScreen = pWin->drawable.pScreen;
    PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr) 
		     pScreen->devPrivates[PclScreenPrivateIndex].ptr;
    PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
			 pWin->devPrivates[PclWindowPrivateIndex].ptr;

    /*
     * 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);
	        ChangeWindowProperty(pWin, propName, XA_STRING, 8, 
			             PropModeReplace,  strlen(propVal), 
			             (pointer)propVal, FALSE);
	        xfree(propVal);
	    }
	}
    }

    return status;
#endif

    /*
     * Invalidate the window's private print context.
     */
    pPriv = (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
    pPriv->validContext = 0;
    
    return TRUE;
}
Beispiel #2
0
void
rfbSetXCutText(char *str, int len)
{
    int i = 0;

    inSetXCutText = TRUE;
    ChangeWindowProperty(WindowTable[0], XA_CUT_BUFFER0, XA_STRING,
			 8, PropModeReplace, len,
			 (pointer)str, TRUE);
    
    while ((i < NumCurrentSelections) && 
	   CurrentSelections[i].selection != XA_PRIMARY)
	i++;

    if (i < NumCurrentSelections) {
	xEvent event;

	if (CurrentSelections[i].client) {
	    event.u.u.type = SelectionClear;
	    event.u.selectionClear.time = GetTimeInMillis();
	    event.u.selectionClear.window = CurrentSelections[i].window;
	    event.u.selectionClear.atom = CurrentSelections[i].selection;
	    (void) TryClientEvents (CurrentSelections[i].client, &event, 1,
				NoEventMask, NoEventMask /* CantBeFiltered */,
				NullGrab);
	}

	CurrentSelections[i].window = None;
	CurrentSelections[i].pWin = NULL;
	CurrentSelections[i].client = NullClient;
    }

    inSetXCutText = FALSE;
}
Beispiel #3
0
void
rfbSetXCutText(char *str, int len)
{
    inSetXCutText = TRUE;
    ChangeWindowProperty(WindowTable[0], XA_CUT_BUFFER0, XA_STRING,
                         8, PropModeReplace, len,
                         (pointer)str, TRUE);
    inSetXCutText = FALSE;
}
// Read Mac OS X pasteboard into X cut buffer
// Called by ProcessInputEvents() in response to request from X server thread.
void QuartzReadPasteboard(void)
{
    char *oldText = QuartzReadCutBuffer();
    char *text = QuartzReadCocoaPasteboard();

    // Compare text with current cut buffer contents.
    // Change the buffer if both exist and are different
    //   OR if there is new text but no old text.
    // Otherwise, don't clear the selection unnecessarily.

    if ((text && oldText && !strequal(text, oldText)) ||
        (text && !oldText)) {
        int scrn, sel;

        for (scrn = 0; scrn < screenInfo.numScreens; scrn++) {
	    ScreenPtr pScreen = screenInfo.screens[scrn];
	    // Set the cut buffers on each screen
	    // fixme really on each screen?
	    ChangeWindowProperty(WindowTable[pScreen->myNum], XA_CUT_BUFFER0,
				 XA_STRING, 8, PropModeReplace,
				 strlen(text), (pointer)text, TRUE);
        }

        // Undo any current X selection (similar to code in dispatch.c)
        // FIXME: what about secondary selection?
        // FIXME: only touch first XA_PRIMARY selection?
        sel = 0;
        while ((sel < NumCurrentSelections)  &&
	       CurrentSelections[sel].selection != XA_PRIMARY)
	    sel++;
        if (sel < NumCurrentSelections) {
	    // Notify client if necessary
	    if (CurrentSelections[sel].client) {
	        xEvent event;

	        event.u.u.type = SelectionClear;
		event.u.selectionClear.time = GetTimeInMillis();
		event.u.selectionClear.window = CurrentSelections[sel].window;
		event.u.selectionClear.atom = CurrentSelections[sel].selection;
		TryClientEvents(CurrentSelections[sel].client, &event, 1,
				NoEventMask, NoEventMask /*CantBeFiltered*/,
				NullGrab);
	    }

	    // Erase it
	    // FIXME: need to erase .selection too? dispatch.c doesn't
	    CurrentSelections[sel].pWin = NullWindow;
	    CurrentSelections[sel].window = None;
	    CurrentSelections[sel].client = NullClient;
        }
    }

    if (text) free(text);
    if (oldText) free(oldText);
}
Beispiel #5
0
static void
xprSetNativeProperty(RootlessWindowPtr pFrame)
{
    xp_error err;
    unsigned int native_id;
    long data;

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

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

    if (rulesDefined && (!XkbRulesFile))
	return False;
    len= (XkbRulesFile?strlen(XkbRulesFile):strlen(XKB_DFLT_RULES_FILE));
    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("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
	return True;
    }
    pval= (char*) ALLOCATE_LOCAL(len);
    if (!pval) {
	ErrorF("Allocation error: %s proprerty not created\n",
						_XKB_RF_NAMES_PROP_ATOM);
	return True;
    }
    out= 0;
    if (XkbRulesFile) {
	strcpy(&pval[out],XkbRulesFile);
	out+= strlen(XkbRulesFile);
    } else {
	strcpy(&pval[out],XKB_DFLT_RULES_FILE);
	out+= strlen(XKB_DFLT_RULES_FILE);
    }
    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("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
								out,len);
    }
    ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace,
							len,pval,True);
    DEALLOCATE_LOCAL(pval);
    return True;
}