diff options
author | csaba <csaba> | 2023-11-14 18:34:58 (GMT) |
---|---|---|
committer | csaba <csaba> | 2023-11-14 18:34:58 (GMT) |
commit | 5bf51441dc9e76798a384cffcec208e3db3a2962 (patch) | |
tree | 60dd75b5828a6a6eb55a85bb096f8ac5c8ae4297 /generic/ttk/ttkElements.c | |
parent | 7b18f8549882ec8e98fe379f497f934aa730f1ef (diff) | |
download | tk-5bf51441dc9e76798a384cffcec208e3db3a2962.zip tk-5bf51441dc9e76798a384cffcec208e3db3a2962.tar.gz tk-5bf51441dc9e76798a384cffcec208e3db3a2962.tar.bz2 |
Using the application's TkMainInfo struct for sharing the nbTabsStickBit in a thread-safe manner. Thanks Christian W.!
Diffstat (limited to 'generic/ttk/ttkElements.c')
-rw-r--r-- | generic/ttk/ttkElements.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 5e8351e..16296b2 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -1601,20 +1601,25 @@ static const Ttk_ElementOptionSpec TabElementOptions[] = { {0,TK_OPTION_BOOLEAN,0,0} }; -extern Ttk_PositionSpec nbTabsStickBit; /* see ttkNotebook.c */ - static void TabElementSize( void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TabElement *tab = (TabElement *)elementRecord; int borderWidth = 1; + Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; + TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; (void)dummy; (void)widthPtr; (void)heightPtr; Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); + + if (mainInfoPtr != NULL) { + nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; + } + switch (nbTabsStickBit) { default: case TTK_STICK_S: @@ -1636,6 +1641,8 @@ static void TabElementDraw( void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { + Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; + TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; TabElement *tab = (TabElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); int highlight = 0; @@ -1647,6 +1654,10 @@ static void TabElementDraw( int borderWidth = 1; (void)dummy; + if (mainInfoPtr != NULL) { + nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; + } + if (state & TTK_STATE_SELECTED) { /* * Draw slightly outside of the allocated parcel, |