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 | |
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')
-rw-r--r-- | generic/tk.decls | 6 | ||||
-rw-r--r-- | generic/tkDecls.h | 10 | ||||
-rw-r--r-- | generic/tkEvent.c | 49 | ||||
-rw-r--r-- | generic/tkInt.h | 9 | ||||
-rw-r--r-- | generic/tkStubInit.c | 3 | ||||
-rw-r--r-- | generic/tkWindow.c | 7 |
6 files changed, 78 insertions, 6 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index d3a7866..317baca 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -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: tk.decls,v 1.20 2002/06/14 14:07:50 dkf Exp $ +# RCS: @(#) $Id: tk.decls,v 1.21 2002/06/15 00:21:41 hobbs Exp $ library tk @@ -1176,6 +1176,10 @@ declare 247 generic { int subsampleX, int subsampleY, int compRule) } +declare 248 generic { + int Tk_CollapseMotionEvents (Display *display, int collapse) +} + # Define the platform specific public Tk interface. These functions are # only available on the designated platform. diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 431b284..8c7daa4 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkDecls.h,v 1.20 2002/06/14 14:08:22 dkf Exp $ + * RCS: @(#) $Id: tkDecls.h,v 1.21 2002/06/15 00:21:41 hobbs Exp $ */ #ifndef _TKDECLS @@ -857,6 +857,9 @@ EXTERN void Tk_PhotoPutZoomedBlock _ANSI_ARGS_(( Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule)); +/* 248 */ +EXTERN int Tk_CollapseMotionEvents _ANSI_ARGS_(( + Display * display, int collapse)); typedef struct TkStubHooks { struct TkPlatStubs *tkPlatStubs; @@ -1117,6 +1120,7 @@ typedef struct TkStubs { void (*tk_SetCaretPos) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int height)); /* 245 */ void (*tk_PhotoPutBlock) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int compRule)); /* 246 */ void (*tk_PhotoPutZoomedBlock) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule)); /* 247 */ + int (*tk_CollapseMotionEvents) _ANSI_ARGS_((Display * display, int collapse)); /* 248 */ } TkStubs; #ifdef __cplusplus @@ -2119,6 +2123,10 @@ extern TkStubs *tkStubsPtr; #define Tk_PhotoPutZoomedBlock \ (tkStubsPtr->tk_PhotoPutZoomedBlock) /* 247 */ #endif +#ifndef Tk_CollapseMotionEvents +#define Tk_CollapseMotionEvents \ + (tkStubsPtr->tk_CollapseMotionEvents) /* 248 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ 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)) { diff --git a/generic/tkInt.h b/generic/tkInt.h index 75ac87f..0849d7e 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -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: tkInt.h,v 1.44 2002/04/12 10:06:09 hobbs Exp $ + * RCS: $Id: tkInt.h,v 1.45 2002/06/15 00:21:42 hobbs Exp $ */ #ifndef _TKINT @@ -493,8 +493,15 @@ typedef struct TkDisplay { * The following field(s) were all added for Tk8.4 */ long deletionEpoch; /* Incremented by window deletions */ + unsigned int flags; /* Various flag values: these are all + * defined in below. */ } TkDisplay; +/* + * Flag values for TkDisplay flags. + */ + +#define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0) /* * One of the following structures exists for each error handler diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index dafa12d..43a081f 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.35 2002/06/14 14:08:23 dkf Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.36 2002/06/15 00:21:42 hobbs Exp $ */ #include "tkInt.h" @@ -898,6 +898,7 @@ TkStubs tkStubs = { Tk_SetCaretPos, /* 245 */ Tk_PhotoPutBlock, /* 246 */ Tk_PhotoPutZoomedBlock, /* 247 */ + Tk_CollapseMotionEvents, /* 248 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 5c1fd17..6bee9fa 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWindow.c,v 1.46 2002/06/14 22:25:12 jenglish Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.47 2002/06/15 00:21:42 hobbs Exp $ */ #include "tkPort.h" @@ -470,6 +470,11 @@ GetScreen(interp, screenName, screenPtr) dispPtr->cursorFont = None; dispPtr->warpWindow = None; dispPtr->multipleAtom = None; + /* + * By default we do want to collapse motion events in + * Tk_QueueWindowEvent. + */ + dispPtr->flags |= TK_DISPLAY_COLLAPSE_MOTION_EVENTS; Tcl_InitHashTable(&dispPtr->winTable, TCL_ONE_WORD_KEYS); |