DisplayQue.h revision 6c321187
16c321187Smrg/* $Xorg: DisplayQue.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ 26c321187Smrg 36c321187Smrg/* 46c321187Smrg 56c321187SmrgCopyright 1994, 1998 The Open Group 66c321187Smrg 76c321187SmrgPermission to use, copy, modify, distribute, and sell this software and its 86c321187Smrgdocumentation for any purpose is hereby granted without fee, provided that 96c321187Smrgthe above copyright notice appear in all copies and that both that 106c321187Smrgcopyright notice and this permission notice appear in supporting 116c321187Smrgdocumentation. 126c321187Smrg 136c321187SmrgThe above copyright notice and this permission notice shall be included in 146c321187Smrgall copies or substantial portions of the Software. 156c321187Smrg 166c321187SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 176c321187SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 186c321187SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 196c321187SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 206c321187SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 216c321187SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 226c321187Smrg 236c321187SmrgExcept as contained in this notice, the name of The Open Group shall not be 246c321187Smrgused in advertising or otherwise to promote the sale, use or other dealings 256c321187Smrgin this Software without prior written authorization from The Open Group. 266c321187Smrg 276c321187Smrg*/ 286c321187Smrg/* $XFree86: xc/lib/Xmu/DisplayQue.h,v 1.5 2001/01/17 19:42:54 dawes Exp $ */ 296c321187Smrg 306c321187Smrg#ifndef _XMU_DISPLAYQUE_H_ 316c321187Smrg#define _XMU_DISPLAYQUE_H_ 326c321187Smrg 336c321187Smrg#include <X11/Xmu/CloseHook.h> 346c321187Smrg#include <X11/Xfuncproto.h> 356c321187Smrg 366c321187Smrg/* 376c321187Smrg * Public Entry Points 386c321187Smrg * 396c321187Smrg * 406c321187Smrg * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data) 416c321187Smrg * XmuCloseDisplayQueueProc closefunc; 426c321187Smrg * XmuFreeDisplayQueueProc freefunc; 436c321187Smrg * XPointer data; 446c321187Smrg * 456c321187Smrg * Creates and returns a queue into which displays may be placed. When 466c321187Smrg * the display is closed, the closefunc (if non-NULL) is upcalled with 476c321187Smrg * as follows: 486c321187Smrg * 496c321187Smrg * (*closefunc) (queue, entry) 506c321187Smrg * 516c321187Smrg * The freeproc, if non-NULL, is called whenever the last display is 526c321187Smrg * closed, notifying the creator that display queue may be released 536c321187Smrg * using XmuDQDestroy. 546c321187Smrg * 556c321187Smrg * 566c321187Smrg * Bool XmuDQDestroy (q, docallbacks) 576c321187Smrg * XmuDisplayQueue *q; 586c321187Smrg * Bool docallbacks; 596c321187Smrg * 606c321187Smrg * Releases all memory for the indicated display queue. If docallbacks 616c321187Smrg * is true, then the closefunc (if non-NULL) is called for each 626c321187Smrg * display. 636c321187Smrg * 646c321187Smrg * 656c321187Smrg * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy) 666c321187Smrg * XmuDisplayQueue *q; 676c321187Smrg * Display *dpy; 686c321187Smrg * 696c321187Smrg * Returns the queue entry for the specified display or NULL if the 706c321187Smrg * display is not in the queue. 716c321187Smrg * 726c321187Smrg * 736c321187Smrg * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data) 746c321187Smrg * XmuDisplayQueue *q; 756c321187Smrg * Display *dpy; 766c321187Smrg * XPointer data; 776c321187Smrg * 786c321187Smrg * Adds the indicated display to the end of the queue or NULL if it 796c321187Smrg * is unable to allocate memory. The data field may be used by the 806c321187Smrg * caller to attach arbitrary data to this display in this queue. The 816c321187Smrg * caller should use XmuDQLookupDisplay to make sure that the display 826c321187Smrg * hasn't already been added. 836c321187Smrg * 846c321187Smrg * 856c321187Smrg * Bool XmuDQRemoveDisplay (q, dpy) 866c321187Smrg * XmuDisplayQueue *q; 876c321187Smrg * Display *dpy; 886c321187Smrg * 896c321187Smrg * Removes the specified display from the given queue. If the 906c321187Smrg * indicated display is not found on this queue, False is returned, 916c321187Smrg * otherwise True is returned. 926c321187Smrg */ 936c321187Smrg 946c321187Smrgtypedef struct _XmuDisplayQueue XmuDisplayQueue; 956c321187Smrgtypedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry; 966c321187Smrg 976c321187Smrgtypedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue, 986c321187Smrg XmuDisplayQueueEntry *entry); 996c321187Smrg 1006c321187Smrgtypedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue); 1016c321187Smrg 1026c321187Smrgstruct _XmuDisplayQueueEntry { 1036c321187Smrg struct _XmuDisplayQueueEntry *prev, *next; 1046c321187Smrg Display *display; 1056c321187Smrg CloseHook closehook; 1066c321187Smrg XPointer data; 1076c321187Smrg}; 1086c321187Smrg 1096c321187Smrgstruct _XmuDisplayQueue { 1106c321187Smrg int nentries; 1116c321187Smrg XmuDisplayQueueEntry *head, *tail; 1126c321187Smrg XmuCloseDisplayQueueProc closefunc; 1136c321187Smrg XmuFreeDisplayQueueProc freefunc; 1146c321187Smrg XPointer data; 1156c321187Smrg}; 1166c321187Smrg 1176c321187Smrg_XFUNCPROTOBEGIN 1186c321187Smrg 1196c321187SmrgXmuDisplayQueue *XmuDQCreate 1206c321187Smrg( 1216c321187Smrg XmuCloseDisplayQueueProc closefunc, 1226c321187Smrg XmuFreeDisplayQueueProc freefunc, 1236c321187Smrg XPointer data 1246c321187Smrg ); 1256c321187Smrg 1266c321187SmrgBool XmuDQDestroy 1276c321187Smrg( 1286c321187Smrg XmuDisplayQueue *q, 1296c321187Smrg Bool docallbacks 1306c321187Smrg ); 1316c321187Smrg 1326c321187SmrgXmuDisplayQueueEntry *XmuDQLookupDisplay 1336c321187Smrg( 1346c321187Smrg XmuDisplayQueue *q, 1356c321187Smrg Display *dpy 1366c321187Smrg ); 1376c321187Smrg 1386c321187SmrgXmuDisplayQueueEntry *XmuDQAddDisplay 1396c321187Smrg( 1406c321187Smrg XmuDisplayQueue *q, 1416c321187Smrg Display *dpy, 1426c321187Smrg XPointer data 1436c321187Smrg ); 1446c321187Smrg 1456c321187SmrgBool XmuDQRemoveDisplay 1466c321187Smrg( 1476c321187Smrg XmuDisplayQueue *q, 1486c321187Smrg Display *dpy 1496c321187Smrg ); 1506c321187Smrg 1516c321187Smrg_XFUNCPROTOEND 1526c321187Smrg 1536c321187Smrg#define XmuDQNDisplays(q) ((q)->nentries) 1546c321187Smrg 1556c321187Smrg#endif /* _XMU_DISPLAYQUE_H_ */ 156