diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index 22c0d4b925946b23a993963450bd9048745940a8..dc7cc501458175c5fef79aa16e16917b19e98420 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -551,12 +551,12 @@ static int video_init()
 	if(load_vmode(&vstat, C80))
 		return(-1);
 	x_cvstat = vstat;
+	if(init_window())
+		return(-1);
 	bitmap_drv_init(x11_drawrect, x11_flush);
 	pthread_mutex_lock(&vstatlock);
 	bitmap_drv_init_mode(vstat.mode, NULL, NULL, 0, 0);
 	pthread_mutex_unlock(&vstatlock);
-	if(init_window())
-		return(-1);
 	init_mode_internal(x_cvstat.mode);
 
 	return(0);