Annotation of researchv9/X11/src/X.V11R1/lib/X/XStBytes.c, revision 1.1.1.1

1.1       root        1: /* $Header: XStBytes.c,v 11.13 87/09/01 15:06:39 toddb Exp $ */
                      2: /* Copyright    Massachusetts Institute of Technology    1986  */
                      3: 
                      4: #include "Xlibint.h"
                      5: #include "Xatom.h"
                      6: 
                      7: /* insulate predefined atom numbers from cut routines */
                      8: static Atom n_to_atom[8] = { 
                      9:        XA_CUT_BUFFER0,
                     10:        XA_CUT_BUFFER1,
                     11:        XA_CUT_BUFFER2,
                     12:        XA_CUT_BUFFER3,
                     13:        XA_CUT_BUFFER4,
                     14:        XA_CUT_BUFFER5,
                     15:        XA_CUT_BUFFER6,
                     16:        XA_CUT_BUFFER7};
                     17: 
                     18: XRotateBuffers (dpy, rotate)
                     19:     register Display *dpy;
                     20:     int rotate;
                     21: {
                     22:        XRotateWindowProperties(dpy, RootWindow(dpy, 0), n_to_atom, 8, rotate);
                     23: }
                     24:     
                     25: char *XFetchBuffer (dpy, nbytes, buffer)
                     26:     register Display *dpy;
                     27:     int *nbytes;
                     28:     register int buffer;
                     29: {
                     30:     Atom actual_type;
                     31:     int actual_format;
                     32:     unsigned long nitems;
                     33:     long leftover;
                     34:     unsigned char *data;
                     35:     *nbytes = 0;
                     36:     if ((buffer < 0) || (buffer > 7)) return (NULL);
                     37: /* XXX should be (sizeof (maxint) - 1)/4 */
                     38:     if (XGetWindowProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], 
                     39:        0L, 10000000L, False, XA_STRING, 
                     40:        &actual_type, &actual_format, &nitems, &leftover, &data) != Success) {
                     41:        return (NULL);
                     42:        }
                     43:     if ( (actual_type == XA_STRING) &&  (actual_format != 32) ) {
                     44:        *nbytes = nitems;
                     45:        return((char *)data);
                     46:        }
                     47:     if ((char *) data != NULL) Xfree ((char *)data);
                     48:     return(NULL);
                     49: }
                     50: 
                     51: char *XFetchBytes (dpy, nbytes)
                     52:     register Display *dpy;
                     53:     int *nbytes;
                     54: {
                     55:     return (XFetchBuffer (dpy, nbytes, 0));
                     56: }
                     57: 
                     58: XStoreBuffer (dpy, bytes, nbytes, buffer)
                     59:     register Display *dpy;
                     60:     char bytes[];
                     61:     int nbytes;
                     62:     register int buffer;
                     63: {
                     64:     if ((buffer < 0) || (buffer > 7)) return;
                     65:     XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], 
                     66:        XA_STRING, 8, PropModeReplace, (unsigned char *) bytes, nbytes);
                     67: }
                     68: 
                     69: XStoreBytes (dpy, bytes, nbytes)
                     70:     register Display *dpy;
                     71:     char bytes[];
                     72:     int nbytes;
                     73: {
                     74:     XStoreBuffer (dpy, bytes, nbytes, 0);
                     75: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.