/* $XConsortium: DisplayQue.h,v 1.7 94/04/17 20:15:59 rws Exp $ */ /* Copyright (c) 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XMU_DISPLAYQUE_H_ #define _XMU_DISPLAYQUE_H_ #include #include /* * Public Entry Points * * * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data) * XmuCloseDisplayQueueProc closefunc; * XmuFreeDisplayQueueProc freefunc; * XPointer 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; * XPointer 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 _XmuDisplayQueue XmuDisplayQueue; typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry; typedef int (*XmuCloseDisplayQueueProc)( #if NeedFunctionPrototypes XmuDisplayQueue* /* queue */, XmuDisplayQueueEntry* /* entry */ #endif ); typedef int (*XmuFreeDisplayQueueProc)( #if NeedFunctionPrototypes XmuDisplayQueue* /* queue */ #endif ); struct _XmuDisplayQueueEntry { struct _XmuDisplayQueueEntry *prev, *next; Display *display; CloseHook closehook; XPointer data; }; struct _XmuDisplayQueue { int nentries; XmuDisplayQueueEntry *head, *tail; XmuCloseDisplayQueueProc closefunc; XmuFreeDisplayQueueProc freefunc; XPointer data; }; _XFUNCPROTOBEGIN extern XmuDisplayQueue *XmuDQCreate( #if NeedFunctionPrototypes XmuCloseDisplayQueueProc /* closefunc */, XmuFreeDisplayQueueProc /* freefunc */, XPointer /* data */ #endif ); extern Bool XmuDQDestroy( #if NeedFunctionPrototypes XmuDisplayQueue* /* q */, Bool /* docallbacks */ #endif ); extern XmuDisplayQueueEntry *XmuDQLookupDisplay( #if NeedFunctionPrototypes XmuDisplayQueue* /* q */, Display* /* dpy */ #endif ); extern XmuDisplayQueueEntry *XmuDQAddDisplay( #if NeedFunctionPrototypes XmuDisplayQueue* /* q */, Display* /* dpy */, XPointer /* data */ #endif ); extern Bool XmuDQRemoveDisplay( #if NeedFunctionPrototypes XmuDisplayQueue* /* q */, Display* /* dpy */ #endif ); _XFUNCPROTOEND #define XmuDQNDisplays(q) ((q)->nentries) #endif /* _XMU_DISPLAYQUE_H_ */