summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorcsaba <csaba>2023-11-13 17:26:02 (GMT)
committercsaba <csaba>2023-11-13 17:26:02 (GMT)
commit77f93393c12a891b1f70d1d192302b41fe82a5a8 (patch)
tree7c672348a4da7d496f528531d22f1b48118c0f72 /win
parentfd0dfa4ae8595298c7d5222326eccb81e7512d3c (diff)
downloadtk-77f93393c12a891b1f70d1d192302b41fe82a5a8.zip
tk-77f93393c12a891b1f70d1d192302b41fe82a5a8.tar.gz
tk-77f93393c12a891b1f70d1d192302b41fe82a5a8.tar.bz2
Using the application's TkMainInfo struct for sharing the nbTabsStickBit in a thread-safe manner. Thanks Christian W.!
Diffstat (limited to 'win')
-rw-r--r--win/ttkWinTheme.c15
-rw-r--r--win/ttkWinXPTheme.c15
2 files changed, 26 insertions, 4 deletions
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index 46be6f0..e797206 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -658,17 +658,22 @@ static const Ttk_ElementOptionSpec TabElementOptions[] = {
{0,TK_OPTION_BOOLEAN,0,0}
};
-extern Ttk_PositionSpec nbTabsStickBit; /* see ttkNotebook.c */
-
static void TabElementSize(
void *clientData, 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;
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:
@@ -690,6 +695,8 @@ static void TabElementDraw(
void *clientData, 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);
XPoint pts[6];
@@ -697,6 +704,10 @@ static void TabElementDraw(
Display *disp = Tk_Display(tkwin);
int borderWidth = 1;
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
if (state & TTK_STATE_SELECTED) {
/*
* Draw slightly outside of the allocated parcel,
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index cfa6bf4..3593c9a 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -728,12 +728,17 @@ static Ttk_ElementSpec PbarElementSpec =
* we can use the same statemap no matter what the partId.
*/
-extern Ttk_PositionSpec nbTabsStickBit; /* see ttkNotebook.c */
-
static void TabElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
+
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
GenericElementSize(clientData, elementRecord, tkwin,
widthPtr, heightPtr, paddingPtr);
@@ -759,11 +764,17 @@ static void TabElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned int state)
{
+ Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S;
+ TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr;
ElementData *elementData = (ElementData *)clientData;
int partId = elementData->info->partId;
int isSelected = (state & TTK_STATE_SELECTED);
int stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
+ if (mainInfoPtr != NULL) {
+ nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
+ }
+
/*
* Correct the members of b if needed
*/