fix: slider page-click uses event->u.motion.x/y instead of button.x/y on Wayland
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.
This commit is contained in:
parent
e417682ed4
commit
2eef17de24
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue