summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixButton.c14
-rw-r--r--unix/tkUnixMenu.c32
2 files changed, 8 insertions, 38 deletions
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index c67f1fa..e4c9bf7 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -172,20 +172,19 @@ TkpDrawCheckIndicator(
{
const char *svgDataPtr;
int hasBorder, hasInterior, dim;
+ double scalingLevel = TkScalingLevel(tkwin);
TkBorder *bg_brdr = (TkBorder*)bgBorder;
char darkColorStr[7], lightColorStr[7], interiorColorStr[7], indicatorColorStr[7];
+ Tcl_Interp *interp = Tk_Interp(tkwin);
char imgName[60];
Tk_Image img;
size_t svgDataLen;
char *svgDataCopy;
char *darkColorPtr, *lightColorPtr, *interiorColorPtr, *indicatorColorPtr;
- Tcl_Interp *interp = Tk_Interp(tkwin);
const char *cmdFmt;
size_t scriptSize;
char *script;
int code;
- const char *scalingPctPtr;
- double scalingFactor;
/*
* Sanity check
@@ -235,6 +234,7 @@ TkpDrawCheckIndicator(
dim = RADIO_MENU_DIM;
break;
}
+ dim = (int)(dim * scalingLevel);
/*
* Construct the color strings darkColorStr, lightColorStr,
@@ -339,14 +339,6 @@ TkpDrawCheckIndicator(
}
/*
- * Retrieve the scaling factor (1.0, 1.25, 1.5, ...) and multiply dim by it
- */
-
- scalingPctPtr = Tcl_GetVar(interp, "::tk::scalingPct", TCL_GLOBAL_ONLY);
- scalingFactor = (scalingPctPtr == NULL ? 1.0 : atof(scalingPctPtr) / 100);
- dim = (int)(dim * scalingFactor);
-
- /*
* Adjust the image's coordinates in the drawable and display the image
*/
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index f6442ad..7f9ad7d 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -391,22 +391,11 @@ GetMenuAccelGeometry(
int *widthPtr, /* The width of the acclerator area */
int *heightPtr) /* The height of the accelerator area */
{
- Tcl_Interp *interp = Tk_Interp(menuPtr->tkwin);
- const char *scalingPctPtr;
- double scalingFactor = 1.0;
+ double scalingLevel = TkScalingLevel(menuPtr->tkwin);
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
- /*
- * Retrieve the scaling factor (1.0, 1.25, 1.5, ...)
- */
-
- scalingPctPtr = Tcl_GetVar(interp, "::tk::scalingPct", TCL_GLOBAL_ONLY);
- if (scalingPctPtr != NULL) {
- scalingFactor = atof(scalingPctPtr) / 100;
- }
-
- *widthPtr = 2 * CASCADE_ARROW_WIDTH * scalingFactor;
+ *widthPtr = 2 * CASCADE_ARROW_WIDTH * scalingLevel;
} else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) {
const char *accel = Tcl_GetString(mePtr->accelPtr);
@@ -502,9 +491,7 @@ DrawMenuEntryAccelerator(
XPoint points[3];
int borderWidth, activeBorderWidth;
int arrowWidth = CASCADE_ARROW_WIDTH, arrowHeight = CASCADE_ARROW_HEIGHT;
- Tcl_Interp *interp = Tk_Interp(menuPtr->tkwin);
- const char *scalingPctPtr;
- double scalingFactor = 1.0;
+ double scalingLevel = TkScalingLevel(menuPtr->tkwin);
/*
* Draw accelerator or cascade arrow.
@@ -519,17 +506,8 @@ DrawMenuEntryAccelerator(
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
&activeBorderWidth);
if ((mePtr->type == CASCADE_ENTRY) && drawArrow) {
- /*
- * Retrieve the scaling factor (1.0, 1.25, 1.5, ...)
- * and multiply the cascade arrow's dimensions by it
- */
-
- scalingPctPtr = Tcl_GetVar(interp, "::tk::scalingPct", TCL_GLOBAL_ONLY);
- if (scalingPctPtr != NULL) {
- scalingFactor = atof(scalingPctPtr) / 100;
- }
- arrowWidth *= scalingFactor;
- arrowHeight *= scalingFactor;
+ arrowWidth *= scalingLevel;
+ arrowHeight *= scalingLevel;
points[0].x = x + width - borderWidth - activeBorderWidth - arrowWidth;
points[0].y = y + (height - arrowHeight)/2;