aboutsummaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/window.c b/src/window.c
index 7d13ffe..ccfab93 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,6 +1,7 @@
#include "../include/mgl/window.h"
#include "../include/mgl/mgl.h"
#include <X11/Xutil.h>
+#include <errno.h>
#include <stdio.h>
/* TODO: check for glx swap control extension string (GLX_EXT_swap_control, etc) */
@@ -26,14 +27,13 @@ static void set_vertical_sync_enabled(Window window, int enabled) {
fprintf(stderr, "Warning: setting vertical sync failed\n");
}
-int mgl_window_create(mgl_window *self, const char *title, int width, int height, mgl_window_callback *callback, void *userdata) {
- return mgl_window_create_with_params(self, title, width, height, DefaultRootWindow(mgl_get_context()->connection), callback, userdata);
+int mgl_window_create(mgl_window *self, const char *title, int width, int height, mgl_window_callback *callback) {
+ return mgl_window_create_with_params(self, title, width, height, DefaultRootWindow(mgl_get_context()->connection), callback);
}
-int mgl_window_create_with_params(mgl_window *self, const char *title, int width, int height, unsigned long parent_window, mgl_window_callback *callback, void *userdata) {
+int mgl_window_create_with_params(mgl_window *self, const char *title, int width, int height, unsigned long parent_window, mgl_window_callback *callback) {
self->window = 0;
self->callback = *callback;
- self->callback_userdata = userdata;
mgl_context *context = mgl_get_context();
@@ -104,7 +104,7 @@ void mgl_window_events_poll(mgl_window *self) {
XNextEvent(display, &xev);
on_receive_x11_event(self, &xev);
}
- } else if(num_ready_fds == -1) {
+ } else if(num_ready_fds == -1 && errno != EINTR) {
/* TODO: */
fprintf(stderr, "Disconnected!\n");
}
@@ -121,6 +121,6 @@ void mgl_window_draw(mgl_window *self) {
context->gl.glClear(GL_COLOR_BUFFER_BIT);
context->gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
if(self->callback.draw)
- self->callback.draw(self, self->callback_userdata);
+ self->callback.draw(self, self->callback.userdata);
context->gl.glXSwapBuffers(context->connection, self->window);
}