From 2a2a8ddef821cf61de5c1928f06702eaf668a074 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 2 Mar 2020 20:51:39 +0000 Subject: Add focus-7.1 as a non-regression test for [08e2f8e6f0]. This test does not pass yet. --- tests/focus.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/focus.test b/tests/focus.test index 45cf73b..7a7e5ef 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -730,6 +730,26 @@ test focus-6.2 {miscellaneous - embedded application in different process} -cons bind all {} } -result {{.t.f2.e1 {} {focus out .t.f2.e1 NotifyNonlinear} {focus out .t.f2 NotifyNonlinearVirtual} {focus in .t.f1 NotifyNonlinear} | {focus out .t.f1 NotifyNonlinear} {focus in .t.f2 NotifyNonlinearVirtual} {focus in .t.f2.e1 NotifyNonlinear}} {{focus in . NotifyVirtual} {focus in .e1 NotifyAncestor} | {focus out .e1 NotifyAncestor} {focus out . NotifyVirtual}}} +test focus-7.1 {TkSetFocusWin procedure, unmapped windows} -setup { + # TkSetFocusWin handles the case of not yet mapped windows + # by not setting the focus on them right at the time it is + # requested, but by scheduling an event handler that will + # set the focus later once it gets mapped. The purpose of + # this test is to check that event scheduling and deletion + # work as expected (bug [08e2f8e6f0]). + toplevel .top + spinbox .top.s1 + spinbox .top.s2 + spinbox .top.s3 + grid .top.s1 .top.s2 .top.s3 +} -body { + focus -force .top.s2 + focus -force .top.s3 + update + focus +} -cleanup { + destroy .top +} -result {.top.s3} deleteWindows -- cgit v0.12 From 19c8025c9dc2618bbfb1d8664145461bca478cff Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 2 Mar 2020 20:54:36 +0000 Subject: Fix [08e2f8e6f0]: unable to change focus after prior selection of focus. The problem was that the mask in the event handler deletion did not match the mask of the event handler creation. Test focus-7.1 now passes. --- generic/tkFocus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 7b5acfb..4d46e4b 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -603,7 +603,7 @@ TkSetFocusWin( if (displayFocusPtr->focusOnMapPtr != NULL) { Tk_DeleteEventHandler((Tk_Window) displayFocusPtr->focusOnMapPtr, - StructureNotifyMask, FocusMapProc, + VisibilityChangeMask, FocusMapProc, displayFocusPtr->focusOnMapPtr); displayFocusPtr->focusOnMapPtr = NULL; } -- cgit v0.12