35 using namespace wayland;
47 dumper(
const dumper&) =
delete;
48 dumper(dumper&&) noexcept = delete;
49 ~dumper() noexcept = default;
50 dumper& operator=(const dumper&) = delete;
51 dumper& operator=(dumper&&) noexcept = delete;
55 std::vector<output_t> outputs;
58 registry.
on_global() = [&] (uint32_t name,
const std::string& interface, uint32_t version)
60 std::cout <<
"* Global interface " <<
interface << " (name " << name << " version " << version << ")" << std::endl;
61 if(interface == output_t::interface_name)
63 outputs.emplace_back();
64 auto& output = outputs.back();
65 registry.
bind(name, output, version);
66 output.on_geometry() = [=](int32_t x, int32_t y, int32_t physw, int32_t physh, output_subpixel subp,
const std::string& make,
const std::string& model,
const output_transform& transform)
68 std::cout <<
"* Output geometry for " << output.
get_id() <<
":" << std::endl
69 <<
" Maker: " << make << std::endl
70 <<
" Model: " << model << std::endl
71 <<
" X: " << x << std::endl
72 <<
" Y: " << y << std::endl
73 <<
" PhysW: " << physw <<
" mm" << std::endl
74 <<
" PhysH: " << physh <<
" mm" << std::endl
75 <<
" Subpix: " <<
static_cast<unsigned int>(subp) << std::endl
76 <<
" Transf: " <<
static_cast<unsigned int>(transform) << std::endl;
78 output.on_scale() = [=](int32_t scale)
80 std::cout <<
"* Output scale for " << output.get_id() <<
": " << scale << std::endl;
82 output.on_mode() = [=](uint32_t flags, int32_t width, int32_t height, int32_t refresh)
84 std::cout <<
"* Output mode for " << output.get_id() <<
":" << std::endl
85 <<
" Width: " << width << std::endl
86 <<
" Height: " << height << std::endl
87 <<
" Refresh: " << refresh <<
" mHz" << std::endl
88 <<
" Flags: " << flags << std::endl;
94 std::cout <<
"------" << std::endl;
99 for(
auto &output : outputs)
Represents a connection to the compositor and acts as a proxy to the display singleton object.
int roundtrip()
Block until all pending request are processed by the server.
registry_t get_registry()
get global registry object
uint32_t get_id() const
Get the id of a proxy object.
std::function< void(uint32_t, std::string, uint32_t)> & on_global()
announce global object
proxy_t bind(uint32_t name, proxy_t &interface, uint32_t version)
bind an object to the display