Fixed build issues.

These fixes some build errors with latest wayland code.
Added support for wayland events.

Wayland uses libffi for its event system. The way the callback
functinons are called makes a perfect fit for C++ virtual table.

We create here several C++ interfaces to support wayland event system.
Removed unused calls.
Switch to the new event mechanism implemented for wayland.