main: pass struct conn by-reference to init_layout()
[staging/windowmanager.git] / src / main.cpp
index 3116313..c343a66 100644 (file)
@@ -19,7 +19,7 @@ namespace {
 // | (__| | | |  __/ (__|   <   |  __/\ V /  __/ | | | |_\__ \ |  | |
 //  \___|_| |_|\___|\___|_|\_\___\___| \_/ \___|_| |_|\__|___/ |  | |
 //                          |_____|                           \_\/_/
-int check_events(struct wl::display &d, struct conn *c, int fd) {
+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}};
 
@@ -43,9 +43,9 @@ int check_events(struct wl::display &d, struct conn *c, int fd) {
             ;
 
          // Display current status
-         if (!c->c->surfaces.empty()) {
+         if (!c.c->surfaces.empty()) {
             puts("Surfaces:");
-            for (auto const &i : c->c->surfaces) {
+            for (auto const &i : c.c->surfaces) {
                auto const &r = i.second->dst_rect;
                auto const &s = i.second->size;
                printf("%d [%ux%u] (%ux%u@%dx%d), ", i.first, s.w, s.h, r.w, r.h,
@@ -54,9 +54,9 @@ int check_events(struct wl::display &d, struct conn *c, int fd) {
             puts("\b\b ");
          }
 
-         if (!c->c->layers.empty()) {
+         if (!c.c->layers.empty()) {
             puts("Layers:");
-            for (auto const &i : c->c->layers) {
+            for (auto const &i : c.c->layers) {
                auto const &r = i.second->dst_rect;
                auto const &s = i.second->size;
                printf("%d [%ux%u] (%ux%u@%dx%d), ", i.first, s.w, s.h, r.w, r.h,
@@ -152,7 +152,7 @@ int main(int argc, char **argv) {
 
    init_layout(c);
 
-   while (check_events(d, &c, STDIN_FILENO) != -1) {
+   while (check_events(d, c, STDIN_FILENO) != -1) {
       c.c->execute_pending();
       d.flush();
    }