diff options
-rw-r--r-- | generic/tkBind.c | 61 | ||||
-rw-r--r-- | generic/tkCanvas.c | 2 | ||||
-rw-r--r-- | generic/tkEvent.c | 6 | ||||
-rw-r--r-- | generic/tkInt.h | 2 | ||||
-rw-r--r-- | generic/tkPointer.c | 5 |
5 files changed, 35 insertions, 41 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index d00fc7c..c87d8dd 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -137,17 +137,10 @@ typedef struct { * this count considers the detail (keySym or button). */ } Event; -/* - * 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, ModMask); +TK_ARRAY_DEFINE(PSModMaskArr, unsigned); typedef struct PSEntry { TK_DLIST_LINKS(PSEntry); /* Makes this struct a double linked list; must be first entry. */ @@ -203,7 +196,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. */ - ModMask curModMask; /* Containing the current modifier mask. */ + unsigned 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 *). */ @@ -265,7 +258,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. */ - ModMask modMask; /* Mask of modifiers that must be present (zero means no modifiers + unsigned 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 @@ -416,7 +409,7 @@ static Tcl_HashTable nameTable; /* keyArray hashed by keysym name. */ typedef struct { const char *name; /* Name of modifier. */ - ModMask mask; /* Button/modifier mask value, such as Button1Mask. */ + unsigned mask; /* Button/modifier mask value, such as Button1Mask. */ unsigned flags; /* Various flags; see below for definitions. */ } ModInfo; @@ -721,7 +714,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, int create, - int allowVirtual, EventMask *maskPtr); + int allowVirtual, unsigned *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); @@ -737,7 +730,7 @@ static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSLi static int NameToWindow(Tcl_Interp *interp, Tk_Window main, Tcl_Obj *objPtr, Tk_Window *tkwinPtr); static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr, - TkPattern *patPtr, EventMask *eventMaskPtr); + TkPattern *patPtr, unsigned *eventMaskPtr); static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr, Tcl_Obj *object, int onlyConsiderDetailedEvents); static void ClearLookupTable(LookupTables *lookupTables, ClientData object); @@ -768,8 +761,8 @@ static int TestNearbyCoords(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_ static int IsSubsetOf( - ModMask lhsMask, /* this is a subset */ - ModMask rhsMask) /* of this bit field? */ + unsigned lhsMask, /* this is a subset */ + unsigned rhsMask) /* of this bit field? */ { return (lhsMask & rhsMask) == lhsMask; } @@ -976,13 +969,13 @@ ResolveModifiers( if (dispPtr->metaModMask) { if (modMask & META_MASK) { - modMask &= ~(ModMask)META_MASK; + modMask &= ~META_MASK; modMask |= dispPtr->metaModMask; } } if (dispPtr->altModMask) { if (modMask & ALT_MASK) { - modMask &= ~(ModMask)ALT_MASK; + modMask &= ~ALT_MASK; modMask |= dispPtr->altModMask; } } @@ -992,7 +985,7 @@ ResolveModifiers( static int ButtonNumberFromState( - ModMask state) + unsigned state) { if (!(state & ALL_BUTTONS)) { return 0; } if (state & Button1Mask) { return 1; } @@ -1647,7 +1640,7 @@ Tk_CreateBinding( * existing binding will always be replaced. */ { PatSeq *psPtr; - EventMask eventMask; + unsigned eventMask; char *oldStr; char *newStr; @@ -2740,8 +2733,8 @@ static int CompareModMasks( const PSModMaskArr *fstModMaskArr, const PSModMaskArr *sndModMaskArr, - ModMask fstModMask, - ModMask sndModMask) + unsigned fstModMask, + unsigned sndModMask) { int fstCount = 0; int sndCount = 0; @@ -2765,8 +2758,8 @@ CompareModMasks( assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr)); for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) { - ModMask fstModMask = *PSModMaskArr_Get(fstModMaskArr, i); - ModMask sndModMask = *PSModMaskArr_Get(sndModMaskArr, i); + unsigned fstModMask = *PSModMaskArr_Get(fstModMaskArr, i); + unsigned sndModMask = *PSModMaskArr_Get(sndModMaskArr, i); if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; } if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; } @@ -2799,7 +2792,7 @@ MatchPatterns( PSEntry *psEntry; PatSeq *bestPtr; PatSeq *bestPhysPtr; - ModMask bestModMask; + unsigned bestModMask; const PSModMaskArr *bestModMaskArr = NULL; int i, isModKeyOnly = 0; @@ -2866,8 +2859,8 @@ MatchPatterns( * cannot be done in ParseEventDescription, otherwise this function would * be the better place. */ - ModMask modMask = ResolveModifiers(dispPtr, patPtr->modMask); - ModMask curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask); + unsigned modMask = ResolveModifiers(dispPtr, patPtr->modMask); + unsigned curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask); psEntry->expired = 1; /* remove it from promotion list */ psEntry->keepIt = 0; /* don't keep matching patterns */ @@ -3863,7 +3856,7 @@ HandleEventGenerate( Tk_Window tkwin; Tk_Window tkwin2; TkWindow *mainPtr; - EventMask eventMask; + unsigned eventMask; Tcl_Obj *userDataObj; int synch; int warp; @@ -4645,7 +4638,7 @@ FindSequence( * 1 means create. */ int allowVirtual, /* 0 means that virtual events are not allowed in the sequence. * 1 otherwise. */ - EventMask *maskPtr) /* *maskPtr is filled in with the event types on which this + unsigned *maskPtr) /* *maskPtr is filled in with the event types on which this * pattern sequence depends. */ { unsigned patsBufSize = 1; @@ -4659,8 +4652,8 @@ FindSequence( int isNew; unsigned count; unsigned maxCount = 0; - EventMask eventMask = 0; - ModMask modMask = 0; + unsigned eventMask = 0; + unsigned modMask = 0; PatternTableKey key; assert(lookupTables); @@ -4834,10 +4827,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. */ - EventMask *eventMaskPtr) /* Filled with event mask of matched event. */ + unsigned *eventMaskPtr) /* Filled with event mask of matched event. */ { const char *p; - EventMask eventMask = 0; + unsigned eventMask = 0; unsigned count = 1; assert(eventStringPtr); @@ -5150,7 +5143,7 @@ GetPatternObj( assert(patPtr->name); Tcl_AppendPrintfToObj(patternObj, "<<%s>>", patPtr->name); } else { - ModMask modMask; + unsigned modMask; const ModInfo *modPtr; /* @@ -5203,7 +5196,7 @@ GetPatternObj( break; #if PRINT_SHORT_MOTION_SYNTAX case MotionNotify: { - ModMask mask = patPtr->modMask; + unsigned mask = patPtr->modMask; while (mask & ALL_BUTTONS) { int button = ButtonNumberFromState(mask); Tcl_AppendPrintfToObj(patternObj, "-%d", button); diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 193d877..33c9d59 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -5082,7 +5082,7 @@ CanvasBindProc( XEvent *eventPtr) /* Pointer to X event that just happened. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; - unsigned long mask; + unsigned mask; Tcl_Preserve(canvasPtr); diff --git a/generic/tkEvent.c b/generic/tkEvent.c index bd312ad..6422453 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -526,14 +526,14 @@ RefreshKeyboardMappingIfNeeded( *---------------------------------------------------------------------- */ -static const unsigned long buttonMasks[] = { +static const unsigned buttonMasks[] = { 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask, Button6Mask, Button7Mask, Button8Mask, Button9Mask }; -unsigned long +unsigned TkGetButtonMask( - unsigned int button) + unsigned button) { return (button > Button9) ? 0 : buttonMasks[button]; } diff --git a/generic/tkInt.h b/generic/tkInt.h index 2131110..7174866 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1031,7 +1031,7 @@ typedef struct TkpClipMask { |Button6Mask|Button7Mask|Button8Mask|Button9Mask) -MODULE_SCOPE unsigned long TkGetButtonMask(unsigned int); +MODULE_SCOPE unsigned TkGetButtonMask(unsigned); /* * Object types not declared in tkObj.c need to be mentioned here so they can diff --git a/generic/tkPointer.c b/generic/tkPointer.c index ece6281..bb16463 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -224,8 +224,9 @@ Tk_UpdatePointer( TkWindow *targetWinPtr; XPoint pos; XEvent event; - int changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS; - int type, b, mask; + unsigned changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS; + int type, b; + unsigned mask; pos.x = x; pos.y = y; |