# EZ_SetClientMessageHandler

##

##

##

##

##

    NAME
           EZ_SetClientMessageHandler  -  register  a  client message
           handler

    SYNOPSIS
           #include <EZ.h>

           void EZ_SetClientMessageHandler( EZ_EventHandler handler, void *data)

    ARGUMENTS
           handler  Specifies a client message handler.

           data  Specifies a client data to be passed to handler when
           invoked.

    DESCRIPTION
           EZ_SetClientMessageHandler   registers  a  client  message
           handler to an EZWGL application. A client message  handler
           is a procedure that handles ClientMessage events. Its pri-
           mary function is to communicate with  the  window  manager
           and  other  applications.  The default client message han-
           dler  handles  only  the   message   of   type   WM_PROTO-
           COLS/WM_DELETE_WINDOW.

           Here  is  an  example  of  a  client  message handler that
           refrain the window manager from closing a dialogue  widget
           window.

                  Atom DeleteWindowAtom = EZ_GetAtom("WM_DELETE_WINDOW");
                  Atom WMProtocolsAtom = EZ_GetAtom("WM_PROTOCOLS");

                  void myClientMessageHandler(EZ_Widget *widget, void *data,
                                           int etype, XEvent *xev)
                  {
                    XClientMessageEvent *ev = (XClientMessageEvent *)xev;

                    if(ev->message_type == WMProtocolsAtom)
                      {
                        Atom c = (ev->data.l)[0];
                        if(c == DeleteWindowAtom)
                       {
                         EZ_DisplayWidget(Dialogue);
                         EZ_SetGrab(Dialogue);
                       }
                      }
                  }

    SEE ALSO
           EZ_AddEventHandler(3), EZ_AddWidgetCallBack(3)