summaryrefslogtreecommitdiffstats
path: root/generic/tkBind.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-02-18 02:17:18 (GMT)
committerhobbs <hobbs>2004-02-18 02:17:18 (GMT)
commit88a41b518bc46f423b68d2062d3efb1530ae1cda (patch)
treea42f1e1f67bd6286804355e6015cfa5c37274a98 /generic/tkBind.c
parentc2e084899ebb336c2d7a02a59efa39ac42d78ba4 (diff)
downloadtk-88a41b518bc46f423b68d2062d3efb1530ae1cda.zip
tk-88a41b518bc46f423b68d2062d3efb1530ae1cda.tar.gz
tk-88a41b518bc46f423b68d2062d3efb1530ae1cda.tar.bz2
* generic/tkBind.c (HandleEventGenerate): only modify root[xy]
with [xy] when they haven't been otherwise set.
Diffstat (limited to 'generic/tkBind.c')
-rw-r--r--generic/tkBind.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index d77718a..13e6cea 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.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: tkBind.c,v 1.28 2003/02/28 15:55:33 dkf Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.28.2.1 2004/02/18 02:17:18 hobbs Exp $
*/
#include "tkPort.h"
@@ -3406,6 +3406,11 @@ HandleEventGenerate(interp, mainWin, objc, objv)
event.xcreatewindow.window = event.xany.window;
}
+ if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
+ event.xkey.x_root = -1;
+ event.xkey.y_root = -1;
+ }
+
/*
* Process the remaining arguments to fill in additional fields
* of the event.
@@ -3771,17 +3776,21 @@ HandleEventGenerate(interp, mainWin, objc, objv)
break;
}
case EVENT_X: {
- int rootX, rootY;
-
if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number)
!= TCL_OK) {
return TCL_ERROR;
}
- Tk_GetRootCoords(tkwin, &rootX, &rootY);
- rootX += number;
if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
event.xkey.x = number;
- event.xkey.x_root = rootX;
+ /*
+ * Only modify rootx as well if it hasn't been changed.
+ */
+ if (event.xkey.x_root == -1) {
+ int rootX, rootY;
+
+ Tk_GetRootCoords(tkwin, &rootX, &rootY);
+ event.xkey.x_root = rootX + number;
+ }
} else if (flags & EXPOSE) {
event.xexpose.x = number;
} else if (flags & (CREATE|CONFIG|GRAVITY)) {
@@ -3794,17 +3803,21 @@ HandleEventGenerate(interp, mainWin, objc, objv)
break;
}
case EVENT_Y: {
- int rootX, rootY;
-
if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number)
!= TCL_OK) {
return TCL_ERROR;
}
- Tk_GetRootCoords(tkwin, &rootX, &rootY);
- rootY += number;
if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
event.xkey.y = number;
- event.xkey.y_root = rootY;
+ /*
+ * Only modify rooty as well if it hasn't been changed.
+ */
+ if (event.xkey.y_root == -1) {
+ int rootX, rootY;
+
+ Tk_GetRootCoords(tkwin, &rootX, &rootY);
+ event.xkey.y_root = rootY + number;
+ }
} else if (flags & EXPOSE) {
event.xexpose.y = number;
} else if (flags & (CREATE|CONFIG|GRAVITY)) {