seamus

commit 36eee4f8415d6d09125a6b92013bb8548c20b581

Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>

ui: initial tickit riggings

 include/ui.h | 9 +++++++++
 src/ui.c | 37 +++++++++++++++++++++++++++++++++++++


diff --git a/include/ui.h b/include/ui.h
new file mode 100644
index 0000000000000000000000000000000000000000..e618799d4fc9a68afa4982390a706eca24f66fb6
--- /dev/null
+++ b/include/ui.h
@@ -0,0 +1,9 @@
+#ifndef SEAMUS_UI
+#define SEAMUS_UI
+#include <errno.h>
+#include <tickit.h>
+#include "seamus.h"
+
+int tickit_init(struct seamus_frontend *s);
+int tickit_finish(struct seamus_frontend *s);
+#endif




diff --git a/src/ui.c b/src/ui.c
new file mode 100644
index 0000000000000000000000000000000000000000..16fb2681dbdccd3bff6033650909b6bec2195c8b
--- /dev/null
+++ b/src/ui.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include "ui.h"
+
+int
+tickit_init(struct seamus_frontend *s)
+{
+
+	Tickit *t = tickit_new_stdtty();
+	TickitWindow *root = tickit_get_rootwin(t);
+
+	if (!root) {
+		log_debug("Cannot create TickitTerm - %d\n", strerror(errno));
+		return 1;
+	}
+
+	s->t = t;
+
+	TickitWindow *main_window = tickit_window_new(root, (TickitRect){
+		.top = 2, .left = 2, .lines = tickit_window_lines(root) - 2,
+		.cols = tickit_window_cols(root) - 2
+	}, 0);
+
+	s->main_window = main_window;
+
+	return 0;
+}
+
+int
+tickit_finish(struct seamus_frontend *s)
+{
+	TickitWindow *root = tickit_get_rootwin(s->t);
+
+	tickit_window_close(root);
+	tickit_unref(s->t);
+
+	return 0;
+}