earlybrowserreborn - Rev 1

Subversion Repositories:
Rev:
/* @(#)64       1.3  com/XTOP/X11/Xmu/DisplayQue.h, gos, gos320 5/22/91 10:48:38 */
/*
 *   COMPONENT_NAME: XSAMPLE
 *
 *   FUNCTIONS: none
 *
 *   ORIGINS: 16,27,40,42
 *
 *
 *   (C) COPYRIGHT International Business Machines Corp. 1988,1991
 *   All Rights Reserved
 *   Licensed Materials - Property of IBM
 *   US Government Users Restricted Rights - Use, duplication or
 *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 */


/* Coopyright 1989 Massachusetts Institute of Technology */

#include <X11/Xmu/CloseHook.h>

/*
 *                            Public Entry Points
 *
 *
 * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
 *     int (*closefunc)();
 *     int (*freefunc)();
 *     caddr_t data;
 *
 *         Creates and returns a queue into which displays may be placed.  When
 *         the display is closed, the closefunc (if non-NULL) is upcalled with
 *         as follows:
 *
 *                 (*closefunc) (queue, entry)
 *
 *         The freeproc, if non-NULL, is called whenever the last display is
 *         closed, notifying the creator that display queue may be released
 *         using XmuDQDestroy.
 *
 *
 * Bool XmuDQDestroy (q, docallbacks)
 *     XmuDisplayQueue *q;
 *     Bool docallbacks;
 *
 *         Releases all memory for the indicated display queue.  If docallbacks
 *         is true, then the closefunc (if non-NULL) is called for each
 *         display.
 *
 *
 * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
 *     XmuDisplayQueue *q;
 *     Display *dpy;
 *
 *         Returns the queue entry for the specified display or NULL if the
 *         display is not in the queue.
 *
 *
 * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
 *     XmuDisplayQueue *q;
 *     Display *dpy;
 *     caddr_t data;
 *
 *         Adds the indicated display to the end of the queue or NULL if it
 *         is unable to allocate memory.  The data field may be used by the
 *         caller to attach arbitrary data to this display in this queue.  The
 *         caller should use XmuDQLookupDisplay to make sure that the display
 *         hasn't already been added.
 *
 *
 * Bool XmuDQRemoveDisplay (q, dpy)
 *     XmuDisplayQueue *q;
 *     Display *dpy;
 *
 *         Removes the specified display from the given queue.  If the
 *         indicated display is not found on this queue, False is returned,
 *         otherwise True is returned.
 */


typedef struct _XmuDisplayQueueEntry {
    struct _XmuDisplayQueueEntry *prev, *next;
    Display *display;
    CloseHook closehook;
    caddr_t data;
} XmuDisplayQueueEntry;

typedef struct _XmuDisplayQueue {
    int nentries;
    XmuDisplayQueueEntry *head, *tail;
    int (*closefunc)();
    int (*freefunc)();
    caddr_t data;
} XmuDisplayQueue;


extern XmuDisplayQueue *XmuDQCreate ();
extern Bool XmuDQDestroy ();
extern XmuDisplayQueueEntry *XmuDQLookupDisplay ();
extern XmuDisplayQueueEntry *XmuDQAddDisplay ();
extern Bool XmuDQRemoveDisplay ();


#define XmuDQNDisplays(q) ((q)->nentries)