Skip to content

CloseDisplay Hook Functions

To use the functions defined in this section, you should include the header file <X11/Xmu/CloseHook.h> and link against the libXmu library.

CloseHook XmuAddCloseDisplayHook(Display *dpy, int ( *func )
	    (Display *, XPointer), XPointer arg);
CloseHook XmuAddCloseDisplayHook(Display *dpy, int ( *func )
	    (Display *, XPointer), XPointer arg);

dpy

specifies the connection to the X server

func

specifies the function to call at display close

arg

specifies arbitrary data to pass to func

This function adds a callback for the given display. When the display is closed, the given function will be called with the given display and argument as:

	(*func)(dpy, arg)
      

The function is declared to return an int even though the value is ignored, because some compilers used to have problems with functions returning void.

This routine returns NULL if it was unable to add the callback, otherwise it returns an opaque handle that can be used to remove or lookup the callback.

Bool XmuRemoveCloseDisplayHook(Display *dpy, CloseHook handle, int ( *func )
	    (Display *, XPointer), XPointer arg);
Bool XmuRemoveCloseDisplayHook(Display *dpy, CloseHook handle, int ( *func )
	    (Display *, XPointer), XPointer arg);

dpy

specifies the connection to the X server

handle

specifies the callback by id, or NULL

func

specifies the callback by function

arg

specifies the function data to match

This function deletes a callback that has been added with XmuAddCloseDisplayHook. If handle is not NULL, it specifies the callback to remove, and the func and arg parameters are ignored. If handle is NULL, the first callback found to match the specified func and arg will be removed. Returns True if a callback was removed, else returns False.

Bool XmuLookupCloseDisplayHook(Display *dpy, CloseHook handle, int ( *func )
	    (Display *, XPointer), XPointer arg);
Bool XmuLookupCloseDisplayHook(Display *dpy, CloseHook handle, int ( *func )
	    (Display *, XPointer), XPointer arg);

dpy

specifies the connection to the X server

handle

specifies the callback by id, or NULL

func

specifies the callback by function

arg

specifies the function data to match

This function determines if a callback is installed. If handle is not NULL, it specifies the callback to look for, and the func and arg parameters are ignored. If handle is NULL, the function will look for any callback for the specified func and arg. Returns True if a matching callback exists, else returns False.