diff options
-rw-r--r-- | doc/BindTable.3 | 2 | ||||
-rw-r--r-- | generic/tk.decls | 2 | ||||
-rw-r--r-- | generic/tkBind.c | 47 | ||||
-rw-r--r-- | generic/tkCanvas.c | 6 | ||||
-rw-r--r-- | generic/tkCmds.c | 2 | ||||
-rw-r--r-- | generic/tkDecls.h | 4 | ||||
-rw-r--r-- | generic/tkTextTag.c | 6 |
7 files changed, 36 insertions, 33 deletions
diff --git a/doc/BindTable.3 b/doc/BindTable.3 index 18a9ea2..5130bfc 100644 --- a/doc/BindTable.3 +++ b/doc/BindTable.3 @@ -19,7 +19,7 @@ Tk_BindingTable .sp \fBTk_DeleteBindingTable(\fIbindingTable\fB)\fR .sp -Mask +unsigned long \fBTk_CreateBinding(\fIinterp, bindingTable, object, eventString, script, append\fB)\fR .sp int diff --git a/generic/tk.decls b/generic/tk.decls index f33ebc3..9ceb3af 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -163,7 +163,7 @@ declare 32 { Tk_Window Tk_CoordsToWindow(int rootX, int rootY, Tk_Window tkwin) } declare 33 { - Mask Tk_CreateBinding(Tcl_Interp *interp, + unsigned long Tk_CreateBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr, const char *script, int append) } diff --git a/generic/tkBind.c b/generic/tkBind.c index ff00cb0..2f910e9 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -148,10 +148,13 @@ typedef struct { * We need a structure providing a list of pattern sequences. */ +typedef unsigned EventMask; +typedef unsigned long ModMask; + struct PatSeq; /* forward declaration */ /* We need this array for bookkeeping the last matching modifier mask per pattern. */ -TK_ARRAY_DEFINE(PSModMaskArr, Mask); +TK_ARRAY_DEFINE(PSModMaskArr, ModMask); typedef struct PSEntry { TK_DLIST_LINKS(PSEntry); /* Makes this struct a double linked list; must be first entry. */ @@ -207,7 +210,7 @@ typedef struct Tk_BindingTable_ { /* Containing the most recent event for every event type. */ PromArr *promArr; /* Contains the promoted pattern sequences. */ Event *curEvent; /* Pointing to most recent event. */ - Mask curModMask; /* Containing the current modifier mask. */ + ModMask curModMask; /* Containing the current modifier mask. */ LookupTables lookupTables; /* Containing hash tables for fast lookup. */ Tcl_HashTable objectTable; /* Used to map from an object to a list of patterns associated with * that object. Keys are ClientData, values are (PatSeq *). */ @@ -269,7 +272,7 @@ typedef struct { typedef struct { unsigned eventType; /* Type of X event, e.g. ButtonPress. */ unsigned count; /* Multi-event count, e.g. double-clicks, triple-clicks, etc. */ - Mask modMask; /* Mask of modifiers that must be present (zero means no modifiers + ModMask modMask; /* Mask of modifiers that must be present (zero means no modifiers * are required). */ Info info; /* Additional information that must match event. Normally this is zero, * meaning no additional information must match. For KeyPress and @@ -712,7 +715,7 @@ static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPt unsigned scriptCount, Tcl_DString *dsPtr); static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables, ClientData object, const char *eventString, bool create, - bool allowVirtual, Mask *maskPtr); + bool allowVirtual, EventMask *maskPtr); static void GetAllVirtualEvents(Tcl_Interp *interp, VirtualEventTable *vetPtr); static const char * GetField(const char *p, char *copy, unsigned size); static Tcl_Obj * GetPatternObj(const PatSeq *psPtr); @@ -728,7 +731,7 @@ static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSLi static bool NameToWindow(Tcl_Interp *interp, Tk_Window main, Tcl_Obj *objPtr, Tk_Window *tkwinPtr); static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr, - TkPattern *patPtr, Mask *eventMaskPtr); + TkPattern *patPtr, EventMask *eventMaskPtr); static void DoWarp(ClientData clientData); static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr, Tcl_Obj *object, bool onlyConsiderDetailedEvents); @@ -760,8 +763,8 @@ static bool TestNearbyCoords(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY static bool IsSubsetOf( - Mask lhsMask, /* this is a subset */ - Mask rhsMask) /* of this bit field? */ + ModMask lhsMask, /* this is a subset */ + ModMask rhsMask) /* of this bit field? */ { return (lhsMask & rhsMask) == lhsMask; } @@ -1603,7 +1606,7 @@ InsertPatSeq( *-------------------------------------------------------------- */ -Mask +unsigned long Tk_CreateBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to create binding. */ @@ -1616,7 +1619,7 @@ Tk_CreateBinding( * existing binding will always be replaced. */ { PatSeq *psPtr; - Mask eventMask; + EventMask eventMask; char *oldStr; char *newStr; @@ -2713,8 +2716,8 @@ static bool CompareModMasks( const PSModMaskArr *fstModMaskArr, const PSModMaskArr *sndModMaskArr, - Mask fstModMask, - Mask sndModMask) + ModMask fstModMask, + ModMask sndModMask) { int fstCount = 0; int sndCount = 0; @@ -2738,8 +2741,8 @@ CompareModMasks( assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr)); for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) { - Mask fstModMask = *PSModMaskArr_Get(fstModMaskArr, i); - Mask sndModMask = *PSModMaskArr_Get(sndModMaskArr, i); + ModMask fstModMask = *PSModMaskArr_Get(fstModMaskArr, i); + ModMask sndModMask = *PSModMaskArr_Get(sndModMaskArr, i); if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; } if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; } @@ -2770,7 +2773,7 @@ MatchPatterns( PSEntry *psEntry; PatSeq *bestPtr; PatSeq *bestPhysPtr; - Mask bestModMask; + ModMask bestModMask; const PSModMaskArr *bestModMaskArr; assert(dispPtr); @@ -2810,8 +2813,8 @@ MatchPatterns( * cannot be done in ParseEventDescription, otherwise this function would * be the better place. */ - Mask modMask = ResolveModifiers(dispPtr, patPtr->modMask); - Mask curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask); + ModMask modMask = ResolveModifiers(dispPtr, patPtr->modMask); + ModMask curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask); psEntry->expired = true; /* remove it from promotion list */ @@ -3811,7 +3814,7 @@ HandleEventGenerate( Tk_Window tkwin; Tk_Window tkwin2; TkWindow *mainPtr; - Mask eventMask; + EventMask eventMask; Tcl_Obj *userDataObj; bool synch; bool warp; @@ -4590,7 +4593,7 @@ FindSequence( * True means create. */ bool allowVirtual, /* False means that virtual events are not allowed in the sequence. * True otherwise. */ - Mask *maskPtr) /* *maskPtr is filled in with the event types on which this + EventMask *maskPtr) /* *maskPtr is filled in with the event types on which this * pattern sequence depends. */ { unsigned patsBufSize = 1; @@ -4604,8 +4607,8 @@ FindSequence( bool isNew; unsigned count; unsigned maxCount = 0; - Mask eventMask = 0; - Mask modMask = 0; + EventMask eventMask = 0; + ModMask modMask = 0; PatternTableKey key; assert(lookupTables); @@ -4779,10 +4782,10 @@ ParseEventDescription( const char **eventStringPtr,/* On input, holds a pointer to start of event string. On exit, * gets pointer to rest of string after parsed event. */ TkPattern *patPtr, /* Filled with the pattern parsed from the event string. */ - Mask *eventMaskPtr) /* Filled with event mask of matched event. */ + EventMask *eventMaskPtr) /* Filled with event mask of matched event. */ { const char *p; - Mask eventMask = 0; + EventMask eventMask = 0; unsigned count = 1; assert(eventStringPtr); diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index bb8f138..16f46d7 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -977,7 +977,7 @@ CanvasWidgetCmd( if (objc == 5) { int append = 0; - Mask mask; + unsigned long mask; const char *argv4 = Tcl_GetString(objv[4]); if (argv4[0] == 0) { @@ -1027,7 +1027,7 @@ CanvasWidgetCmd( result = TCL_ERROR; goto done; } - if (mask & (Mask) ~(ButtonMotionMask|Button1MotionMask + if (mask & (unsigned long) ~(ButtonMotionMask|Button1MotionMask |Button2MotionMask|Button3MotionMask|Button4MotionMask |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask @@ -4747,7 +4747,7 @@ CanvasBindProc( XEvent *eventPtr) /* Pointer to X event that just happened. */ { TkCanvas *canvasPtr = clientData; - Mask mask; + unsigned long mask; Tcl_Preserve(canvasPtr); diff --git a/generic/tkCmds.c b/generic/tkCmds.c index b998dfd..a64d2e1 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -200,7 +200,7 @@ Tk_BindObjCmd( if (objc == 4) { int append = 0; - Mask mask; + unsigned long mask; const char *sequence = Tcl_GetString(objv[2]); const char *script = Tcl_GetString(objv[3]); diff --git a/generic/tkDecls.h b/generic/tkDecls.h index c455030..64c32cd 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -148,7 +148,7 @@ EXTERN Tk_TextLayout Tk_ComputeTextLayout(Tk_Font font, const char *str, EXTERN Tk_Window Tk_CoordsToWindow(int rootX, int rootY, Tk_Window tkwin); /* 33 */ -EXTERN Mask Tk_CreateBinding(Tcl_Interp *interp, +EXTERN unsigned long Tk_CreateBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr, const char *script, int append); @@ -909,7 +909,7 @@ typedef struct TkStubs { void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, int numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */ - Mask (*tk_CreateBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr, const char *script, int append); /* 33 */ + unsigned long (*tk_CreateBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr, const char *script, int append); /* 33 */ Tk_BindingTable (*tk_CreateBindingTable) (Tcl_Interp *interp); /* 34 */ Tk_ErrorHandler (*tk_CreateErrorHandler) (Display *display, int errNum, int request, int minorCode, Tk_ErrorProc *errorProc, ClientData clientData); /* 35 */ void (*tk_CreateEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, ClientData clientData); /* 36 */ diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 40ea7ab..56e6c71 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -273,7 +273,7 @@ TkTextTagCmd( if (objc == 6) { int append = 0; - Mask mask; + unsigned long mask; const char *fifth = Tcl_GetString(objv[5]); if (fifth[0] == 0) { @@ -292,7 +292,7 @@ TkTextTagCmd( if (mask == 0) { return TCL_ERROR; } - if (mask & (Mask) ~(ButtonMotionMask|Button1MotionMask + if (mask & (unsigned long) ~(ButtonMotionMask|Button1MotionMask |Button2MotionMask|Button3MotionMask|Button4MotionMask |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask @@ -1460,7 +1460,7 @@ TkTextBindProc( if (eventPtr->type == ButtonPress) { textPtr->flags |= BUTTON_DOWN; } else if (eventPtr->type == ButtonRelease) { - Mask mask; + unsigned long mask; switch (eventPtr->xbutton.button) { case Button1: |