Beispiel #1
0
Bool XQueryPointer(
     register Display *dpy,
     Window w,
     Window *root,
     Window *child,
     int *root_x,
     int *root_y,
     int *win_x,
     int *win_y,
     unsigned int *mask)
{
    xQueryPointerReply rep;
    xResourceReq *req;

    LockDisplay(dpy);
    GetResReq(QueryPointer, w, req);
    if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) {
	    UnlockDisplay(dpy);
	    SyncHandle();
	    return(False);
	}

    *root = rep.root;
    *child = rep.child;
    *root_x = cvtINT16toInt (rep.rootX);
    *root_y = cvtINT16toInt (rep.rootY);
    *win_x = cvtINT16toInt (rep.winX);
    *win_y = cvtINT16toInt (rep.winY);
    *mask = rep.mask;
    UnlockDisplay(dpy);
    SyncHandle();
    return (rep.sameScreen);
}
Beispiel #2
0
static
char *_XGetAtomName(
    Display *dpy,
    Atom atom)
{
    xResourceReq *req;
    char *name;
    register Entry *table;
    register int idx;
    register Entry e;

    if (dpy->atoms) {
        table = dpy->atoms->table;
        for (idx = TABLESIZE; --idx >= 0; ) {
            if ((e = *table++) && (e->atom == atom)) {
                idx = strlen(EntryName(e)) + 1;
                if ((name = (char *)Xmalloc(idx)))
                    strcpy(name, EntryName(e));
                return name;
            }
        }
    }
    GetResReq(GetAtomName, atom, req);
    return (char *)NULL;
}
void
XhivSequenceSync(Display *dpy, uint32_t sequence) {
    xResourceReq *xssreq;

    LockDisplay(dpy);
    GetResReq(XHIV_PROTO_REQTYPE, sequence, xssreq);
    ((xXhivSeqStartReq *)xssreq)->reqMinor = XhivSeqStart;
    UnlockDisplay(dpy);
    SyncHandle();
}
Beispiel #4
0
int
XFreePixmap(
    register Display *dpy,
    Pixmap pixmap)
{
    register xResourceReq *req;
    LockDisplay(dpy);
    GetResReq(FreePixmap, pixmap, req);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Beispiel #5
0
int
XMapWindow (
	register Display *dpy,
	Window w)
{
	register xResourceReq *req;
	LockDisplay (dpy);
        GetResReq(MapWindow, w, req);
	UnlockDisplay (dpy);
	SyncHandle();
	return 1;
}
Beispiel #6
0
int
XUninstallColormap(
    register Display *dpy,
    Colormap cmap)
{
    register xResourceReq *req;

    LockDisplay(dpy);
    GetResReq(UninstallColormap, cmap, req);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Beispiel #7
0
int
XDestroySubwindows(
    register Display *dpy,
    Window win)
{
    register xResourceReq *req;

    LockDisplay(dpy);
    GetResReq (DestroySubwindows,win, req);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Beispiel #8
0
int
XUngrabPointer(
    register Display *dpy,
    Time time)
{
    register xResourceReq *req;

    LockDisplay(dpy);
    GetResReq(UngrabPointer, time, req);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Beispiel #9
0
Window XGetSelectionOwner(
    register Display *dpy,
    Atom selection)
{
    xGetSelectionOwnerReply rep;
    register xResourceReq *req;
    LockDisplay(dpy);
    GetResReq(GetSelectionOwner, selection, req);

    if (_XReply(dpy, (xReply *)&rep, 0, xTrue) == 0) rep.owner = None;
    UnlockDisplay(dpy);
    SyncHandle();
    return(rep.owner);
}
Beispiel #10
0
int
XFreeGC (
    register Display *dpy,
    GC gc)
    {
    register xResourceReq *req;
    register _XExtension *ext;
    LockDisplay(dpy);
    /* call out to any extensions interested */
    for (ext = dpy->ext_procs; ext; ext = ext->next)
	if (ext->free_GC) (*ext->free_GC)(dpy, gc, &ext->codes);
    GetResReq (FreeGC, gc->gid, req);
    UnlockDisplay(dpy);
    SyncHandle();
    _XFreeExtData(gc->ext_data);
    Xfree (gc);
    return 1;
    }
Beispiel #11
0
int
XMapRaised (
    register Display *dpy,
    Window w)
{
    register xConfigureWindowReq *req;
    register xResourceReq *req2;
    unsigned long val = Above;		/* needed for macro */

    LockDisplay(dpy);
    GetReqExtra(ConfigureWindow, 4, req);
    req->window = w;
    req->mask = CWStackMode;
    OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val);
    GetResReq (MapWindow, w, req2);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Beispiel #12
0
Colormap *XListInstalledColormaps(
    register Display *dpy,
    Window win,
    int *n)  /* RETURN */
{
    long nbytes;
    Colormap *cmaps;
    xListInstalledColormapsReply rep;
    register xResourceReq *req;

    LockDisplay(dpy);
    GetResReq(ListInstalledColormaps, win, req);

    if(_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
	    UnlockDisplay(dpy);
	    SyncHandle();
	    *n = 0;
	    return((Colormap *) NULL);
	}

    if (rep.nColormaps) {
	nbytes = rep.nColormaps * sizeof(Colormap);
	cmaps = (Colormap *) Xmalloc((unsigned) nbytes);
	nbytes = rep.nColormaps << 2;
	if (! cmaps) {
	    _XEatData(dpy, (unsigned long) nbytes);
	    UnlockDisplay(dpy);
	    SyncHandle();
	    return((Colormap *) NULL);
	}
	_XRead32 (dpy, (long *) cmaps, nbytes);
    }
    else cmaps = (Colormap *) NULL;

    *n = rep.nColormaps;
    UnlockDisplay(dpy);
    SyncHandle();
    return(cmaps);
}
Beispiel #13
0
Atom *XListProperties(
    register Display *dpy,
    Window window,
    int *n_props)  /* RETURN */
{
    unsigned long nbytes;
    xListPropertiesReply rep;
    Atom *properties;
    register xResourceReq *req;

    LockDisplay(dpy);
    GetResReq(ListProperties, window, req);
    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
	*n_props = 0;
	UnlockDisplay(dpy);
        SyncHandle();
	return ((Atom *) NULL);
    }

    if (rep.nProperties) {
	nbytes = rep.nProperties * sizeof(Atom);
	properties = Xmalloc (nbytes);
	if (! properties) {
	    _XEatDataWords(dpy, rep.length);
	    UnlockDisplay(dpy);
	    SyncHandle();
	    return (Atom *) NULL;
	}
	nbytes = rep.nProperties << 2;
	_XRead32 (dpy, (long *) properties, nbytes);
    }
    else properties = (Atom *) NULL;

    *n_props = rep.nProperties;
    UnlockDisplay(dpy);
    SyncHandle();
    return (properties);
}