diff options
-rw-r--r-- | generic/tkBind.c | 17 | ||||
-rw-r--r-- | tests/bind.test | 13 |
2 files changed, 9 insertions, 21 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index ea1f721..a2f8532 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -717,7 +717,7 @@ 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); -static void DoWarp(ClientData clientData); +static void DoWarp(TkDisplay *dispPtr); static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr, Tcl_Obj *object, int onlyConsiderDetailedEvents); static void ClearLookupTable(LookupTables *lookupTables, ClientData object); @@ -4376,10 +4376,10 @@ HandleEventGenerate( */ if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) { + dispPtr->flags |= TK_DISPLAY_IN_WARP; if (!dispPtr->warpWindow) { - Tcl_DoWhenIdle(DoWarp, dispPtr); + DoWarp(dispPtr); } - dispPtr->flags |= TK_DISPLAY_IN_WARP; } } @@ -4466,24 +4466,22 @@ NameToWindow( * * DoWarp -- * - * Perform Warping of X pointer. Executed as an idle handler only. + * Perform warping of mouse pointer with respect to the whole screen. * * Results: * None * * Side effects: - * X Pointer will move to a new location. + * Mouse pointer moves to a new location. * *------------------------------------------------------------------------- */ static void DoWarp( - ClientData clientData) + TkDisplay *dispPtr) { - TkDisplay *dispPtr = clientData; - - assert(clientData); + assert(dispPtr); /* * A non-NULL warpWindow means warping with respect to this window. @@ -5286,7 +5284,6 @@ TkpCancelWarp( assert(dispPtr); if (dispPtr->flags & TK_DISPLAY_IN_WARP) { - Tcl_CancelIdleCall(DoWarp, dispPtr); dispPtr->flags &= ~TK_DISPLAY_IN_WARP; } } diff --git a/tests/bind.test b/tests/bind.test index 2531a65..c677109 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6137,6 +6137,8 @@ test bind-31.7 {virtual event user_data field - unshared, asynch} -setup { } -result {{} {} {TestUserData >b<}} test bind-32.1 {-warp, window was destroyed before the idle callback DoWarp} -setup { + # note: this test is now essentially useless + # since DoWarp no longer is an idle callback frame .t.f pack .t.f focus -force .t.f @@ -6656,12 +6658,8 @@ test bind-34.2 {-warp works relatively to the screen} -setup { } -body { # Contrary to bind-34.1, we're directly checking screen coordinates event generate {} <Motion> -x 20 -y 20 -warp 1 - update idletasks ; # DoWarp is an idle callback - after 50 ; # Win specific - wait for SendInput to be executed set res [winfo pointerxy .] event generate {} <Motion> -x 200 -y 200 -warp 1 - update idletasks ; # DoWarp is an idle callback - after 50 ; # Win specific - wait for SendInput to be executed lappend res {*}[winfo pointerxy .] } -cleanup { } -result {20 20 200 200} @@ -6679,8 +6677,6 @@ test bind-34.3 {-warp works with null or negative coordinates} -setup { set res {} } -body { event generate {} <Motion> -x 0 -y 0 -warp 1 - update idletasks ; # DoWarp is an idle callback - after 50 ; # Win specific - wait for SendInput to be executed foreach dim [winfo pointerxy .] { if {$dim <= $halo} { lappend res ok @@ -6689,9 +6685,7 @@ test bind-34.3 {-warp works with null or negative coordinates} -setup { } } event generate {} <Motion> -x 100 -y 100 -warp 1 - update idletasks ; after 50 event generate {} <Motion> -x -1 -y -1 -warp 1 - update idletasks ; after 50 foreach dim [winfo pointerxy .] { if {$dim <= $halo} { lappend res ok @@ -6718,8 +6712,6 @@ test bind-35.1 {pointer warp with grab on master, bug [e3888d5820]} -constraints } } event generate {} <Motion> -warp 1 -x 50 -y 50 - update idletasks ; # DoWarp is an idle callback - after 50 ; # Win specific - wait for SendInput to be executed toplevel .top grab release .top waitForGrab released .top @@ -6734,7 +6726,6 @@ test bind-35.1 {pointer warp with grab on master, bug [e3888d5820]} -constraints event generate .top.l <Motion> -warp 1 -x 10 -y 10 foreach {x1 y1} [winfo pointerxy .top.l] {} event generate {} <Motion> -warp 1 -x 50 -y 50 - update idletasks ; after 50 grab release .top ; # this will queue events waitForGrab released .top event generate .top.l <Motion> -warp 1 -x 10 -y 10 |