4 * Copyright (c) 1993 The Regents of the University of California.
5 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
7 * See the file "license.terms" for information on usage and redistribution of
8 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 #include "tkUnixInt.h"
15 *----------------------------------------------------------------------
19 * This function is called to indicate that an X resource identifier is
26 * The identifier is added to the stack of free identifiers for its
27 * display, so that it can be re-used.
29 *----------------------------------------------------------------------
34 Display *display, /* Display for which xid was allocated. */
35 XID xid) /* Identifier that is no longer in use. */
38 * This does nothing, because the XC-MISC extension takes care of
39 * freeing XIDs for us. It has been a standard X11 extension for
40 * about 15 years as of 2008. Keith Packard and another X.org
41 * developer suggested that we remove the previous code that used:
42 * #define XLIB_ILLEGAL_ACCESS.
48 *----------------------------------------------------------------------
52 * Same as the XCreatePixmap function except that it manages resource
56 * Returns a new pixmap.
61 *----------------------------------------------------------------------
66 Display *display, /* Display for new pixmap. */
67 Drawable d, /* Drawable where pixmap will be used. */
68 int width, int height, /* Dimensions of pixmap. */
69 int depth) /* Bits per pixel for pixmap. */
71 return XCreatePixmap(display, d, (unsigned) width, (unsigned) height,
76 *----------------------------------------------------------------------
80 * Same as the XFreePixmap function except that it also marks the
81 * resource identifier as free.
87 * The pixmap is freed in the X server and its resource identifier is
90 *----------------------------------------------------------------------
95 Display *display, /* Display for which pixmap was allocated. */
96 Pixmap pixmap) /* Identifier for pixmap. */
98 XFreePixmap(display, pixmap);
103 *----------------------------------------------------------------------
107 * Given a string, produce the corresponding Window Id.
110 * The return value is normally TCL_OK; in this case *idPtr will be set
111 * to the Window value equivalent to string. If string is improperly
112 * formed then TCL_ERROR is returned and an error message will be left in
113 * the interp's result.
118 *----------------------------------------------------------------------
131 obj.bytes = (char *) string; /* DANGER?! */
132 obj.length = strlen(string);
135 code = Tcl_GetLongFromObj(interp, &obj, (long *)idPtr);
137 if (obj.refCount > 1) {
138 Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
140 if (obj.typePtr && obj.typePtr->freeIntRepProc) {
141 obj.typePtr->freeIntRepProc(&obj);