From 642a4def5d7e7434547d67a5363471ee6986a42e Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Thu, 14 May 2020 09:19:52 +0200
Subject: [PATCH] Restart is working

---
 inc/lektor/net.h         | 2 ++
 src/module/module_sdl2.c | 4 +++-
 src/net/listen.c         | 6 ++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/inc/lektor/net.h b/inc/lektor/net.h
index 981753dc..e9985dfc 100644
--- a/inc/lektor/net.h
+++ b/inc/lektor/net.h
@@ -86,6 +86,8 @@ struct lkt_state {
     struct lkt_win win;
 };
 
+void lkt_set_event_available(struct lkt_state *srv, enum lkt_event_type type);
+
 /* Send a message to the connected client. */
 void lkt_state_send(struct lkt_state *srv, size_t c, struct lkt_message *msg);
 
diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c
index 50aa7e1d..120ce968 100644
--- a/src/module/module_sdl2.c
+++ b/src/module/module_sdl2.c
@@ -166,8 +166,10 @@ loop:
         break;
 
     case SDL_WINDOWEVENT:
-        if (event.window.event == SDL_WINDOWEVENT_EXPOSED)
+        if (event.window.event == SDL_WINDOWEVENT_EXPOSED) {
+            lkt_set_event_available(win->srv, lkt_event_play);
             redraw = 1;
+        }
         break;
 
     case SDL_KEYUP:
diff --git a/src/net/listen.c b/src/net/listen.c
index 04c44682..332edcb2 100644
--- a/src/net/listen.c
+++ b/src/net/listen.c
@@ -50,6 +50,12 @@ struct lkt_client {
     int continuation;
 };
 
+void
+lkt_set_event_available(struct lkt_state *srv, enum lkt_event_type type)
+{
+    lkt_queue_make_available(&srv->queue, type);
+}
+
 static inline bool
 lkt_close_client(struct lkt_state *srv, size_t c)
 {
-- 
GitLab