diff options
author | culler <culler> | 2024-05-22 02:44:54 (GMT) |
---|---|---|
committer | culler <culler> | 2024-05-22 02:44:54 (GMT) |
commit | ec44aa0c277d6c671ec0024785197e2f2619993a (patch) | |
tree | 30f5bf5bf97e6ad109dfa83a58a46f58b0f6e473 | |
parent | e4fbaea258605ad01892f783375433c8bf613270 (diff) | |
download | tk-ec44aa0c277d6c671ec0024785197e2f2619993a.zip tk-ec44aa0c277d6c671ec0024785197e2f2619993a.tar.gz tk-ec44aa0c277d6c671ec0024785197e2f2619993a.tar.bz2 |
All event tests now pass on Windows
-rw-r--r-- | tests/event.test | 20 | ||||
-rw-r--r-- | win/tkWinWm.c | 12 |
2 files changed, 10 insertions, 22 deletions
diff --git a/tests/event.test b/tests/event.test index 42f28f5..f24c3c6 100644 --- a/tests/event.test +++ b/tests/event.test @@ -873,7 +873,6 @@ proc waitForWindowEvent {w event {timeout 1000}} { # always a gamble how much waiting time is enough on an end user's system. # It also leads to long fixed waiting times in order to be on the safe side. - puts stderr "Waiting for $event on $w" variable _windowEvent # Use counter as a unique ID to prevent subsequent waits @@ -891,7 +890,6 @@ proc waitForWindowEvent {w event {timeout 1000}} { puts stderr "wait for $event event on $w timed out (> $timeout ms)" } else { after cancel $afterID - puts stderr "Event received" } } proc waitForWindowEvent.signal {counter} { @@ -983,32 +981,28 @@ test event-9.12 {pointer window container != parent} -setup { } -result {|<Enter> NotifyNonlinearVirtual .one.f1|<Enter> NotifyNonlinear .one.f1.f2|} test event-9.13 {pointer window is a toplevel, toplevel destination} -setup { - puts stderr "9.13 setup started" setup_win_mousepointer .one toplevel .two wm geometry .two 300x300+150+150 wm withdraw .two wm deiconify .two waitForWindowEvent .two <Enter> - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} + bind all <Leave> {append result "<Leave> %d %W|" ; puts stderr "=leave=" } + bind all <Enter> {append result "<Enter> %d %W|" ; puts stderr "-enter=" } set result | - puts stderr "9.13 setup done" } -body { - puts stderr "9.13 body started - destroying .two" destroy .two waitForWindowEvent .one <Enter> + # destroying .one here instead of in cleanup makes the test pass + destroy .one set result - puts stderr "9.13 body finished" } -cleanup { bind all <Leave> {} bind all <Enter> {} - destroy .one unset result } -result {|<Enter> NotifyNonlinear .one|} test event-9.14 {pointer window is a toplevel, tk internal destination} -setup { - puts stderr "9.14 setup" setup_win_mousepointer .one wm withdraw .one create_and_pack_frames .one @@ -1022,15 +1016,13 @@ test event-9.14 {pointer window is a toplevel, tk internal destination} -setup { bind all <Enter> {append result "<Enter> %d %W|"} set result "|" } -body { - puts stderr "9.14 body" destroy .two waitForWindowEvent .one.f1.f2 <Enter> - set result - puts stderr "9.14 body finished" -} -cleanup { bind all <Leave> {} bind all <Enter> {} destroy .one + set result +} -cleanup { unset result } -result {|<Enter> NotifyNonlinearVirtual .one|<Enter> NotifyNonlinearVirtual .one.f1|<Enter> NotifyNonlinear .one.f1.f2|} diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 146b82b..a550302 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -2585,20 +2585,18 @@ static void CheckForPointer(TkWindow *winPtr) TkWindow **windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); TkWindow **w; TkGetPointerCoords(NULL, &mouse.x, &mouse.y); - fprintf(stderr, "CheckForPointer: %s with mouse @(%d, %d)\n", - Tk_PathName(winPtr), mouse.x, mouse.y); if (windows != NULL) { for (w = windows; *w ; w++) { RECT windowRect; HWND hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) *w)); - fprintf(stderr, " Checking %s\n", Tk_PathName(*w)); if (GetWindowRect(hwnd, &windowRect) == 0) { continue; } if (winPtr != *w && PtInRect(&windowRect, mouse)) { - fprintf(stderr, "Pointer is in %s. Calling Tk_UpdatePointer\n", - Tk_PathName(*w)); - Tk_UpdatePointer((Tk_Window) *w, mouse.x, mouse.y, state); + Tk_Window target = Tk_CoordsToWindow(mouse.x, mouse.y, + (Tk_Window) *w); + Tk_UpdatePointer((Tk_Window) target, + mouse.x, mouse.y, state); break; } } @@ -6710,8 +6708,6 @@ TkWmStackorderToplevelEnumProc( TkWmStackorderToplevelPair *pair = (TkWmStackorderToplevelPair *) lParam; - /*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/ - hPtr = Tcl_FindHashEntry(pair->table, (char *) hwnd); if (hPtr != NULL) { childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); |