summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/poll_common.c7
-rw-r--r--src/poll_common.h2
-rw-r--r--src/window.h2
-rw-r--r--src/window_glfm.c3
-rw-r--r--src/window_glfw.c3
-rw-r--r--src/window_kms.c2
-rw-r--r--src/window_wayland.c4
-rw-r--r--src/window_win32.c3
-rw-r--r--src/window_x11.c9
9 files changed, 15 insertions, 20 deletions
diff --git a/src/poll_common.c b/src/poll_common.c
index 868fa46..c9a8971 100644
--- a/src/poll_common.c
+++ b/src/poll_common.c
@@ -5,7 +5,7 @@
#include "poll_common.h"
#ifdef STELA_POLL_INLINE
-bool stl_poll_common(struct stl_window *window, struct nn_pollfd *fds, bool block)
+void stl_poll_common(struct nn_pollfd *fds, bool block)
{
fds[0].revents = 0;
#ifdef STELA_PAUSE
@@ -18,7 +18,7 @@ bool stl_poll_common(struct stl_window *window, struct nn_pollfd *fds, bool bloc
if (nn_poll_fds(fds, 1, (block) ? -1 : 0) < 0 && errno != EINTR) {
#endif
log_error("poll() failed %s (%d).", nn_strerror(errno), errno);
- return false;
+ al_assert(fds[0].revents == 0 && fds[1].revents == 0);
}
// On Wayland this will happen consistantly if the program is lagging too hard.
@@ -27,10 +27,7 @@ bool stl_poll_common(struct stl_window *window, struct nn_pollfd *fds, bool bloc
log_error("poll() returned error in revents (%d).", fds[0].revents);
al_assert(false);
exit(0);
- return false;
}
-
- return !window->closed;
}
#ifdef STELA_PAUSE
// wake() must be thread-safe.
diff --git a/src/poll_common.h b/src/poll_common.h
index 597fa73..3c37d1b 100644
--- a/src/poll_common.h
+++ b/src/poll_common.h
@@ -5,7 +5,7 @@
#include "window.h"
#ifdef STELA_POLL_INLINE
-bool stl_poll_common(struct stl_window *window, struct nn_pollfd *fds, bool block);
+void stl_poll_common(struct nn_pollfd *fds, bool block);
#ifdef STELA_PAUSE
void stl_wake_common(struct nn_pollfd *fds);
#endif
diff --git a/src/window.h b/src/window.h
index de18c83..16b8f2e 100644
--- a/src/window.h
+++ b/src/window.h
@@ -92,7 +92,7 @@ struct stl_window {
void (*set_cursor)(struct stl_window *window, u8);
void (*set_decorations)(struct stl_window *, bool);
#ifdef STELA_POLL_INLINE
- bool (*poll)(struct stl_window *, bool);
+ void (*poll)(struct stl_window *, bool);
#ifdef STELA_PAUSE
void (*wake)(struct stl_window *);
#endif
diff --git a/src/window_glfm.c b/src/window_glfm.c
index a799f5d..a99dbcd 100644
--- a/src/window_glfm.c
+++ b/src/window_glfm.c
@@ -194,11 +194,10 @@ static void window_glfm_toggle_fullscreen(struct stl_window *window)
}
#ifdef STELA_POLL_INLINE
-static bool window_glfm_poll(struct stl_window *window, bool block)
+static void window_glfm_poll(struct stl_window *window, bool block)
{
(void)window;
(void)block;
- return true;
}
#ifdef STELA_PAUSE
diff --git a/src/window_glfw.c b/src/window_glfw.c
index 0f55bc3..32e0cfb 100644
--- a/src/window_glfw.c
+++ b/src/window_glfw.c
@@ -404,12 +404,11 @@ static void window_glfw_set_decorations(struct stl_window *window, bool enabled)
#ifdef STELA_EVENT_BUFFER
#error "window_glfw_poll() is incompatible with event buffer mode."
#endif
-static bool window_glfw_poll(struct stl_window *window, bool block)
+static void window_glfw_poll(struct stl_window *window, bool block)
{
(void)window;
if (block) glfwWaitEvents();
else glfwPollEvents();
- return true;
}
#ifdef STELA_PAUSE
diff --git a/src/window_kms.c b/src/window_kms.c
index de3f24a..f134b2a 100644
--- a/src/window_kms.c
+++ b/src/window_kms.c
@@ -71,7 +71,7 @@ static void window_kms_toggle_fullscreen(struct stl_window *window)
}
#ifdef STELA_POLL_INLINE
-static bool window_kms_poll(struct stl_window *window, bool block)
+static void window_kms_poll(struct stl_window *window, bool block)
{
(void)window;
(void)block;
diff --git a/src/window_wayland.c b/src/window_wayland.c
index a4a31f2..2517003 100644
--- a/src/window_wayland.c
+++ b/src/window_wayland.c
@@ -1180,11 +1180,11 @@ static void window_wayland_set_decorations(struct stl_window *window, bool enabl
}
#ifdef STELA_POLL_INLINE
-static bool window_wayland_poll(struct stl_window *window, bool block)
+static void window_wayland_poll(struct stl_window *window, bool block)
{
struct stl_window_wayland *wl = (struct stl_window_wayland *)window;
display_prepare_read(wl->display);
- return stl_poll_common(&wl->w, wl->fds, block);
+ stl_poll_common(wl->fds, block);
}
#ifdef STELA_PAUSE
diff --git a/src/window_win32.c b/src/window_win32.c
index 5426f90..3d5d2e8 100644
--- a/src/window_win32.c
+++ b/src/window_win32.c
@@ -1283,7 +1283,7 @@ static void win32_handle_message(struct stl_window_win32 *w32, MSG *Message)
#ifdef STELA_EVENT_BUFFER
#error "window_win32_poll() is incompatible with event buffer mode."
#endif
-static bool window_win32_poll(struct stl_window *window, bool block)
+static void window_win32_poll(struct stl_window *window, bool block)
{
struct stl_window_win32 *w32 = (struct stl_window_win32 *)window;
if (block) {
@@ -1291,7 +1291,6 @@ static bool window_win32_poll(struct stl_window *window, bool block)
GetMessageW(&Message, 0, 0, 0);
win32_handle_message(w32, &Message);
}
- return true;
}
#ifdef STELA_PAUSE
diff --git a/src/window_x11.c b/src/window_x11.c
index 998beb4..17de7ae 100644
--- a/src/window_x11.c
+++ b/src/window_x11.c
@@ -359,10 +359,10 @@ static void window_x11_set_decorations(struct stl_window *window, bool enabled)
}
#ifdef STELA_POLL_INLINE
-static bool window_x11_poll(struct stl_window *window, bool block)
+static void window_x11_poll(struct stl_window *window, bool block)
{
struct stl_window_x11 *xw = (struct stl_window_x11 *)window;
- return stl_poll_common(&xw->w, xw->fds, block);
+ stl_poll_common(xw->fds, block);
}
#ifdef STELA_PAUSE
@@ -595,8 +595,9 @@ static void handle_next_xevent(struct stl_window_x11 *xw)
static void window_x11_process_events(struct stl_window *window)
{
struct stl_window_x11 *xw = (struct stl_window_x11 *)window;
- stl_process_events_common(&xw->w, xw->fds);
- // It seems for some reason POLLIN doesn't get set even when there are events.
+ if (stl_process_events_common(&xw->w, xw->fds)) {
+ // It appears for some reason POLLIN doesn't get set even when there are events.
+ }
XPending(global.x11_d);
while (QLength(global.x11_d) > 0) {
handle_next_xevent(xw);