Skip to content
  • Kristian Høgsberg's avatar
    client: Return number of events dispatched from dispatch functions · f8d55a87
    Kristian Høgsberg authored
    To let clients determine whether any events were dispatched, we return
    the number of dispatched events.  An event source with an event queue
    (such as wl_display or an X connection) may queue up event as a result of
    processing a different event source (data on a network socket, timerfd etc).
    
    After dispatching data from fd (or just before blocking) we have to check
    such event sources, which is what wl_event_source_check() is used for.
    A checked event source will have its handler called with mask=0 just
    before blocking.  If any work is done in any of these handlers, we have
    to check all the checked sources again, since the work could have queued up
    events in a different source.  This is why the event handlers must return
    a positive number if events were handled.  Which in turn is why we need
    the wl_display dispatch functions to return that as well.
    f8d55a87