summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--doc/.cvsignore1
-rw-r--r--generic/tkButton.c12
-rw-r--r--generic/tkButton.h6
-rw-r--r--win/.cvsignore8
-rw-r--r--win/tkWinButton.c81
-rw-r--r--win/tkWinTest.c5
7 files changed, 45 insertions, 77 deletions
diff --git a/ChangeLog b/ChangeLog
index d3beba7..234f267 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-12 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkButton.h [Bug 2956548] TkpButtonSetDefaults only
+ * generic/tkButton.c initializes one button type
+ * win/tkWinButton.c
+ * win/tkWinTest.c Fix 2 minor gcc warnings
+ * win/.cvsignore
+ * doc/.cvsignore Ignore man.macros
+
2010-02-17 Joe English <jenglish@users.sourceforge.net>
* generic/tkMenu.c: Defer TkMenuOptionTables cleanup
diff --git a/doc/.cvsignore b/doc/.cvsignore
new file mode 100644
index 0000000..a1f8667
--- /dev/null
+++ b/doc/.cvsignore
@@ -0,0 +1 @@
+man.macros
diff --git a/generic/tkButton.c b/generic/tkButton.c
index a26249d..357a5d6 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkButton.c,v 1.20.2.2 2003/11/12 00:05:13 hobbs Exp $
+ * RCS: @(#) $Id: tkButton.c,v 1.20.2.3 2010/03/12 13:12:35 nijtmans Exp $
*/
#include "tkButton.h"
@@ -56,6 +56,8 @@ static char *compoundStrings[] = {
"bottom", "center", "left", "none", "right", "top", (char *) NULL
};
+char tkDefButtonBorderWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_BORDER_WIDTH;
+
/*
* Information used for parsing configuration options. There is a
* separate table for each of the four widget classes.
@@ -81,7 +83,7 @@ static Tk_OptionSpec labelOptionSpecs[] = {
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_BUTTON_BORDER_WIDTH, Tk_Offset(TkButton, borderWidthPtr),
+ tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
Tk_Offset(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
@@ -167,7 +169,7 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_BUTTON_BORDER_WIDTH, Tk_Offset(TkButton, borderWidthPtr),
+ tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
Tk_Offset(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
@@ -269,7 +271,7 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = {
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_BUTTON_BORDER_WIDTH, Tk_Offset(TkButton, borderWidthPtr),
+ tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
Tk_Offset(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
@@ -378,7 +380,7 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = {
DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_BUTTON_BORDER_WIDTH, Tk_Offset(TkButton, borderWidthPtr),
+ tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr),
Tk_Offset(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
diff --git a/generic/tkButton.h b/generic/tkButton.h
index d0ecfea..94aa593 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -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: tkButton.h,v 1.9.2.1 2003/04/26 02:53:46 hobbs Exp $
+ * RCS: @(#) $Id: tkButton.h,v 1.9.2.2 2010/03/12 13:12:35 nijtmans Exp $
*/
#ifndef _TKBUTTON
@@ -287,10 +287,12 @@ typedef struct {
#define GOT_FOCUS (1 << 2)
#define BUTTON_DELETED (1 << 3)
/*
- * Declaration of variables shared between the files in the button module.
+ * Declaration of button class functions structure
+ * and button/label defaults, for use in optionSpecs.
*/
extern Tk_ClassProcs tkpButtonProcs;
+extern char tkDefButtonBorderWidth[TCL_INTEGER_SPACE];
/*
* Declaration of procedures used in the implementation of the button
diff --git a/win/.cvsignore b/win/.cvsignore
index b986cda..42f80eb 100644
--- a/win/.cvsignore
+++ b/win/.cvsignore
@@ -10,6 +10,12 @@ Release
*.asm
Makefile
tcl.hpj
-tclConfig.sh
+tkConfig.sh
nmakehlp.exe
.#*
+*.dll
+*.a
+*.exe
+*.manifest
+config.cache
+config.status
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index ad7e77d..a3711aa 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinButton.c --
*
* This file implements the Windows specific portion of the button
@@ -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: tkWinButton.c,v 1.20.2.5 2009/11/02 04:59:10 mistachkin Exp $
+ * RCS: @(#) $Id: tkWinButton.c,v 1.20.2.6 2010/03/12 13:12:35 nijtmans Exp $
*/
#define OEMRESOURCE
@@ -37,17 +37,16 @@ typedef struct WinButton {
DWORD style; /* Window style flags. */
} WinButton;
-
/*
- * The following macro reverses the order of RGB bytes to convert
- * between RGBQUAD and COLORREF values.
+ * The following macro reverses the order of RGB bytes to convert between
+ * RGBQUAD and COLORREF values.
*/
#define FlipColor(rgb) (RGB(GetBValue(rgb),GetGValue(rgb),GetRValue(rgb)))
/*
- * The following enumeration defines the meaning of the palette entries
- * in the "buttons" image used to draw checkbox and radiobutton indicators.
+ * The following enumeration defines the meaning of the palette entries in the
+ * "buttons" image used to draw checkbox and radiobutton indicators.
*/
enum {
@@ -61,24 +60,24 @@ enum {
};
/*
- * Cached information about the boxes bitmap, and the default border
- * width for a button in string form for use in Tk_OptionSpec for
- * the various button widget classes.
+ * Cached information about the boxes bitmap, and the default border width for
+ * a button in string form for use in Tk_OptionSpec for the various button
+ * widget classes.
*/
-typedef struct ThreadSpecificData {
+typedef struct ThreadSpecificData {
BITMAPINFOHEADER *boxesPtr; /* Information about the bitmap. */
DWORD *boxesPalette; /* Pointer to color palette. */
LPSTR boxesBits; /* Pointer to bitmap data. */
DWORD boxHeight; /* Height of each sub-image. */
DWORD boxWidth ; /* Width of each sub-image. */
- char defWidth[TCL_INTEGER_SPACE];
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
* Declarations for functions defined in this file.
*/
+
static LRESULT CALLBACK ButtonProc _ANSI_ARGS_((HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam));
static Window CreateProc _ANSI_ARGS_((Tk_Window tkwin,
@@ -89,7 +88,7 @@ static void InitBoxes _ANSI_ARGS_((void));
* The class procedure table for the button widgets.
*/
-Tk_ClassProcs tkpButtonProcs = {
+Tk_ClassProcs tkpButtonProcs = {
sizeof(Tk_ClassProcs), /* size */
TkButtonWorldChanged, /* worldChangedProc */
CreateProc, /* createProc */
@@ -164,40 +163,6 @@ InitBoxes()
/*
*----------------------------------------------------------------------
*
- * ButtonDefaultsExitHandler --
- *
- * Frees the defaults for the buttons.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-ButtonDefaultsExitHandler(
- ClientData clientData) /* Points to an array of option specs,
- * terminated by one with type
- * TK_OPTION_END. */
-{
- Tk_OptionSpec *specPtr = (Tk_OptionSpec *)clientData;
-
- for ( ; specPtr->type != TK_OPTION_END; specPtr++) {
- if (specPtr->internalOffset == Tk_Offset(TkButton, borderWidth)) {
- if (specPtr->defValue != NULL) {
- ckfree((char *) specPtr->defValue);
- specPtr->defValue = NULL;
- }
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpButtonSetDefaults --
*
* This procedure is invoked before option tables are created for
@@ -219,26 +184,10 @@ TkpButtonSetDefaults(specPtr)
* terminated by one with type
* TK_OPTION_END. */
{
- int width;
- Tk_OptionSpec *savedSpecPtr = specPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
- if (tsdPtr->defWidth[0] == 0) {
- width = GetSystemMetrics(SM_CXEDGE);
- if (width == 0) {
- width = 1;
- }
- sprintf(tsdPtr->defWidth, "%d", width);
- }
- for ( ; specPtr->type != TK_OPTION_END; specPtr++) {
- if (specPtr->internalOffset == Tk_Offset(TkButton, borderWidth)) {
- char *defValue = (char *) ckalloc(strlen(tsdPtr->defWidth) + 1);
- strcpy(defValue, tsdPtr->defWidth);
- specPtr->defValue = defValue;
- }
+ int width = GetSystemMetrics(SM_CXEDGE);
+ if (width > 0) {
+ sprintf(tkDefButtonBorderWidth, "%d", width);
}
- TkCreateExitHandler(ButtonDefaultsExitHandler, (ClientData) savedSpecPtr);
}
/*
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index c02a036..843825d 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinTest.c,v 1.7 2002/08/14 15:31:21 vincentdarley Exp $
+ * RCS: @(#) $Id: tkWinTest.c,v 1.7.2.1 2010/03/12 13:12:35 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -171,7 +171,6 @@ TestclipboardObjCmd(clientData, interp, objc, objv)
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument values. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
HGLOBAL handle;
char *data;
int code = TCL_OK;
@@ -334,7 +333,7 @@ TestwineventCmd(clientData, interp, argc, argv)
char buf[TCL_INTEGER_SPACE];
sprintf(buf, "%d",
- SendDlgItemMessage(hwnd, id, message, wParam, lParam));
+ (int) SendDlgItemMessage(hwnd, id, message, wParam, lParam));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
break;
}