DisplayQue.h File Reference

#include <X11/Xmu/CloseHook.h>
#include <X11/Xfuncproto.h>

Include dependency graph for DisplayQue.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _XmuDisplayQueueEntry
struct  _XmuDisplayQueue

Defines

#define XmuDQNDisplays(q)   ((q)->nentries)

Typedefs

typedef _XmuDisplayQueue XmuDisplayQueue
typedef _XmuDisplayQueueEntry XmuDisplayQueueEntry
typedef int(*) XmuCloseDisplayQueueProc (XmuDisplayQueue *queue, XmuDisplayQueueEntry *entry)
typedef int(*) XmuFreeDisplayQueueProc (XmuDisplayQueue *queue)

Functions

_XFUNCPROTOBEGIN XmuDisplayQueueXmuDQCreate (XmuCloseDisplayQueueProc closefunc, XmuFreeDisplayQueueProc freefunc, XPointer data)
Bool XmuDQDestroy (XmuDisplayQueue *q, Bool docallbacks)
XmuDisplayQueueEntryXmuDQLookupDisplay (XmuDisplayQueue *q, Display *dpy)
XmuDisplayQueueEntryXmuDQAddDisplay (XmuDisplayQueue *q, Display *dpy, XPointer data)
Bool XmuDQRemoveDisplay (XmuDisplayQueue *q, Display *dpy)


Define Documentation

#define XmuDQNDisplays (  )     ((q)->nentries)

Definition at line 153 of file DisplayQue.h.


Typedef Documentation

typedef int(*) XmuCloseDisplayQueueProc(XmuDisplayQueue *queue, XmuDisplayQueueEntry *entry)

Definition at line 97 of file DisplayQue.h.

typedef struct _XmuDisplayQueue XmuDisplayQueue

Definition at line 94 of file DisplayQue.h.

typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry

Definition at line 95 of file DisplayQue.h.

typedef int(*) XmuFreeDisplayQueueProc(XmuDisplayQueue *queue)

Definition at line 100 of file DisplayQue.h.


Function Documentation

XmuDisplayQueueEntry* XmuDQAddDisplay ( XmuDisplayQueue q,
Display *  dpy,
XPointer  data 
)

Definition at line 108 of file DisplayQue.c.

References _DQCloseDisplay(), _XmuDisplayQueueEntry::closehook, _XmuDisplayQueueEntry::data, _XmuDisplayQueueEntry::display, free(), malloc(), _XmuDisplayQueueEntry::next, NULL, _XmuDisplayQueueEntry::prev, and XmuAddCloseDisplayHook().

Referenced by _XmuCCLookupDisplay().

00109 {
00110     XmuDisplayQueueEntry *e;
00111 
00112     if (!(e = (XmuDisplayQueueEntry *) malloc (sizeof (XmuDisplayQueueEntry)))) {
00113         return NULL;
00114     }
00115     if (!(e->closehook = XmuAddCloseDisplayHook (dpy, _DQCloseDisplay,
00116                                                  (XPointer) q))) {
00117         free ((char *) e);
00118         return NULL;
00119     }
00120 
00121     e->display = dpy;
00122     e->next = NULL;
00123     e->data = data;
00124 
00125     if (q->tail) {
00126         q->tail->next = e;
00127         e->prev = q->tail;
00128     } else {
00129         q->head = e;
00130         e->prev = NULL;
00131     }
00132     q->tail = e;
00133     q->nentries++;
00134     return e;
00135 }

Here is the call graph for this function:

Here is the caller graph for this function:

_XFUNCPROTOBEGIN XmuDisplayQueue* XmuDQCreate ( XmuCloseDisplayQueueProc  closefunc,
XmuFreeDisplayQueueProc  freefunc,
XPointer  data 
)

Definition at line 51 of file DisplayQue.c.

References _XmuDisplayQueue::closefunc, _XmuDisplayQueue::data, _XmuDisplayQueue::freefunc, _XmuDisplayQueue::head, malloc(), _XmuDisplayQueue::nentries, NULL, and _XmuDisplayQueue::tail.

Referenced by _XmuCCLookupDisplay().

00054 {
00055     XmuDisplayQueue *q = (XmuDisplayQueue *) malloc (sizeof (XmuDisplayQueue));
00056     if (q) {
00057         q->nentries = 0;
00058         q->head = q->tail = NULL;
00059         q->closefunc = closefunc;
00060         q->freefunc = freefunc;
00061         q->data = data;
00062     }
00063     return q;
00064 }

Here is the call graph for this function:

Here is the caller graph for this function:

Bool XmuDQDestroy ( XmuDisplayQueue q,
Bool  docallbacks 
)

Definition at line 73 of file DisplayQue.c.

References CallCloseCallback, _XmuDisplayQueue::closefunc, free(), _XmuDisplayQueue::head, and _XmuDisplayQueueEntry::next.

Referenced by _FreeCCDQ().

00074 {
00075     XmuDisplayQueueEntry *e = q->head;
00076 
00077     while (e) {
00078         XmuDisplayQueueEntry *nexte = e->next;
00079         if (docallbacks && q->closefunc) CallCloseCallback (q, e);
00080         free ((char *) e);
00081         e = nexte;
00082     }
00083     free ((char *) q);
00084     return True;
00085 }

Here is the call graph for this function:

Here is the caller graph for this function:

XmuDisplayQueueEntry* XmuDQLookupDisplay ( XmuDisplayQueue q,
Display *  dpy 
)

Definition at line 92 of file DisplayQue.c.

References _XmuDisplayQueueEntry::display, _XmuDisplayQueue::head, _XmuDisplayQueueEntry::next, and NULL.

Referenced by _XmuCCLookupDisplay().

00093 {
00094     XmuDisplayQueueEntry *e;
00095 
00096     for (e = q->head; e; e = e->next) {
00097         if (e->display == dpy) return e;
00098     }
00099     return NULL;
00100 }

Here is the caller graph for this function:

Bool XmuDQRemoveDisplay ( XmuDisplayQueue q,
Display *  dpy 
)

Definition at line 142 of file DisplayQue.c.

References _DQCloseDisplay(), _XmuDisplayQueueEntry::closehook, _XmuDisplayQueueEntry::display, free(), _XmuDisplayQueue::head, _XmuDisplayQueueEntry::next, _XmuDisplayQueueEntry::prev, _XmuDisplayQueue::tail, void(), and XmuRemoveCloseDisplayHook().

Referenced by _DQCloseDisplay().

00143 {
00144     XmuDisplayQueueEntry *e;
00145 
00146     for (e = q->head; e; e = e->next) {
00147         if (e->display == dpy) {
00148             if (q->head == e)
00149               q->head = e->next;        /* if at head, then bump head */
00150             else
00151               e->prev->next = e->next;  /* else splice out */
00152             if (q->tail == e)
00153               q->tail = e->prev;        /* if at tail, then bump tail */
00154             else
00155               e->next->prev = e->prev;  /* else splice out */
00156             (void) XmuRemoveCloseDisplayHook (dpy, e->closehook,
00157                                               _DQCloseDisplay, (XPointer) q);
00158             free ((char *) e);
00159             q->nentries--;
00160             return True;
00161         }
00162     }
00163     return False;
00164 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Mar 4 16:03:47 2007 for Scilab [trunk] by  doxygen 1.5.1