DisplayQue.h revision 6c321187
1/* $Xorg: DisplayQue.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ 2 3/* 4 5Copyright 1994, 1998 The Open Group 6 7Permission to use, copy, modify, distribute, and sell this software and its 8documentation for any purpose is hereby granted without fee, provided that 9the above copyright notice appear in all copies and that both that 10copyright notice and this permission notice appear in supporting 11documentation. 12 13The above copyright notice and this permission notice shall be included in 14all copies or substantial portions of the Software. 15 16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 23Except as contained in this notice, the name of The Open Group shall not be 24used in advertising or otherwise to promote the sale, use or other dealings 25in this Software without prior written authorization from The Open Group. 26 27*/ 28/* $XFree86: xc/lib/Xmu/DisplayQue.h,v 1.5 2001/01/17 19:42:54 dawes Exp $ */ 29 30#ifndef _XMU_DISPLAYQUE_H_ 31#define _XMU_DISPLAYQUE_H_ 32 33#include <X11/Xmu/CloseHook.h> 34#include <X11/Xfuncproto.h> 35 36/* 37 * Public Entry Points 38 * 39 * 40 * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data) 41 * XmuCloseDisplayQueueProc closefunc; 42 * XmuFreeDisplayQueueProc freefunc; 43 * XPointer data; 44 * 45 * Creates and returns a queue into which displays may be placed. When 46 * the display is closed, the closefunc (if non-NULL) is upcalled with 47 * as follows: 48 * 49 * (*closefunc) (queue, entry) 50 * 51 * The freeproc, if non-NULL, is called whenever the last display is 52 * closed, notifying the creator that display queue may be released 53 * using XmuDQDestroy. 54 * 55 * 56 * Bool XmuDQDestroy (q, docallbacks) 57 * XmuDisplayQueue *q; 58 * Bool docallbacks; 59 * 60 * Releases all memory for the indicated display queue. If docallbacks 61 * is true, then the closefunc (if non-NULL) is called for each 62 * display. 63 * 64 * 65 * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy) 66 * XmuDisplayQueue *q; 67 * Display *dpy; 68 * 69 * Returns the queue entry for the specified display or NULL if the 70 * display is not in the queue. 71 * 72 * 73 * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data) 74 * XmuDisplayQueue *q; 75 * Display *dpy; 76 * XPointer data; 77 * 78 * Adds the indicated display to the end of the queue or NULL if it 79 * is unable to allocate memory. The data field may be used by the 80 * caller to attach arbitrary data to this display in this queue. The 81 * caller should use XmuDQLookupDisplay to make sure that the display 82 * hasn't already been added. 83 * 84 * 85 * Bool XmuDQRemoveDisplay (q, dpy) 86 * XmuDisplayQueue *q; 87 * Display *dpy; 88 * 89 * Removes the specified display from the given queue. If the 90 * indicated display is not found on this queue, False is returned, 91 * otherwise True is returned. 92 */ 93 94typedef struct _XmuDisplayQueue XmuDisplayQueue; 95typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry; 96 97typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue, 98 XmuDisplayQueueEntry *entry); 99 100typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue); 101 102struct _XmuDisplayQueueEntry { 103 struct _XmuDisplayQueueEntry *prev, *next; 104 Display *display; 105 CloseHook closehook; 106 XPointer data; 107}; 108 109struct _XmuDisplayQueue { 110 int nentries; 111 XmuDisplayQueueEntry *head, *tail; 112 XmuCloseDisplayQueueProc closefunc; 113 XmuFreeDisplayQueueProc freefunc; 114 XPointer data; 115}; 116 117_XFUNCPROTOBEGIN 118 119XmuDisplayQueue *XmuDQCreate 120( 121 XmuCloseDisplayQueueProc closefunc, 122 XmuFreeDisplayQueueProc freefunc, 123 XPointer data 124 ); 125 126Bool XmuDQDestroy 127( 128 XmuDisplayQueue *q, 129 Bool docallbacks 130 ); 131 132XmuDisplayQueueEntry *XmuDQLookupDisplay 133( 134 XmuDisplayQueue *q, 135 Display *dpy 136 ); 137 138XmuDisplayQueueEntry *XmuDQAddDisplay 139( 140 XmuDisplayQueue *q, 141 Display *dpy, 142 XPointer data 143 ); 144 145Bool XmuDQRemoveDisplay 146( 147 XmuDisplayQueue *q, 148 Display *dpy 149 ); 150 151_XFUNCPROTOEND 152 153#define XmuDQNDisplays(q) ((q)->nentries) 154 155#endif /* _XMU_DISPLAYQUE_H_ */ 156