This is an example of how to use the Wayland C++ bindings with a wl_display.
#include <iostream>
#include <memory>
using namespace wayland;
class foreign_display
{
private:
wl_display* c_display = nullptr;
std::unique_ptr<display_t> display;
public:
foreign_display()
{
}
~foreign_display()
{
wl_display_disconnect(c_display);
}
void run()
{
c_display = wl_display_connect(nullptr);
if(!c_display)
throw std::runtime_error("Cannot connect to Wayland display");
registry.
on_global() = [&] (uint32_t name, std::string interface, uint32_t version)
{
std::cout << "* Global interface " << interface << " (name " << name << " version " << version << ")" << std::endl;
};
display->roundtrip();
}
};
int main()
{
foreign_display d;
d.run();
return 0;
}