summaryrefslogtreecommitdiffstats
path: root/win/tkWinScrlbr.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-02-16 21:12:56 (GMT)
committernijtmans <nijtmans>2010-02-16 21:12:56 (GMT)
commit98ad94bf967f4567ae47c4b74ffe11cc12f7d22f (patch)
treeb566e3894b84ff71cec41746404929097ffb61c6 /win/tkWinScrlbr.c
parent759424b1be09259bf20d269efd93af21c5150a01 (diff)
downloadtk-98ad94bf967f4567ae47c4b74ffe11cc12f7d22f.zip
tk-98ad94bf967f4567ae47c4b74ffe11cc12f7d22f.tar.gz
tk-98ad94bf967f4567ae47c4b74ffe11cc12f7d22f.tar.bz2
tkWindow.c/tkStubInit.c adapted from stub changes in Tcl
tkArgv.c make defaultTable const tkScrollbar.c Store default for "-with" in static non-const memory tkWinInt.h make tkWinProcs const, and 5 tkWinX.c procs MODULE_SCOPE tkWinColor.c make sysColors const tkWinKey.c make keymap const tkWinScrlbr.c Simplify copying of "-with" default value. tkUnixWm.c make TkSetTransientFor static tests/textImage.test textImage-1.13 depends on hash-order
Diffstat (limited to 'win/tkWinScrlbr.c')
-rw-r--r--win/tkWinScrlbr.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index b87731c..9e848c7 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinScrlbr.c,v 1.18 2010/01/13 23:08:11 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinScrlbr.c,v 1.19 2010/02/16 21:12:56 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -54,18 +54,11 @@ typedef struct WinScrollbar {
static int initialized = 0;
static int hArrowWidth, hThumb; /* Horizontal control metrics. */
-static int vArrowWidth, vArrowHeight, vThumb; /* Vertical control metrics. */
+static int vArrowHeight, vThumb; /* Vertical control metrics. */
TCL_DECLARE_MUTEX(winScrlbrMutex)
/*
- * This variable holds the default width for a scrollbar in string form for
- * use in a Tk_ConfigSpec.
- */
-
-static char defWidth[TCL_INTEGER_SPACE];
-
-/*
* Declarations for functions defined in this file.
*/
@@ -363,19 +356,22 @@ TkpDestroyScrollbar(
void
UpdateScrollbarMetrics(void)
{
- Tk_ConfigSpec *specPtr;
+ int arrowWidth = GetSystemMetrics(SM_CXVSCROLL);
+ const Tk_ConfigSpec *specPtr;
hArrowWidth = GetSystemMetrics(SM_CXHSCROLL);
hThumb = GetSystemMetrics(SM_CXHTHUMB);
- vArrowWidth = GetSystemMetrics(SM_CXVSCROLL);
vArrowHeight = GetSystemMetrics(SM_CYVSCROLL);
vThumb = GetSystemMetrics(SM_CYVTHUMB);
- sprintf(defWidth, "%d", vArrowWidth);
for (specPtr = tkpScrollbarConfigSpecs; specPtr->type != TK_CONFIG_END;
specPtr++) {
+ /* Make sure that the default value belonging to the "-width"
+ * option of TkScrollbar points to static non-const space,
+ * otherwise the following sprintf results in a crash!
+ */
if (specPtr->offset == Tk_Offset(TkScrollbar, width)) {
- specPtr->defValue = defWidth;
+ sprintf((char *)specPtr->defValue, "%d", arrowWidth);
}
}
}