From d74ea96f8de64d42ea66d687e6ce4df95c2a1849 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 3 Apr 2017 06:29:04 +0000 Subject: Fix [2912962fff]: Notebook does not set TTK_STATE_USER1. Patch from Jos Decoster. --- generic/ttk/ttkNotebook.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 81a8b64..726257d 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -295,6 +295,7 @@ static Ttk_State TabState(Notebook *nb, int index) { Ttk_State state = nb->core.state; Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + int i = 0; if (index == nb->notebook.currentIndex) { state |= TTK_STATE_SELECTED; @@ -305,8 +306,15 @@ static Ttk_State TabState(Notebook *nb, int index) if (index == nb->notebook.activeIndex) { state |= TTK_STATE_ACTIVE; } - if (index == 0) { - state |= TTK_STATE_USER1; + for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { + Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + if (tab->state == TAB_STATE_HIDDEN) { + continue; + } + if (index == i) { + state |= TTK_STATE_USER1; + } + break; } if (index == Ttk_NumberSlaves(nb->notebook.mgr) - 1) { state |= TTK_STATE_USER2; -- cgit v0.12 From 0b70616ba05255d0d81b5e4aac59becde0787af7 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 3 Apr 2017 14:44:48 +0000 Subject: Fixed TTK_STATE_USER2 similarly as TTK_STATE_USER1. These bits are set for the leftmost and rightmost *visible* (i.e. non hidden) tabs --- generic/ttk/ttkNotebook.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 726257d..2bb9f82 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -288,8 +288,8 @@ static void ActivateTab(Notebook *nb, int index) * TabState -- * Return the state of the specified tab, based on * notebook state, currentIndex, activeIndex, and user-specified tab state. - * The USER1 bit is set for the leftmost tab, and USER2 - * is set for the rightmost tab. + * The USER1 bit is set for the leftmost visible tab, and USER2 + * is set for the rightmost visible tab. */ static Ttk_State TabState(Notebook *nb, int index) { @@ -316,8 +316,15 @@ static Ttk_State TabState(Notebook *nb, int index) } break; } - if (index == Ttk_NumberSlaves(nb->notebook.mgr) - 1) { - state |= TTK_STATE_USER2; + for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i >= 0; --i) { + Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + if (tab->state == TAB_STATE_HIDDEN) { + continue; + } + if (index == i) { + state |= TTK_STATE_USER2; + } + break; } if (tab->state == TAB_STATE_DISABLED) { state |= TTK_STATE_DISABLED; -- cgit v0.12