aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-17 00:33:37 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-17 00:33:37 +0200
commit8974be43a3c7f672a34291049bb543d01960de28 (patch)
treeb9673193e71b3fec54ecbbae561b7445603567e5 /src
parent4a967356128c49ad615d786c65a8c0cc672aca7b (diff)
Parent window = 0 = root window
Diffstat (limited to 'src')
-rw-r--r--src/mgl.c1
-rw-r--r--src/window.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/src/mgl.c b/src/mgl.c
index cbdfb41..549121f 100644
--- a/src/mgl.c
+++ b/src/mgl.c
@@ -89,7 +89,6 @@ void mgl_deinit(void) {
if(init_count == 1) {
glx_context_deinit();
mgl_gl_unload(&context.gl);
- mgl_gl_unload(&context.gl);
XSetErrorHandler(prev_xerror);
if(context.connection) {
XCloseDisplay(context.connection);
diff --git a/src/window.c b/src/window.c
index 5e09261..8042ad3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,4 +1,4 @@
-#include "../include/mgl/window.h"
+#include "../include/mgl/window/window.h"
#include "../include/mgl/mgl.h"
#include <X11/Xutil.h>
#include <errno.h>
@@ -38,7 +38,7 @@ static void mgl_window_on_resize(mgl_window *self, int width, int height) {
}
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);
+ return mgl_window_create_with_params(self, title, width, height, 0, 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) {
@@ -47,6 +47,9 @@ int mgl_window_create_with_params(mgl_window *self, const char *title, int width
mgl_context *context = mgl_get_context();
+ if(parent_window == 0)
+ parent_window = DefaultRootWindow(context->connection);
+
Colormap color_map = XCreateColormap(context->connection, DefaultRootWindow(context->connection), ((XVisualInfo*)context->visual_info)->visual, AllocNone);
if(!color_map) {
fprintf(stderr, "XCreateColormap failed\n");