From 382e7dcaf6581b63580d15affc7ac2f66c4ad712 Mon Sep 17 00:00:00 2001 From: jenglish Date: Sun, 9 Nov 2008 23:53:09 +0000 Subject: Ttk widget initializeProc()s now return void instead of a status code, and are no longer allowed to fail. (Fix for #2207435 in progress). --- ChangeLog | 18 +++++++++++++++--- generic/ttk/ttkButton.c | 10 ++++------ generic/ttk/ttkEntry.c | 14 ++++++-------- generic/ttk/ttkFrame.c | 6 ++---- generic/ttk/ttkNotebook.c | 6 ++---- generic/ttk/ttkPanedwindow.c | 6 ++---- generic/ttk/ttkProgress.c | 5 ++--- generic/ttk/ttkScale.c | 6 ++---- generic/ttk/ttkScrollbar.c | 6 ++---- generic/ttk/ttkTreeview.c | 6 ++---- generic/ttk/ttkWidget.c | 8 +++----- generic/ttk/ttkWidget.h | 6 +++--- 12 files changed, 45 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58aac75..22161e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,18 @@ * generic/ttk/ttkWidget.c: Remove unnecessary casts. + * generic/ttk/ttkWidget.h, generic/ttk/ttkWidget.c: + Ttk widget initializeProc()s now return void instead of + a status code, and are no longer allowed to fail. + (Fix for [Bug 2207435] in progress). + + * generic/ttk/ttkButton.c, generic/ttk/ttkEntry.c, + generic/ttk/ttkFrame.c, generic/ttk/ttkNotebook.c, + generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c, + generic/ttk/ttkScale.c, generic/ttk/ttkScrollbar.c, + generic/ttk/ttkTreeview.c: Adjustments for the above. + + 2008-11-09 Jan Nijtmans * generic/tkCanvas.c: make all Tk_CustomOption tables const and @@ -17,9 +29,9 @@ * generic/tkCanvLine.c * generic/tkCanvUtil.c * generic/tkImgPhoto.c - * generic/tkDecls.h: (regenerated) - * doc/CrtImgType.3 doc updates - * doc/CrtPhImgFmt.3 + * generic/tkDecls.h: (regenerated) + * doc/CrtImgType.3 doc updates + * doc/CrtPhImgFmt.3 2008-11-06 Jan Nijtmans diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 4d1adcd..ce4fd67 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -1,4 +1,4 @@ -/* $Id: ttkButton.c,v 1.9 2008/04/27 22:41:12 dkf Exp $ +/* $Id: ttkButton.c,v 1.10 2008/11/09 23:53:09 jenglish Exp $ * Copyright (c) 2003, Joe English * * label, button, checkbutton, radiobutton, and menubutton widgets. @@ -118,13 +118,12 @@ static void TextVariableChanged(void *clientData, const char *value) TtkResizeWidget(&basePtr->core); } -static int +static void BaseInitialize(Tcl_Interp *interp, void *recordPtr) { Base *basePtr = recordPtr; basePtr->base.textVariableTrace = 0; basePtr->base.imageSpec = NULL; - return TCL_OK; } static void @@ -453,7 +452,7 @@ static void CheckbuttonVariableChanged(void *clientData, const char *value) } } -static int CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) +static void CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) { Checkbutton *checkPtr = recordPtr; Tcl_Obj *objPtr; @@ -464,8 +463,7 @@ static int CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) Tcl_IncrRefCount(objPtr); Tcl_DecrRefCount(checkPtr->checkbutton.variableObj); checkPtr->checkbutton.variableObj = objPtr; - - return BaseInitialize(interp, recordPtr); + BaseInitialize(interp, recordPtr); } static void diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 813cd7d..ce07ed9 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1,5 +1,5 @@ /* - * $Id: ttkEntry.c,v 1.11 2008/11/03 22:20:22 nijtmans Exp $ + * $Id: ttkEntry.c,v 1.12 2008/11/09 23:53:09 jenglish Exp $ * * DERIVED FROM: tk/generic/tkEntry.c r1.35. * @@ -935,7 +935,7 @@ EntryEventProc(ClientData clientData, XEvent *eventPtr) * +++ Initialization and cleanup. */ -static int +static void EntryInitialize(Tcl_Interp *interp, void *recordPtr) { Entry *entryPtr = recordPtr; @@ -960,8 +960,6 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr) entryPtr->entry.insertPos = 0; entryPtr->entry.selectFirst = -1; entryPtr->entry.selectLast = -1; - - return TCL_OK; } static void @@ -1827,13 +1825,13 @@ static Tk_OptionSpec ComboboxOptionSpecs[] = /* ComboboxInitialize -- * Initialization hook for combobox widgets. */ -static int +static void ComboboxInitialize(Tcl_Interp *interp, void *recordPtr) { Combobox *cb = recordPtr; TtkTrackElementState(&cb->core); ValuesInitialize(interp, recordPtr); - return EntryInitialize(interp, recordPtr); + EntryInitialize(interp, recordPtr); } /* ComboboxConfigure -- @@ -1941,14 +1939,14 @@ static Tk_OptionSpec SpinboxOptionSpecs[] = * Initialization hook for spinbox widgets. */ -static int +static void SpinboxInitialize(Tcl_Interp *interp, void *recordPtr) { Spinbox *sbPtr = recordPtr; sbPtr->spinbox.valueCount = 0; TtkTrackElementState(&sbPtr->core); ValuesInitialize(interp, recordPtr); - return EntryInitialize(interp, recordPtr); + EntryInitialize(interp, recordPtr); } /* diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index c0f5ed6..f7ac834 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -1,4 +1,4 @@ -/* $Id: ttkFrame.c,v 1.12 2008/01/08 20:02:27 jenglish Exp $ +/* $Id: ttkFrame.c,v 1.13 2008/11/09 23:53:09 jenglish Exp $ * Copyright (c) 2004, Joe English * * ttk::frame and ttk::labelframe widgets. @@ -515,7 +515,7 @@ static Ttk_ManagerSpec LabelframeManagerSpec = { /* LabelframeInitialize -- * Initialization hook. */ -static int LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) +static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) { Labelframe *lframe = recordPtr; @@ -524,8 +524,6 @@ static int LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) lframe->label.labelWidget = 0; lframe->label.labelLayout = 0; lframe->label.labelParcel = Ttk_MakeBox(-1,-1,-1,-1); - - return TCL_OK; } /* LabelframeCleanup -- diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 7018219..fe66308 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1,4 +1,4 @@ -/* $Id: ttkNotebook.c,v 1.15 2008/07/23 23:24:45 nijtmans Exp $ +/* $Id: ttkNotebook.c,v 1.16 2008/11/09 23:53:09 jenglish Exp $ * Copyright (c) 2004, Joe English */ @@ -1214,7 +1214,7 @@ static WidgetCommandSpec NotebookCommands[] = * +++ Widget class hooks. */ -static int NotebookInitialize(Tcl_Interp *interp, void *recordPtr) +static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) { Notebook *nb = recordPtr; @@ -1232,8 +1232,6 @@ static int NotebookInitialize(Tcl_Interp *interp, void *recordPtr) Tk_CreateEventHandler( nb->core.tkwin, NotebookEventMask, NotebookEventHandler, recordPtr); - - return TCL_OK; } static void NotebookCleanup(void *recordPtr) diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 9f83741..4b93e9a 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -1,4 +1,4 @@ -/* $Id: ttkPanedwindow.c,v 1.16 2008/07/23 23:24:45 nijtmans Exp $ +/* $Id: ttkPanedwindow.c,v 1.17 2008/11/09 23:53:09 jenglish Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * @@ -493,7 +493,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr) * +++ Initialization and cleanup hooks. */ -static int PanedInitialize(Tcl_Interp *interp, void *recordPtr) +static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) { Paned *pw = recordPtr; @@ -503,8 +503,6 @@ static int PanedInitialize(Tcl_Interp *interp, void *recordPtr) pw->paned.paneOptionTable = Tk_CreateOptionTable(interp,PaneOptionSpecs); pw->paned.sashLayout = 0; pw->paned.sashThickness = 1; - - return TCL_OK; } static void PanedCleanup(void *recordPtr) diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index b5883e1..2c6ff65 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -1,4 +1,4 @@ -/* $Id: ttkProgress.c,v 1.6 2008/04/27 22:41:12 dkf Exp $ +/* $Id: ttkProgress.c,v 1.7 2008/11/09 23:53:09 jenglish Exp $ * * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham * @@ -185,12 +185,11 @@ static void VariableChanged(void *recordPtr, const char *value) * +++ Widget class methods: */ -static int ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr) +static void ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr) { Progressbar *pb = recordPtr; pb->progress.variableTrace = 0; pb->progress.timer = 0; - return TCL_OK; } static void ProgressbarCleanup(void *recordPtr) diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 68438a2..bf1f1ea 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -1,4 +1,4 @@ -/* $Id: ttkScale.c,v 1.8 2008/04/27 22:41:12 dkf Exp $ +/* $Id: ttkScale.c,v 1.9 2008/11/09 23:53:09 jenglish Exp $ * Copyright (C) 2004 Pat Thoyts * * ttk::scale widget. @@ -100,12 +100,10 @@ static void ScaleVariableChanged(void *recordPtr, const char *value) /* ScaleInitialize -- * Scale widget initialization hook. */ -static int ScaleInitialize(Tcl_Interp *interp, void *recordPtr) +static void ScaleInitialize(Tcl_Interp *interp, void *recordPtr) { Scale *scalePtr = recordPtr; - TtkTrackElementState(&scalePtr->core); - return TCL_OK; } static void ScaleCleanup(void *recordPtr) diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 26656f2..36e3701 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -1,4 +1,4 @@ -/* $Id: ttkScrollbar.c,v 1.8 2008/04/27 22:41:12 dkf Exp $ +/* $Id: ttkScrollbar.c,v 1.9 2008/11/09 23:53:09 jenglish Exp $ * Copyright (c) 2003, Joe English * * ttk::scrollbar widget. @@ -49,7 +49,7 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] = * +++ Widget hooks. */ -static int +static void ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) { Scrollbar *sb = recordPtr; @@ -57,8 +57,6 @@ ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) sb->scrollbar.last = 1.0; TtkTrackElementState(&sb->core); - - return TCL_OK; } static Ttk_Layout ScrollbarGetLayout( diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 9284197..842375d 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1,4 +1,4 @@ -/* $Id: ttkTreeview.c,v 1.29 2008/07/23 23:24:45 nijtmans Exp $ +/* $Id: ttkTreeview.c,v 1.30 2008/11/09 23:53:09 jenglish Exp $ * Copyright (c) 2004, Joe English * * ttk::treeview widget implementation. @@ -985,7 +985,7 @@ static void TreeviewBindEventProc(void *clientData, XEvent *event) * +++ Initialization and cleanup. */ -static int TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) +static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) { Treeview *tv = recordPtr; int unused; @@ -1050,8 +1050,6 @@ static int TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) */ tv->tree.treeArea = tv->tree.headingArea = Ttk_MakeBox(0,0,0,0); tv->tree.slack = 0; - - return TCL_OK; } static void TreeviewCleanup(void *recordPtr) diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 51b345b..9d23198 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -1,4 +1,4 @@ -/* $Id: ttkWidget.c,v 1.15 2008/11/09 21:37:13 jenglish Exp $ +/* $Id: ttkWidget.c,v 1.16 2008/11/09 23:53:09 jenglish Exp $ * Copyright (c) 2003, Joe English * * Core widget utilities. @@ -406,8 +406,7 @@ int TtkWidgetConstructorObjCmd( if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK) goto error_nocleanup; - if (widgetSpec->initializeProc(interp, recordPtr) != TCL_OK) - goto error_nocleanup; + widgetSpec->initializeProc(interp, recordPtr); if (Tk_SetOptions(interp, recordPtr, optionTable, objc - 2, objv + 2, tkwin, NULL/*savePtr*/, NULL/*maskPtr*/) != TCL_OK) @@ -522,9 +521,8 @@ Ttk_Layout TtkWidgetGetOrientedLayout( /* TtkNullInitialize -- * Default widget initializeProc (no-op) */ -int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) +void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) { - return TCL_OK; } /* TtkNullPostConfigure -- diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index c74711d..f3a3e8d 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -1,4 +1,4 @@ -/* $Id: ttkWidget.h,v 1.10 2008/05/23 20:20:05 jenglish Exp $ +/* $Id: ttkWidget.h,v 1.11 2008/11/09 23:53:09 jenglish Exp $ * Copyright (c) 2003, Joe English * Helper routines for widget implementations. */ @@ -75,7 +75,7 @@ struct WidgetSpec_ /* * Hooks: */ - int (*initializeProc)(Tcl_Interp *, void *recordPtr); + void (*initializeProc)(Tcl_Interp *, void *recordPtr); void (*cleanupProc)(void *recordPtr); int (*configureProc)(Tcl_Interp *, void *recordPtr, int flags); int (*postConfigureProc)(Tcl_Interp *, void *recordPtr, int flags); @@ -88,7 +88,7 @@ struct WidgetSpec_ /* * Common factors for widget implementations: */ -MODULE_SCOPE int TtkNullInitialize(Tcl_Interp *, void *); +MODULE_SCOPE void TtkNullInitialize(Tcl_Interp *, void *); MODULE_SCOPE int TtkNullPostConfigure(Tcl_Interp *, void *, int); MODULE_SCOPE void TtkNullCleanup(void *recordPtr); MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout( -- cgit v0.12