Fixed: return if processed any event.

If wl_display_dispatch_pending returns a positive value, this mean we
have processed at least one event.
Fixed: handle event process correctly.

When waitForEvent is false, we still have to poll the display file
descriptor to read incoming events, but we should do so with 0 timeout
value.

Additionally, if wl_display_dispatch_pending returns 0, we should
call wl_display_flush before wl_display_dispatch to avoid potential
deadlocks.
Apply error checking to wl_proxy_add_listener.
Handle drawing events.