From 624f1dd49928a65c2cb4a940b584ac076f2142dd Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Sat, 26 Jan 2008 19:55:51 +0100 Subject: [PATCH] still more NumLock fixes, this time for scrollbars and sliders --- src/tk/tkgrab.c | 2 -- src/tk/tkint.h | 3 +++ src/tk/tkscale.c | 2 +- src/tk/tkscrbar.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tk/tkgrab.c b/src/tk/tkgrab.c index fe5cc4e..0bf8a39 100644 --- a/src/tk/tkgrab.c +++ b/src/tk/tkgrab.c @@ -498,8 +498,6 @@ TkPointerEvent(eventPtr, winPtr) int appGrabbed = 0; /* Non-zero means event is being * reported to an application that is * affected by the grab. */ -#define ALL_BUTTONS \ - (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) static unsigned int state[] = { Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask }; diff --git a/src/tk/tkint.h b/src/tk/tkint.h index a5cc780..0083e51 100644 --- a/src/tk/tkint.h +++ b/src/tk/tkint.h @@ -41,6 +41,9 @@ #define META_MASK (AnyModifier<<1) #define ALT_MASK (AnyModifier<<2) +#define ALL_BUTTONS \ + (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) + /* * One of the following structures is maintained for each display * containing a window managed by Tk: diff --git a/src/tk/tkscale.c b/src/tk/tkscale.c index 9b6e4b2..7ea2b22 100644 --- a/src/tk/tkscale.c +++ b/src/tk/tkscale.c @@ -1317,7 +1317,7 @@ ScaleMouseProc(clientData, eventPtr) eventPtr->xmotion.x, eventPtr->xmotion.y)); } else if ((eventPtr->type == ButtonPress) /* && (eventPtr->xbutton.button == Button1) */ - && (eventPtr->xbutton.state == 0)) { + && ((eventPtr->xbutton.state & ALL_BUTTONS) == 0)) { scalePtr->flags |= BUTTON_PRESSED; SetScaleValue(scalePtr, PixelToValue(scalePtr, eventPtr->xbutton.x, eventPtr->xbutton.y)); diff --git a/src/tk/tkscrbar.c b/src/tk/tkscrbar.c index 6cec27a..bb843bc 100644 --- a/src/tk/tkscrbar.c +++ b/src/tk/tkscrbar.c @@ -974,7 +974,7 @@ ScrollbarMouseProc(clientData, eventPtr) eventPtr->xmotion.y)); } } else if ((eventPtr->type == ButtonPress) - && (eventPtr->xbutton.state == 0)) { + && ((eventPtr->xbutton.state & ALL_BUTTONS) == 0)) { scrollPtr->pressField = scrollPtr->mouseField; if (scrollPtr->pressField != SLIDER) { scrollPtr->autoRepeat = Tk_CreateTimerHandler( -- 2.39.5