diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-06-26 13:22:00 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-08 17:24:00 +0200 |
commit | 3fc6d2e2cc8942e20ee57e6afb1d302ee1d35636 (patch) | |
tree | d597cb8db19ddb0d37bf8363a24de7c73eb689d3 | |
parent | f6c51b7d753249f145b5d4159808e6db7dadddaf (diff) |
main: strip std::quniue_ptr from wl::display as it is superfluous
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r-- | src/main.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main.cpp b/src/main.cpp index 146020e..3116313 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,17 +19,17 @@ namespace { // | (__| | | | __/ (__| < | __/\ V / __/ | | | |_\__ \ | | | // \___|_| |_|\___|\___|_|\_\___\___| \_/ \___|_| |_|\__|___/ | | | // |_____| \_\/_/ -int check_events(struct wl::display *d, struct conn *c, int fd) { - struct pollfd pfd[2] = {{.fd = d->get_fd(), .events = POLLIN, .revents = 0}, +int check_events(struct wl::display &d, struct conn *c, int fd) { + struct pollfd pfd[2] = {{.fd = d.get_fd(), .events = POLLIN, .revents = 0}, {.fd = fd, .events = POLLIN, .revents = 0}}; - d->flush(); + d.flush(); if (poll(pfd, fd != -1 ? 2 : 1, -1) != -1 && errno != EINTR) { int ret = 0; if (pfd[0].revents & POLLIN) { - ret = d->dispatch(); + ret = d.dispatch(); } if (ret == -1) @@ -91,8 +91,8 @@ void init_layout(struct conn &c) { s->clear(); // Setup our dummy scene... - c.c->layer_create(100, 0, 0); // bottom layer, anything else - c.c->layer_create(1000, 0, 0); // top layer, mandelbrot + c.c->layer_create(100, 0, 0); // bottom layer, anything else + c.c->layer_create(1000, 0, 0); // top layer, mandelbrot auto &l100 = c.c->layers[100]; auto &l1k = c.c->layers[1000]; @@ -121,28 +121,28 @@ int main(int argc, char **argv) { if (!getenv("XDG_RUNTIME_DIR")) fatal("Environment variable XDG_RUNTIME_DIR not set"); - auto d = std::make_unique<wl::display>(); - if (!d->ok()) + struct wl::display d {}; + if (!d.ok()) fatal("Could not connect to compositor"); - struct conn c{}; + struct conn c {}; - d->r.add_global_handler( + d.r.add_global_handler( "ivi_controller", [&c](wl_registry *r, uint32_t name, uint32_t v) { c.c = std::make_unique<genivi::controller>(r, name, v); }); - d->r.add_global_handler( + d.r.add_global_handler( "wl_output", [&c](wl_registry *r, uint32_t name, uint32_t v) { c.outputs.emplace_back(std::make_unique<wl::output>(r, name, v)); }); // First level objects - d->roundtrip(); + d.roundtrip(); // Second level objects - d->roundtrip(); + d.roundtrip(); // Third level objects - d->roundtrip(); + d.roundtrip(); if (!c.c) fatal("ivi_controller global not available"); @@ -152,12 +152,12 @@ int main(int argc, char **argv) { init_layout(c); - while (check_events(d.get(), &c, STDIN_FILENO) != -1) { + while (check_events(d, &c, STDIN_FILENO) != -1) { c.c->execute_pending(); - d->flush(); + d.flush(); } - d->roundtrip(); + d.roundtrip(); return 0; } |