summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinX.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 160e141..4609a94 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinX.c,v 1.59 2008/12/10 05:02:52 das Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.60 2008/12/28 22:59:47 dkf Exp $
*/
/*
@@ -1006,10 +1006,26 @@ GenerateXEvent(
LPARAM lParam)
{
XEvent event;
- TkWindow *winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd);
+ TkWindow *winPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ if (message == WM_MOUSEWHEEL) {
+ POINTS rootPoint = MAKEPOINTS(lParam);
+ POINT pos;
+
+ /*
+ * Redirect mousewheel events to the window containing the cursor.
+ * That feels much less strange to users, and is how all the other
+ * platforms work.
+ */
+
+ pos.x = rootPoint.x;
+ pos.y = rootPoint.y;
+ hwnd = WindowFromPoint(pos);
+ }
+
+ winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
if (!winPtr || winPtr->window == None) {
return;
}
@@ -1107,11 +1123,6 @@ GenerateXEvent(
break;
case WM_MOUSEWHEEL:
- /*
- * The mouse wheel event is closer to a key event than a mouse event
- * in that the message is sent to the window that has focus.
- */
-
case WM_CHAR:
case WM_UNICHAR:
case WM_SYSKEYDOWN: