@@ -690,7 +690,7 @@ DEBUG(static int countSeqItems = 0;)
690690 */
691691
692692static void ChangeScreen (Tcl_Interp * interp , char * dispName , int screenIndex );
693- static int CreateVirtualEvent (Tcl_Interp * interp , VirtualEventTable * vetPtr ,
693+ static bool CreateVirtualEvent (Tcl_Interp * interp , VirtualEventTable * vetPtr ,
694694 char * virtString , const char * eventString );
695695static int DeleteVirtualEvent (Tcl_Interp * interp , VirtualEventTable * vetPtr ,
696696 char * virtString , const char * eventString );
@@ -712,7 +712,7 @@ static void InitVirtualEventTable(VirtualEventTable *vetPtr);
712712static PatSeq * MatchPatterns (TkDisplay * dispPtr , Tk_BindingTable bindPtr , PSList * psList ,
713713 PSList * psSuccList , unsigned patIndex , const Event * eventPtr ,
714714 void * object , PatSeq * * physPtrPtr );
715- static int NameToWindow (Tcl_Interp * interp , Tk_Window main ,
715+ static bool NameToWindow (Tcl_Interp * interp , Tk_Window main ,
716716 Tcl_Obj * objPtr , Tk_Window * tkwinPtr );
717717static unsigned ParseEventDescription (Tcl_Interp * interp , const char * * eventStringPtr ,
718718 TkPattern * patPtr , unsigned * eventMaskPtr );
@@ -2090,19 +2090,19 @@ ResetCounters(
20902090}
20912091
20922092/* helper function */
2093- static int
2093+ static bool
20942094IsBetterMatch (
20952095 const PatSeq * fstMatchPtr ,
20962096 const PatSeq * sndMatchPtr ) /* this is a better match? */
20972097{
20982098 int diff ;
20992099
2100- if (!sndMatchPtr ) { return 0 ; }
2101- if (!fstMatchPtr ) { return 1 ; }
2100+ if (!sndMatchPtr ) { return false ; }
2101+ if (!fstMatchPtr ) { return true ; }
21022102
21032103 diff = CountSpecialized (fstMatchPtr , sndMatchPtr );
2104- if (diff > 0 ) { return 1 ; }
2105- if (diff < 0 ) { return 0 ; }
2104+ if (diff > 0 ) { return true ; }
2105+ if (diff < 0 ) { return false ; }
21062106
21072107 { /* local scope */
21082108#define M 1000000ULL
@@ -2128,8 +2128,8 @@ IsBetterMatch(
21282128 assert (GetCount (sndMatchPtr , i ) < SIZE_OF_ARRAY (weight ));
21292129 sndCount += weight [GetCount (sndMatchPtr , i )];
21302130 }
2131- if (sndCount > fstCount ) { return 1 ; }
2132- if (sndCount < fstCount ) { return 0 ; }
2131+ if (sndCount > fstCount ) { return true ; }
2132+ if (sndCount < fstCount ) { return false ; }
21332133 }
21342134
21352135 return sndMatchPtr -> number > fstMatchPtr -> number ;
@@ -2632,7 +2632,7 @@ Tk_BindEvent(
26322632 */
26332633
26342634/* helper function */
2635- static int
2635+ static bool
26362636VirtPatIsBound (
26372637 Tk_BindingTable bindPtr , /* Table in which to look for bindings. */
26382638 PatSeq * psPtr , /* Test this pattern. */
@@ -2655,7 +2655,7 @@ VirtPatIsBound(
26552655
26562656 if (physPatPtr -> info || !virtPatPtr -> info ) {
26572657 if (IsSubsetOf (virtPatPtr -> modMask , physPatPtr -> modMask )) {
2658- return 0 ; /* We cannot surpass this match. */
2658+ return false ; /* We cannot surpass this match. */
26592659 }
26602660 }
26612661 }
@@ -2675,11 +2675,11 @@ VirtPatIsBound(
26752675 if ((hPtr = Tcl_FindHashEntry (& bindPtr -> lookupTables .patternTable , (char * ) & key ))) {
26762676 /* The physical event matches this virtual event's definition. */
26772677 * physPtrPtr = (PatSeq * ) Tcl_GetHashValue (hPtr );
2678- return 1 ;
2678+ return true ;
26792679 }
26802680 }
26812681
2682- return 0 ;
2682+ return false ;
26832683}
26842684
26852685/* helper function */
@@ -2743,7 +2743,7 @@ CompareModMasks(
27432743}
27442744
27452745/* helper function */
2746- static int
2746+ static bool
27472747IsPSInPSList (
27482748 const PatSeq * psPtr , /* Is this pattern sequence... */
27492749 const PSList * psList ) /* ...an element of this list of patterns sequence? */
@@ -2752,10 +2752,10 @@ IsPSInPSList(
27522752
27532753 TK_DLIST_FOREACH (psEntry , psList ) {
27542754 if (psEntry -> psPtr == psPtr ) {
2755- return 1 ;
2755+ return true ;
27562756 }
27572757 }
2758- return 0 ;
2758+ return false ;
27592759}
27602760
27612761static PatSeq *
@@ -3535,7 +3535,7 @@ DeleteVirtualEventTable(
35353535 *----------------------------------------------------------------------
35363536 */
35373537
3538- static int
3538+ static bool
35393539CreateVirtualEvent (
35403540 Tcl_Interp * interp , /* Used for error reporting. */
35413541 VirtualEventTable * vetPtr , /* Table in which to augment virtual event. */
@@ -3553,15 +3553,15 @@ CreateVirtualEvent(
35533553 assert (eventString );
35543554
35553555 if (!(virtUid = GetVirtualEventUid (interp , virtString ))) {
3556- return 0 ;
3556+ return false ;
35573557 }
35583558
35593559 /*
35603560 * Find/create physical event.
35613561 */
35623562
35633563 if (!(psPtr = FindSequence (interp , & vetPtr -> lookupTables , NULL , eventString , 1 , 0 , NULL ))) {
3564- return 0 ;
3564+ return false ;
35653565 }
35663566 assert (TEST_PSENTRY (psPtr ));
35673567
@@ -3586,7 +3586,7 @@ CreateVirtualEvent(
35863586 VirtOwners_Append (& psPtr -> ptr .owners , vhPtr );
35873587 }
35883588
3589- return 1 ;
3589+ return true ;
35903590}
35913591
35923592/*
@@ -4414,10 +4414,11 @@ HandleEventGenerate(
44144414 }
44154415
44164416 /*
4417- * We only allow warping if the window is mapped.
4417+ * We allow warping relative to the screen's root window, or relative to a
4418+ * Tk window provided that it is mapped.
44184419 */
44194420
4420- if (warp && Tk_IsMapped (tkwin )) {
4421+ if (warp && (! windowName [ 0 ] || Tk_IsMapped (tkwin ) )) {
44214422 TkDisplay * dispPtr = TkGetDisplay (event .general .xmotion .display );
44224423
44234424 Tk_Window warpWindow = Tk_IdToWindow (dispPtr -> display , event .general .xmotion .window );
@@ -4482,7 +4483,7 @@ HandleEventGenerate(
44824483 *---------------------------------------------------------------------------
44834484 */
44844485
4485- static int
4486+ static bool
44864487NameToWindow (
44874488 Tcl_Interp * interp , /* Interp for error return and name lookup. */
44884489 Tk_Window mainWin , /* Main window of application. */
@@ -4500,7 +4501,7 @@ NameToWindow(
45004501
45014502 if (name [0 ] == '.' ) {
45024503 if (!(tkwin = Tk_NameToWindow (interp , name , mainWin ))) {
4503- return 0 ;
4504+ return false ;
45044505 }
45054506 } else {
45064507 Window id ;
@@ -4519,13 +4520,13 @@ NameToWindow(
45194520 if (!tkwin ) {
45204521 Tcl_SetObjResult (interp , Tcl_ObjPrintf ("bad window name/identifier \"%s\"" , name ));
45214522 Tcl_SetErrorCode (interp , "TK" , "LOOKUP" , "WINDOW_ID" , name , (char * )NULL );
4522- return 0 ;
4523+ return false ;
45234524 }
45244525 }
45254526
45264527 assert (tkwin );
45274528 * tkwinPtr = tkwin ;
4528- return 1 ;
4529+ return true ;
45294530}
45304531
45314532/*
0 commit comments