diff options
author | hobbs <hobbs> | 2002-06-15 00:21:41 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-06-15 00:21:41 (GMT) |
commit | 5c1e5bf298b329ec7a45cd601f6b4b208b24411b (patch) | |
tree | 25e00fe02d0a56b2865927347847b8561353fd94 /generic/tkEvent.c | |
parent | 36d7ac0a1dfb49f2c05b66ff69dfc5cfabf3ebb6 (diff) | |
download | tk-5c1e5bf298b329ec7a45cd601f6b4b208b24411b.zip tk-5c1e5bf298b329ec7a45cd601f6b4b208b24411b.tar.gz tk-5c1e5bf298b329ec7a45cd601f6b4b208b24411b.tar.bz2 |
* generic/tk.decls: added TIP #84 implementation that adds a
* generic/tkDecls.h: Tk_CollapseMotionEvents API which controls
* generic/tkEvent.c: Tk's collapsing of incoming motion events
* generic/tkInt.h: on its windows. The default remains to do
* generic/tkStubInit.c: collapsing. Added a flags parameter to the
* generic/tkWindow.c: internal display structure to support this
* doc/QWinEvent.3: and be used in the future for other bits.
Diffstat (limited to 'generic/tkEvent.c')
-rw-r--r-- | generic/tkEvent.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 68887f1..8ceb358 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.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: tkEvent.c,v 1.11 2002/06/14 23:49:13 mdejong Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.12 2002/06/15 00:21:42 hobbs Exp $ */ #include "tkPort.h" @@ -1171,6 +1171,40 @@ Tk_RestrictEvents(proc, arg, prevArgPtr) /* *---------------------------------------------------------------------- * + * Tk_CollapseMotionEvents -- + * + * This procedure controls whether we collapse motion events in a + * particular display or not. + * + * Results: + * The return value is the previous collapse value in effect. + * + * Side effects: + * Filtering of motion events may be changed after calling this. + * + *---------------------------------------------------------------------- + */ + +int +Tk_CollapseMotionEvents(display, collapse) + Display *display; /* Display handling these events. */ + int collapse; /* boolean value that specifies whether + * motion events should be collapsed. */ +{ + TkDisplay *dispPtr = (TkDisplay *) display; + int prev = (dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS); + + if (collapse) { + dispPtr->flags |= TK_DISPLAY_COLLAPSE_MOTION_EVENTS; + } else { + dispPtr->flags &= ~TK_DISPLAY_COLLAPSE_MOTION_EVENTS; + } + return prev; +} + +/* + *---------------------------------------------------------------------- + * * Tk_QueueWindowEvent -- * * Given an X-style window event, this procedure adds it to the @@ -1212,6 +1246,19 @@ Tk_QueueWindowEvent(eventPtr, position) } } + /* + * Don't filter motion events if the user + * defaulting to true (1), which could be set to false (0) when the + * user wishes to receive all the motion data) + */ + if (!(dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS)) { + wevPtr = (TkWindowEvent *) ckalloc(sizeof(TkWindowEvent)); + wevPtr->header.proc = WindowEventProc; + wevPtr->event = *eventPtr; + Tcl_QueueEvent(&wevPtr->header, position); + return; + } + if ((dispPtr->delayedMotionPtr != NULL) && (position == TCL_QUEUE_TAIL)) { if ((eventPtr->type == MotionNotify) && (eventPtr->xmotion.window == dispPtr->delayedMotionPtr->event.xmotion.window)) { |