Provided by: libdrawtk-dev_1.0b-1_amd64 bug

NAME

       dtk_process_events, dtk_set_event_handler - Events processing

SYNOPSIS

       #include <dtk_event.h>

       typedef int (*DTKEvtProc)(dtk_hwnd, int, const union dtk_event*);

       void dtk_set_event_handler(dtk_hwnd wnd, DTKEvtProc handler);
       int dtk_process_events(dtk_hwnd wnd);

DESCRIPTION

       dtk_set_event_handler()  set  handler  as  the  current  event handler for the window wnd.
       handler is a function that has arguments in the following order:

        * a reference of type dtk_hwnd to the window that has received the event.

        * the type ID of the event.

        * a pointer to a union dtk_event holding event-specific data (if  not  NULL)  defined  as
          follows:

              union dtk_event {
                  struct dtk_keyevent key;
                  struct dtk_mouseevent mouse;
              };

       dtk_process_events() processes pending events in the event queues associated to the window
       referenced by wnd, i.e.  for each event in the queue, it calls the event handler that  has
       been  set  by dtk_set_event_handler(). dtk_process_events() returns if a event handler has
       returned 0 or if there is no more pending event in the queue.

       If dtk_set_event_handler() has never been called or called with handle as NULL, it  use  a
       minimalistic  event  handler  that  returns 0 (i.e. stop the loop) when pressing the close
       button on the window.

       The type ID of the event can be one of the following:

       DTK_EVT_REDRAW
              This event indicates that the whole window or parts of it must  be  redrawn.   This
              may  be  caused  by  another  window  has been overlapped it or the window has been
              resized. If such an event is received, the event pointer passed to the handler will
              be NULL.

       DTK_EVT_QUIT
              This  event  indicates  that  the close button of the window has been clicked.  The
              event pointer passed will be NULL.

       DTK_EVT_KEYBOARD
              Indicates that a key of the keyboard has been pressed or released. If such an event
              is  received,  the  meaningfull  member of the union dtk_event will be key which is
              defined as follows:

                  struct dtk_keyevent {
                      unsigned int state;  /* pressed or released */
                      unsigned int sym;    /* Symbolic code of the key */
                      unsigned int mod;    /* modifiers key */
                  };

       DTK_EVT_MOUSEBUTTON
              This event indicates that one of the mouse buttons has been pressed or released. If
              such  an  event  is received, the meaningfull member of the union dtk_event will be
              mouse which is defined as follows:

                  struct dtk_mouseevent {
                      unsigned int button; /* button identifier */
                      unsigned int state;  /* pressed or realeased */
                      unsigned int x;   /* x-coordinate of the mouse position */
                      unsigned int y;   /* y-coordinate of the mouse position */
                  };

       DTK_EVT_MOUSEMOTION
              This is similar to the DTK_EVT_MOUSEBUTTON but indicates that the mouse has  moved.
              Event  data  should  also be accessed through mouse member but its button and state
              members will be meaningless.

RETURN VALUE

       dtk_set_event_handler() does not return value.

       dtk_process_events() returns 1 if there is no more pending event in the queue.  It returns
       0  if  the  processing  loop has been interrupted by an event handler, i.e. the last event
       handler has returned 0.