Attachment "tip84.patch" to
ticket [564642ff]
added by
hobbs
2002-06-05 07:13:43.
Index: generic/tkEvent.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkEvent.c,v
retrieving revision 1.9
diff -b -u -r1.9 tkEvent.c
--- generic/tkEvent.c 5 Apr 2002 08:41:07 -0000 1.9
+++ generic/tkEvent.c 5 Jun 2002 00:13:04 -0000
@@ -1056,6 +1056,40 @@
/*
*----------------------------------------------------------------------
*
+ * 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
@@ -1095,6 +1129,19 @@
if (dispPtr->display == eventPtr->xany.display) {
break;
}
+ }
+
+ /*
+ * 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)) {
Index: generic/tkInt.h
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkInt.h,v
retrieving revision 1.44
diff -b -u -r1.44 tkInt.h
--- generic/tkInt.h 12 Apr 2002 10:06:09 -0000 1.44
+++ generic/tkInt.h 5 Jun 2002 00:13:04 -0000
@@ -493,8 +493,15 @@
* 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
Index: generic/tkWindow.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkWindow.c,v
retrieving revision 1.45
diff -b -u -r1.45 tkWindow.c
--- generic/tkWindow.c 12 Apr 2002 10:20:27 -0000 1.45
+++ generic/tkWindow.c 5 Jun 2002 00:13:04 -0000
@@ -470,6 +470,11 @@
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);
Index: generic/tk.decls
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tk.decls,v
retrieving revision 1.18
diff -b -u -r1.18 tk.decls
--- generic/tk.decls 5 Apr 2002 08:38:22 -0000 1.18
+++ generic/tk.decls 5 Jun 2002 00:13:04 -0000
@@ -1164,6 +1164,10 @@
void Tk_SetCaretPos (Tk_Window tkwin, int x, int y, int height)
}
+declare 246 generic {
+ int Tk_CollapseMotionEvents (Display *display, int collapse)
+}
+
# Define the platform specific public Tk interface. These functions are
# only available on the designated platform.
Index: generic/tkDecls.h
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkDecls.h,v
retrieving revision 1.18
diff -b -u -r1.18 tkDecls.h
--- generic/tkDecls.h 5 Apr 2002 08:38:22 -0000 1.18
+++ generic/tkDecls.h 5 Jun 2002 00:13:04 -0000
@@ -846,6 +846,9 @@
/* 245 */
EXTERN void Tk_SetCaretPos _ANSI_ARGS_((Tk_Window tkwin, int x,
int y, int height));
+/* 246 */
+EXTERN int Tk_CollapseMotionEvents _ANSI_ARGS_((
+ Display * display, int collapse));
typedef struct TkStubHooks {
struct TkPlatStubs *tkPlatStubs;
@@ -1104,6 +1107,7 @@
void (*tk_SetInternalBorderEx) _ANSI_ARGS_((Tk_Window tkwin, int left, int right, int top, int bottom)); /* 243 */
void (*tk_SetMinimumRequestSize) _ANSI_ARGS_((Tk_Window tkwin, int minWidth, int minHeight)); /* 244 */
void (*tk_SetCaretPos) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int height)); /* 245 */
+ int (*tk_CollapseMotionEvents) _ANSI_ARGS_((Display * display, int collapse)); /* 246 */
} TkStubs;
#ifdef __cplusplus
@@ -2097,6 +2101,10 @@
#ifndef Tk_SetCaretPos
#define Tk_SetCaretPos \
(tkStubsPtr->tk_SetCaretPos) /* 245 */
+#endif
+#ifndef Tk_CollapseMotionEvents
+#define Tk_CollapseMotionEvents \
+ (tkStubsPtr->tk_CollapseMotionEvents) /* 246 */
#endif
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
Index: generic/tkStubInit.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkStubInit.c,v
retrieving revision 1.33
diff -b -u -r1.33 tkStubInit.c
--- generic/tkStubInit.c 27 May 2002 19:49:32 -0000 1.33
+++ generic/tkStubInit.c 5 Jun 2002 00:13:04 -0000
@@ -887,6 +887,7 @@
Tk_SetInternalBorderEx, /* 243 */
Tk_SetMinimumRequestSize, /* 244 */
Tk_SetCaretPos, /* 245 */
+ Tk_CollapseMotionEvents, /* 246 */
};
/* !END!: Do not edit above this line. */