From 2eef17de240f8cc829489747166af991df822dc2 Mon Sep 17 00:00:00 2001 From: Ollie Date: Sat, 30 May 2026 13:31:50 +0200 Subject: [PATCH] fix: slider page-click uses event->u.motion.x/y instead of button.x/y on Wayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WMEButton and WMEMotion are separate structs in the WMEvent union with different field layouts — u.motion.x is at a different memory offset than u.button.x. The WME_BUTTON_PRESS handler in wslider.c was calling valueForMousePoint(sPtr, event->u.motion.x, event->u.motion.y) which reads uninitialized memory on Wayland (memset zero = 0). On X11 this happened to work because the X11 event translator writes to both union members. Fix: changed all event->u.motion.x/y references to event->u.button.x/y in the WME_BUTTON_PRESS case. --- WINGs/wslider.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WINGs/wslider.c b/WINGs/wslider.c index 4efdb59..82ab30e 100644 --- a/WINGs/wslider.c +++ b/WINGs/wslider.c @@ -436,7 +436,7 @@ static void handleActionEvents(WMEvent * event, void *data) #ifdef STRICT_NEXT_BEHAVIOUR sPtr->flags.dragging = 1; - sPtr->value = valueForMousePoint(sPtr, event->u.motion.x, event->u.motion.y); + sPtr->value = valueForMousePoint(sPtr, event->u.button.x, event->u.button.y); paintSlider(sPtr); #else int tmp; @@ -444,10 +444,10 @@ static void handleActionEvents(WMEvent * event, void *data) if (event->u.button.button == Button2) { sPtr->flags.dragging = 1; - sPtr->value = valueForMousePoint(sPtr, event->u.motion.x, event->u.motion.y); + sPtr->value = valueForMousePoint(sPtr, event->u.button.x, event->u.button.y); paintSlider(sPtr); } else { - tmp = valueForMousePoint(sPtr, event->u.motion.x, event->u.motion.y); + tmp = valueForMousePoint(sPtr, event->u.button.x, event->u.button.y); if (tmp < sPtr->value) tmp = sPtr->value - 1; else @@ -471,7 +471,7 @@ static void handleActionEvents(WMEvent * event, void *data) case WME_MOTION: if (sPtr->flags.dragging) { - sPtr->value = valueForMousePoint(sPtr, event->u.motion.x, event->u.motion.y); + sPtr->value = valueForMousePoint(sPtr, event->u.button.x, event->u.button.y); paintSlider(sPtr); if (sPtr->flags.continuous && sPtr->action) {