summaryrefslogtreecommitdiffstats
path: root/generic/tkEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkEvent.c')
-rw-r--r--generic/tkEvent.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 009e2f5..954f24c 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkEvent.c,v 1.16 2002/06/19 19:37:54 mdejong Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.17 2003/02/18 06:22:44 mdejong Exp $
*/
#include "tkPort.h"
@@ -645,6 +645,7 @@ Tk_HandleEvent(eventPtr)
if (eventPtr->type==ButtonPress) {
dispPtr = TkGetDisplay(eventPtr->xbutton.display);
+ dispPtr->mouseButtonWindow = eventPtr->xbutton.window;
eventPtr->xbutton.state |= dispPtr->mouseButtonState;
switch (eventPtr->xbutton.button) {
case 1: dispPtr->mouseButtonState |= Button1Mask; break;
@@ -653,6 +654,7 @@ Tk_HandleEvent(eventPtr)
}
} else if (eventPtr->type==ButtonRelease) {
dispPtr = TkGetDisplay(eventPtr->xbutton.display);
+ dispPtr->mouseButtonWindow = 0;
switch (eventPtr->xbutton.button) {
case 1: dispPtr->mouseButtonState &= ~Button1Mask; break;
case 2: dispPtr->mouseButtonState &= ~Button2Mask; break;
@@ -661,7 +663,20 @@ Tk_HandleEvent(eventPtr)
eventPtr->xbutton.state |= dispPtr->mouseButtonState;
} else if (eventPtr->type==MotionNotify) {
dispPtr = TkGetDisplay(eventPtr->xmotion.display);
- eventPtr->xmotion.state |= dispPtr->mouseButtonState;
+ if (dispPtr->mouseButtonState & (Button1Mask|Button2Mask|Button3Mask)) {
+ if (eventPtr->xbutton.window != dispPtr->mouseButtonWindow) {
+ /*
+ * This motion event should not be interpreted as a button
+ * press + motion event since this is not the same window
+ * the button was pressed down in.
+ */
+ dispPtr->mouseButtonState &=
+ ~(Button1Mask|Button2Mask|Button3Mask);
+ dispPtr->mouseButtonWindow = 0;
+ } else {
+ eventPtr->xmotion.state |= dispPtr->mouseButtonState;
+ }
+ }
}
/*