summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/engine/ui/ui.h7
-rw-r--r--src/main/engine/ui/x11/ui.c14
2 files changed, 19 insertions, 2 deletions
diff --git a/src/main/engine/ui/ui.h b/src/main/engine/ui/ui.h
index 2335a4b..2cb8d32 100644
--- a/src/main/engine/ui/ui.h
+++ b/src/main/engine/ui/ui.h
@@ -20,7 +20,12 @@
#ifndef __UI_H__
#define __UI_H__
-void ui_init(int w, int h);
+typedef struct UI {
+ int width;
+ int height;
+} UI;
+
+UI *ui_init(int w, int h);
void ui_loop(void);
void ui_set_title(const char *title);
void ui_set_expose_listener(void (*expose_event)());
diff --git a/src/main/engine/ui/x11/ui.c b/src/main/engine/ui/x11/ui.c
index 2d1a046..89004c8 100644
--- a/src/main/engine/ui/x11/ui.c
+++ b/src/main/engine/ui/x11/ui.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <time.h>
#include "../../../util.h"
+#include "../ui.h"
static Display *display;
static Window window;
@@ -92,9 +93,15 @@ ui_set_title(const char *title)
XStoreName(display, window, title);
}
-void
+UI *
ui_init(int width, int height)
{
+ UI *ui = malloc(sizeof(UI));
+ if (ui == NULL) {
+ log_error("Error allocating UI");
+ exit(1);
+ }
+
display = ui_open_display();
int screen = DefaultScreen(display);
@@ -109,6 +116,11 @@ ui_init(int width, int height)
log_error("Error on making GLX context");
exit(1);
}
+
+ ui->width = width;
+ ui->height = height;
+
+ return ui;
}
static void