diff options
author | dkf <dkf@noemail.net> | 2008-12-28 22:59:47 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2008-12-28 22:59:47 (GMT) |
commit | e1f4e434397a66223cf6265b4b0a134128c6c65f (patch) | |
tree | 7cd3c101d33a8fda6d4de37149c484975c458fd3 /win/tkWinX.c | |
parent | 369b80f8e5b97390dac2e16f91477d2c167cbd07 (diff) | |
download | tk-e1f4e434397a66223cf6265b4b0a134128c6c65f.zip tk-e1f4e434397a66223cf6265b4b0a134128c6c65f.tar.gz tk-e1f4e434397a66223cf6265b4b0a134128c6c65f.tar.bz2 |
TIP#171 implementation - sanity for <MouseWheel> event handling!
FossilOrigin-Name: da1b92466b00755b637abcefff167817f0240a69
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r-- | win/tkWinX.c | 25 |
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: |