summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-12-28 22:59:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-12-28 22:59:47 (GMT)
commit0a5d0843c169cfee7963b1feb685c3df23fed7c5 (patch)
tree7cd3c101d33a8fda6d4de37149c484975c458fd3 /win/tkWinX.c
parent474bd9cda9c65a64819dd2992b1eb7cf3de2ca24 (diff)
downloadtk-0a5d0843c169cfee7963b1feb685c3df23fed7c5.zip
tk-0a5d0843c169cfee7963b1feb685c3df23fed7c5.tar.gz
tk-0a5d0843c169cfee7963b1feb685c3df23fed7c5.tar.bz2
TIP#171 implementation - sanity for <MouseWheel> event handling!
Diffstat (limited to 'win/tkWinX.c')
-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: