Tk Source Code

Artifact [011819fa]
Login

Artifact 011819fa0c4d0c40e0f29a6c3ea02fdf0c8c0679716bab4f0cb3d73ca5fc4485:

Attachment "tk.patch" to ticket [47d4f291] added by erikleunissen 2024-02-18 13:37:01.
diff -ur tk.old/generic/tkBind.c tk.new/generic/tkBind.c
--- tk.old/generic/tkBind.c	2022-10-27 13:54:32.000000000 +0200
+++ tk.new/generic/tkBind.c	2024-01-06 17:44:51.000000000 +0100
@@ -2207,14 +2207,8 @@
     curEvent = bindPtr->eventInfo + eventPtr->type;
 
     /*
-     * Ignore the event completely if it is an Enter, Leave, FocusIn, or
-     * FocusOut event with detail NotifyInferior. The reason for ignoring
-     * these events is that we don't want transitions between a window and its
-     * children to be visible to bindings on the parent: this would cause
-     * problems for mega-widgets, since the internal structure of a
-     * mega-widget isn't supposed to be visible to people watching the parent.
-     *
-     * Furthermore we have to compute current time, needed for "event generate".
+     * Compute current time needed for "event generate",
+     * and reset counters for Key and Button events.
      */
 
     switch (eventPtr->type) {
@@ -2224,15 +2218,6 @@
 	    bindInfoPtr->lastCurrentTime = CurrentTimeInMilliSecs();
 	    bindInfoPtr->lastEventTime = eventPtr->xcrossing.time;
 	}
-	if (eventPtr->xcrossing.detail == NotifyInferior) {
-	    return;
-	}
-	break;
-    case FocusIn:
-    case FocusOut:
-	if (eventPtr->xfocus.detail == NotifyInferior) {
-	    return;
-	}
 	break;
     case KeyPress:
     case KeyRelease: {
diff -ur tk.old/tests/bind.test tk.new/tests/bind.test
--- tk.old/tests/bind.test	2022-10-27 13:54:32.000000000 +0200
+++ tk.new/tests/bind.test	2024-02-18 14:35:31.000000000 +0100
@@ -584,7 +584,7 @@
 } -cleanup {
     destroy .t.f
 } -result {{.t.f z (.t.f <Button-1> binding)} {.t.f z (.t.f <Button> binding)}}
-test bind-13.10 {Tk_BindEvent procedure: ignore NotifyInferior} -setup {
+test bind-13.10 {Tk_BindEvent procedure: don't ignore NotifyInferior - bug 47d4f29159} -setup {
     frame .t.f -class Test -width 150 -height 100
     pack .t.f
     focus -force .t.f
@@ -600,7 +600,7 @@
     return $x
 } -cleanup {
     destroy .t.f
-} -result {Enter100 Leave102}
+} -result {Enter100 Enter101 Leave102 Leave103}
 test bind-13.11 {Tk_BindEvent procedure: collapse Motions} -setup {
     frame .t.f -class Test -width 150 -height 100
     pack .t.f
diff -ur tk.old/tests/event.test tk.new/tests/event.test
--- tk.old/tests/event.test	2022-06-06 18:40:39.000000000 +0200
+++ tk.new/tests/event.test	2024-02-15 18:20:35.000000000 +0100
@@ -861,39 +861,6 @@
     deleteWindows
 } -result {OK}
 
-test event-9 {no <Enter> event is generated for the container window when its
-              managed window in which the mouse pointer was inside gets
-              destroyed - bug 9e1312f32c} -setup {
-    set res [list ]
-    set iconified false
-    if {[winfo ismapped .]} {
-        wm iconify .
-        update
-        set iconified true
-    }
-} -body {
-    toplevel .top
-    pack propagate .top 0
-    bind .top <Enter> {lappend res %W}
-    pack [frame .top.f -bg green -width 50 -height 50] -anchor se -side bottom
-    tkwait visibility .top.f
-    after 50
-    update
-    focus -force .top.f
-    event generate .top.f <Motion> -warp 1 -x 25 -y 25  ; # <Enter> sent to .top and .top.f
-    controlPointerWarpTiming
-    update  ; # idletasks not enough
-    destroy .top.f  ; # no <Enter> event sent
-    update
-    set res
-} -cleanup {
-    deleteWindows
-    if {$iconified} {
-        wm deiconify .
-        update
-    }
-} -result {.top .top.f}
-
 test event-9.1 {enter . window by destroying a toplevel - bug b1d115fa60} -setup {
     set EnterBind [bind . <Enter>]
 } -body {