diff options
author | rjohnson <rjohnson> | 1998-10-10 00:30:34 (GMT) |
---|---|---|
committer | rjohnson <rjohnson> | 1998-10-10 00:30:34 (GMT) |
commit | 6b30648b424171905375ec916ab86186a3043dfc (patch) | |
tree | 5d1b6c4f80c96cbc9337259a6d98a40a78aff79b /win | |
parent | 733f2ab4691d31c0fdca72da988c5f4878ee5709 (diff) | |
download | tk-6b30648b424171905375ec916ab86186a3043dfc.zip tk-6b30648b424171905375ec916ab86186a3043dfc.tar.gz tk-6b30648b424171905375ec916ab86186a3043dfc.tar.bz2 |
Added support for the MouseWheel event.
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinX.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c index 0d776a2..50a9e24 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -5,17 +5,24 @@ * * Copyright (c) 1995-1996 Sun Microsystems, Inc. * Copyright (c) 1994 Software Research Associates, Inc. + * Copyright (c) 1998 by Scriptics Corporation. * * 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.3 1998/09/14 18:24:01 stanton Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.4 1998/10/10 00:30:37 rjohnson Exp $ */ #include "tkInt.h" #include "tkWinInt.h" /* + * The zmouse.h file includes the definition for WM_MOUSEWHEEL. + */ + +#include <zmouse.h> + +/* * Definitions of extern variables supplied by this file. */ @@ -591,6 +598,7 @@ Tk_TranslateWinEvent(hwnd, message, wParam, lParam, resultPtr) case WM_SYSKEYUP: case WM_KEYDOWN: case WM_KEYUP: + case WM_MOUSEWHEEL: GenerateXEvent(hwnd, message, wParam, lParam); return 1; case WM_MENUCHAR: @@ -698,6 +706,13 @@ GenerateXEvent(hwnd, message, wParam, lParam) event.xselectionclear.time = TkpGetMS(); 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_SYSKEYDOWN: case WM_SYSKEYUP: @@ -739,6 +754,18 @@ GenerateXEvent(hwnd, message, wParam, lParam) */ switch (message) { + case WM_MOUSEWHEEL: + /* + * We have invented a new X event type to handle + * this event. It still uses the KeyPress struct. + * However, the keycode field has been overloaded + * to hold the zDelta of the wheel. + */ + + event.type = MouseWheelEvent; + event.xany.send_event = -1; + event.xkey.keycode = (short) HIWORD(wParam); + break; case WM_SYSKEYDOWN: case WM_KEYDOWN: /* |