From 9757623d3c28996363f630008e20699981b670f4 Mon Sep 17 00:00:00 2001 From: IoI_xD Date: Tue, 24 Mar 2026 23:24:20 -0700 Subject: [PATCH] make always_render a global variable, MwWaylandAlwaysRender --- include/Mw/LowLevel/Wayland.h | 4 +--- src/backend/wayland.c | 11 ++++++----- src/widget/opengl.c | 11 +++-------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index 7788261..95e84eb 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -127,7 +127,7 @@ typedef struct wayland_call_table { } wayland_call_table_t; extern wayland_call_table_t wl_call_tbl; - +extern MwBool MwWaylandAlwaysRender; /* defined inline right here so that it doesn't conflict with the other macros */ MwInline int wayland_load_funcs() { wl_call_tbl.lib = MwDynamicOpen("libwayland-client.so"); @@ -405,8 +405,6 @@ struct _MwLLWayland { wayland_protocol_t* value; }* wl_protocol_map; - MwBool always_render; - MwBool has_decorations; char title[255]; diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 26b3591..5e4e767 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -20,6 +20,7 @@ #endif wayland_call_table_t wl_call_tbl; +MwBool MwWaylandAlwaysRender = MwFALSE; /* Standard procedure before most event callbacks in Wayland ("most" because the setup ones don't need this). Wait for the Mutex to be freed, if we're deadlocking for longer then a quarter of a second then do nothing with the event. */ #define WAYLAND_EVENT_OP_START(self) \ @@ -770,7 +771,7 @@ static void keyboard_key(void* data, } } - if(!self->wayland.always_render) { + if(!MwWaylandAlwaysRender) { MwLLDispatch(self, draw, NULL); } @@ -1999,17 +2000,17 @@ static int MwLLPendingImpl(MwLL handle) { handle->wayland.did_initial_resize = 1; } - if(!handle->wayland.always_render) wl_display_prepare_read(handle->wayland.display); + if(!MwWaylandAlwaysRender) wl_display_prepare_read(handle->wayland.display); if(!poll(&fd, 1, timeout.tv_nsec)) { wl_display_cancel_read(handle->wayland.display); } else { - if(!handle->wayland.always_render) wl_display_read_events(handle->wayland.display); + if(!MwWaylandAlwaysRender) wl_display_read_events(handle->wayland.display); if((pending = wl_display_dispatch_pending(handle->wayland.display)) < 0) { wl_display_cancel_read(handle->wayland.display); } } - if(handle->wayland.always_render) { + if(MwWaylandAlwaysRender) { handle->wayland.did_event_loop_early = MwTRUE; event_loop(handle); return pending; @@ -2024,7 +2025,7 @@ static int MwLLPendingImpl(MwLL handle) { } static void MwLLNextEventImpl(MwLL handle) { - if(!handle->wayland.always_render) { + if(!MwWaylandAlwaysRender) { if(handle->wayland.did_event_loop_early) { handle->wayland.did_event_loop_early = MwFALSE; } else { diff --git a/src/widget/opengl.c b/src/widget/opengl.c index 59e3a40..0afbe9a 100644 --- a/src/widget/opengl.c +++ b/src/widget/opengl.c @@ -205,14 +205,9 @@ static int create(MwWidget handle) { 1, EGL_NONE}; EGLDisplay display; - waylandopengl_t* o = r = malloc(sizeof(*o)); - MwLL topmost_parent = handle->lowlevel->wayland.parent; - handle->lowlevel->wayland.always_render = MwTRUE; - - while(topmost_parent->wayland.parent != NULL) { - topmost_parent->wayland.always_render = MwTRUE; - topmost_parent = topmost_parent->wayland.parent; - } + waylandopengl_t* o = r = malloc(sizeof(*o)); + MwLL topmost_parent = handle->lowlevel->wayland.parent; + MwWaylandAlwaysRender = MwTRUE; o->gllib = MwDynamicOpen("libEGL.so"); if(!o->gllib) {