aboutsummaryrefslogtreecommitdiff
path: root/src/mgl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mgl.c')
-rw-r--r--src/mgl.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mgl.c b/src/mgl.c
index d0e344f..fdf5c5b 100644
--- a/src/mgl.c
+++ b/src/mgl.c
@@ -64,13 +64,13 @@ static bool is_xwayland(Display *dpy) {
}
static int mgl_init_x11(void) {
- if(!context.connection)
- context.connection = XOpenDisplay(NULL);
-
if(!context.connection) {
- fprintf(stderr, "mgl error: mgl_init_x11: failed to connect to the X11 server\n");
- mgl_deinit();
- return -1;
+ context.connection = XOpenDisplay(NULL);
+ if(!context.connection) {
+ fprintf(stderr, "mgl error: mgl_init_x11: failed to connect to the X11 server\n");
+ mgl_deinit();
+ return -1;
+ }
}
connected_to_display_server = true;
/* If we dont call we will never get a MappingNotify until a key has been pressed */
@@ -241,7 +241,7 @@ void mgl_ping_display_server(void) {
if(!context.connection)
return;
- // TODO: Do something equivalent for wayland
+ // TODO: Do something equivalent for wayland, maybe wl_display_roundtrip and if it returns -1 then the connection to the server died
if(context.window_system == MGL_WINDOW_SYSTEM_X11) {
XNoOp(context.connection);
XFlush(context.connection);