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