aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mgl/window/event.h2
-rw-r--r--src/window/window.c14
2 files changed, 6 insertions, 10 deletions
diff --git a/include/mgl/window/event.h b/include/mgl/window/event.h
index 1e7cebf..31af4f1 100644
--- a/include/mgl/window/event.h
+++ b/include/mgl/window/event.h
@@ -1,8 +1,6 @@
#ifndef MGL_EVENT_H
#define MGL_EVENT_H
-#include "key.h"
-#include "mouse_button.h"
#include <stdbool.h>
#include <stdint.h>
diff --git a/src/window/window.c b/src/window/window.c
index abeca8e..0654e85 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -452,13 +452,9 @@ int mgl_window_init_from_existing_window(mgl_window *self, mgl_window_handle exi
}
void mgl_window_deinit(mgl_window *self) {
- mgl_context *context = mgl_get_context();
x11_context *x11_context = self->context;
- if(self->window) {
- XDestroyWindow(context->connection, self->window);
- self->window = 0;
- }
+ mgl_window_close(self);
if(x11_context) {
x11_context_deinit(x11_context);
@@ -953,9 +949,11 @@ bool mgl_window_is_mouse_button_pressed(const mgl_window *self, mgl_mouse_button
void mgl_window_close(mgl_window *self) {
mgl_context *context = mgl_get_context();
- XDestroyWindow(context->connection, self->window);
- XSync(context->connection, False);
- self->window = None;
+ if(self->window) {
+ XDestroyWindow(context->connection, self->window);
+ XSync(context->connection, False);
+ self->window = None;
+ }
self->open = false;
}