From 05d819bf152fbd1e750eea79ce2c0abcb8a14e48 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Thu, 14 May 2026 16:51:03 +0200 Subject: [PATCH] WINGs: add flush vtable entry, remove XFlush from wbutton.c Add flush() to W_ViewBackend. X11 backend calls XFlush, Wayland backend is a no-op (compositing happens at frame boundaries). wbutton.c WMPerformButtonClick now uses the vtable. --- WINGs/WINGs/WINGsP.h.in | 3 +++ WINGs/wbutton.c | 2 +- WINGs/wview_wl.c | 6 ++++++ WINGs/wview_x11.c | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/WINGs/WINGs/WINGsP.h.in b/WINGs/WINGs/WINGsP.h.in index a8c9a76..14cbdb3 100644 --- a/WINGs/WINGs/WINGsP.h.in +++ b/WINGs/WINGs/WINGsP.h.in @@ -618,6 +618,9 @@ typedef struct W_ViewBackend { /* Get screen position (for views that support it) */ WMPoint (*get_screen_position)(void *vctx, struct W_View *view); + + /* Flush pending display output */ + void (*flush)(void *vctx); } W_ViewBackend; extern const W_ViewBackend W_ViewBackendX11; diff --git a/WINGs/wbutton.c b/WINGs/wbutton.c index 8a3e094..fe045aa 100644 --- a/WINGs/wbutton.c +++ b/WINGs/wbutton.c @@ -459,7 +459,7 @@ void WMPerformButtonClick(WMButton * bPtr) if (bPtr->view->flags.mapped) { paintButton(bPtr); - XFlush(WMScreenDisplay(WMWidgetScreen(bPtr))); + bPtr->view->screen->viewBackend->flush(bPtr->view->screen->viewBackendCtx); wusleep(20000); } diff --git a/WINGs/wview_wl.c b/WINGs/wview_wl.c index 6207f6e..6a25f02 100644 --- a/WINGs/wview_wl.c +++ b/WINGs/wview_wl.c @@ -297,6 +297,11 @@ static void wl_selection_release(void *vctx, W_View *view, Atom selection) (void)vctx; (void)view; (void)selection; } +static void wl_flush(void *vctx) +{ + (void)vctx; +} + const W_ViewBackend W_ViewBackendWL = { .screen_init = wl_screen_init, .screen_fini = wl_screen_fini, @@ -319,4 +324,5 @@ const W_ViewBackend W_ViewBackendWL = { .selection_acquire = wl_selection_acquire, .selection_release = wl_selection_release, .platform_init = NULL, + .flush = wl_flush, }; diff --git a/WINGs/wview_x11.c b/WINGs/wview_x11.c index 669dbd2..f28034d 100644 --- a/WINGs/wview_x11.c +++ b/WINGs/wview_x11.c @@ -205,6 +205,12 @@ static void x11_selection_release(void *vctx, W_View *view, Atom selection) (void)vctx; (void)view; (void)selection; } +static void x11_flush(void *vctx) +{ + W_Screen *scr = (W_Screen *)vctx; + XFlush(scr->display); +} + const W_ViewBackend W_ViewBackendX11 = { .screen_init = x11_screen_init, .screen_fini = x11_screen_fini, @@ -227,4 +233,5 @@ const W_ViewBackend W_ViewBackendX11 = { .selection_acquire = x11_selection_acquire, .selection_release = x11_selection_release, .platform_init = W_X11PlatformInit, + .flush = x11_flush, };