00001 /* $Xorg: DisplayQue.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ 00002 00003 /* 00004 00005 Copyright 1994, 1998 The Open Group 00006 00007 Permission to use, copy, modify, distribute, and sell this software and its 00008 documentation for any purpose is hereby granted without fee, provided that 00009 the above copyright notice appear in all copies and that both that 00010 copyright notice and this permission notice appear in supporting 00011 documentation. 00012 00013 The above copyright notice and this permission notice shall be included in 00014 all copies or substantial portions of the Software. 00015 00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 00023 Except as contained in this notice, the name of The Open Group shall not be 00024 used in advertising or otherwise to promote the sale, use or other dealings 00025 in this Software without prior written authorization from The Open Group. 00026 00027 */ 00028 /* $XFree86: xc/lib/Xmu/DisplayQue.h,v 1.5 2001/01/17 19:42:54 dawes Exp $ */ 00029 00030 #ifndef _XMU_DISPLAYQUE_H_ 00031 #define _XMU_DISPLAYQUE_H_ 00032 00033 #include <X11/Xmu/CloseHook.h> 00034 #include <X11/Xfuncproto.h> 00035 00036 /* 00037 * Public Entry Points 00038 * 00039 * 00040 * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data) 00041 * XmuCloseDisplayQueueProc closefunc; 00042 * XmuFreeDisplayQueueProc freefunc; 00043 * XPointer data; 00044 * 00045 * Creates and returns a queue into which displays may be placed. When 00046 * the display is closed, the closefunc (if non-NULL) is upcalled with 00047 * as follows: 00048 * 00049 * (*closefunc) (queue, entry) 00050 * 00051 * The freeproc, if non-NULL, is called whenever the last display is 00052 * closed, notifying the creator that display queue may be released 00053 * using XmuDQDestroy. 00054 * 00055 * 00056 * Bool XmuDQDestroy (q, docallbacks) 00057 * XmuDisplayQueue *q; 00058 * Bool docallbacks; 00059 * 00060 * Releases all memory for the indicated display queue. If docallbacks 00061 * is true, then the closefunc (if non-NULL) is called for each 00062 * display. 00063 * 00064 * 00065 * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy) 00066 * XmuDisplayQueue *q; 00067 * Display *dpy; 00068 * 00069 * Returns the queue entry for the specified display or NULL if the 00070 * display is not in the queue. 00071 * 00072 * 00073 * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data) 00074 * XmuDisplayQueue *q; 00075 * Display *dpy; 00076 * XPointer data; 00077 * 00078 * Adds the indicated display to the end of the queue or NULL if it 00079 * is unable to allocate memory. The data field may be used by the 00080 * caller to attach arbitrary data to this display in this queue. The 00081 * caller should use XmuDQLookupDisplay to make sure that the display 00082 * hasn't already been added. 00083 * 00084 * 00085 * Bool XmuDQRemoveDisplay (q, dpy) 00086 * XmuDisplayQueue *q; 00087 * Display *dpy; 00088 * 00089 * Removes the specified display from the given queue. If the 00090 * indicated display is not found on this queue, False is returned, 00091 * otherwise True is returned. 00092 */ 00093 00094 typedef struct _XmuDisplayQueue XmuDisplayQueue; 00095 typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry; 00096 00097 typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue, 00098 XmuDisplayQueueEntry *entry); 00099 00100 typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue); 00101 00102 struct _XmuDisplayQueueEntry { 00103 struct _XmuDisplayQueueEntry *prev, *next; 00104 Display *display; 00105 CloseHook closehook; 00106 XPointer data; 00107 }; 00108 00109 struct _XmuDisplayQueue { 00110 int nentries; 00111 XmuDisplayQueueEntry *head, *tail; 00112 XmuCloseDisplayQueueProc closefunc; 00113 XmuFreeDisplayQueueProc freefunc; 00114 XPointer data; 00115 }; 00116 00117 _XFUNCPROTOBEGIN 00118 00119 XmuDisplayQueue *XmuDQCreate 00120 ( 00121 XmuCloseDisplayQueueProc closefunc, 00122 XmuFreeDisplayQueueProc freefunc, 00123 XPointer data 00124 ); 00125 00126 Bool XmuDQDestroy 00127 ( 00128 XmuDisplayQueue *q, 00129 Bool docallbacks 00130 ); 00131 00132 XmuDisplayQueueEntry *XmuDQLookupDisplay 00133 ( 00134 XmuDisplayQueue *q, 00135 Display *dpy 00136 ); 00137 00138 XmuDisplayQueueEntry *XmuDQAddDisplay 00139 ( 00140 XmuDisplayQueue *q, 00141 Display *dpy, 00142 XPointer data 00143 ); 00144 00145 Bool XmuDQRemoveDisplay 00146 ( 00147 XmuDisplayQueue *q, 00148 Display *dpy 00149 ); 00150 00151 _XFUNCPROTOEND 00152 00153 #define XmuDQNDisplays(q) ((q)->nentries) 00154 00155 #endif /* _XMU_DISPLAYQUE_H_ */
1.5.1