From 42874b94f43eb79b98a80e6fb88552cce596cf20 Mon Sep 17 00:00:00 2001 From: gcramer Date: Fri, 21 Jul 2017 14:05:07 +0000 Subject: Bugfix [4966cad4d4]: Now function NotebookPlaceSlaves() in ttkNotebook.c will regard the active index. --- generic/ttk/ttkNotebook.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 83d7db9..437ae11 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -595,8 +595,12 @@ static void NotebookPlaceSlaves(void *recordPtr) Notebook *nb = recordPtr; int currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { + int activeIndex = nb->notebook.activeIndex; + int index = (activeIndex >= 0) ? activeIndex : currentIndex; NotebookDoLayout(nb); - NotebookPlaceSlave(nb, currentIndex); + if (index >= 0) { + NotebookPlaceSlave(nb, index); + } } } -- cgit v0.12 From b2c96a4033130f79fbfb5851810096972c9b5984 Mon Sep 17 00:00:00 2001 From: gcramer Date: Sun, 23 Jul 2017 17:06:12 +0000 Subject: I reverted the previous fix, because it doesn't work. The current solution is to set currentIndex before NotebookPlaceSlave() will be called, due to my analysis this can have only one side effect: an interveaning call of NotebookPlaceSlaves() will change to the correct tab. --- generic/ttk/ttkNotebook.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 437ae11..56439a6 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -595,12 +595,8 @@ static void NotebookPlaceSlaves(void *recordPtr) Notebook *nb = recordPtr; int currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { - int activeIndex = nb->notebook.activeIndex; - int index = (activeIndex >= 0) ? activeIndex : currentIndex; NotebookDoLayout(nb); - if (index >= 0) { - NotebookPlaceSlave(nb, index); - } + NotebookPlaceSlave(nb, currentIndex); } } @@ -631,9 +627,12 @@ static void SelectTab(Notebook *nb, int index) Ttk_UnmapSlave(nb->notebook.mgr, currentIndex); } - NotebookPlaceSlave(nb, index); - + /* Must be set before calling NotebookPlaceSlave(), otherwise it may + * happen that NotebookPlaceSlaves(), triggered by an interveaning + * geometry request, will swap to old index. */ nb->notebook.currentIndex = index; + + NotebookPlaceSlave(nb, index); TtkRedisplayWidget(&nb->core); TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); -- cgit v0.12