aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-06-22 16:23:35 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-08 17:24:00 +0200
commit44a7f1838f0e85a1a9cf5c7fa6aec67a8a60daeb (patch)
treefe344de752b73efcdec622f0980907b1bf9cbba4 /src/main.cpp
parentac1c1b8bbd509637514e6709c904a4a62d2ea595 (diff)
main: execute controllers pending tasks, clang-format
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a07a73c..cd8d67d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,12 +19,9 @@ struct conn {
};
namespace {
-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 }
- };
+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();
@@ -39,14 +36,22 @@ int check_events(struct wl::display *d, struct conn *c, int fd)
return ret;
if (fd != -1 && (pfd[1].revents & POLLIN)) {
- char buf[10];
+ char buf[256];
- while (read(pfd[1].fd, buf, 10) == 10)
+ // read all there is ...
+ while (read(pfd[1].fd, buf, sizeof(buf)) == sizeof(buf))
;
// Display current status
- for (auto const &i : c->c->surfaces) {
- printf("Surface %d\n", i.first);
+ if (!c->c->surfaces.empty()) {
+ puts("Surfaces:");
+ for (auto const &i : c->c->surfaces) {
+ struct genivi::rect const &r = i.second->dst_rect;
+ struct genivi::size const &s = i.second->size;
+ printf("%d [%ux%u] (%ux%u@%dx%d), ", i.first, s.w, s.h, r.w, r.h,
+ r.x, r.y);
+ }
+ puts("\b\b ");
}
}
}
@@ -88,7 +93,7 @@ int main(int argc, char **argv) {
fatal("ivi_controller global not available");
while (check_events(d.get(), &c, STDIN_FILENO) != -1) {
- ;
+ c.c->execute_pending();
}
d->roundtrip();