From 011e9715c03060cc192949137206d00055032c33 Mon Sep 17 00:00:00 2001 From: csaba Date: Fri, 10 May 2024 17:40:14 +0000 Subject: Backported most improvements related to the "classic" theme, submitted by Emiliano Gavilan. --- generic/ttk/ttkClassicTheme.c | 61 +++++++++++++++++++++++++++++++++++-------- generic/ttk/ttkElements.c | 26 +++++++++++++----- generic/ttk/ttkEntry.c | 12 ++++----- library/ttk/classicTheme.tcl | 24 ++++++++++------- 4 files changed, 89 insertions(+), 34 deletions(-) diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 854ef78..279ac1a 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -19,6 +19,7 @@ typedef struct { Tcl_Obj *highlightColorObj; Tcl_Obj *highlightThicknessObj; + Tcl_Obj *defaultStateObj; } HighlightElement; static Ttk_ElementOptionSpec HighlightElementOptions[] = { @@ -26,6 +27,8 @@ static Ttk_ElementOptionSpec HighlightElementOptions[] = { Tk_Offset(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, Tk_Offset(HighlightElement,highlightThicknessObj), "0" }, + { "-default", TK_OPTION_ANY, + offsetof(HighlightElement,defaultStateObj), "disabled" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; @@ -40,7 +43,8 @@ static void HighlightElementSize( HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; - Tk_GetPixelsFromObj(NULL, tkwin, hl->highlightThicknessObj, &highlightThickness); + Tk_GetPixelsFromObj(NULL, tkwin, hl->highlightThicknessObj, + &highlightThickness); *paddingPtr = Ttk_UniformPadding((short)highlightThickness); } @@ -55,11 +59,19 @@ static void HighlightElementDraw( HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj); + Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; - Tk_GetPixelsFromObj(NULL, tkwin, hl->highlightThicknessObj, &highlightThickness); + Tk_GetPixelsFromObj(NULL, tkwin, hl->highlightThicknessObj, + &highlightThickness); if (highlightColor && highlightThickness > 0) { + Ttk_GetButtonDefaultStateFromObj(NULL, hl->defaultStateObj, + (int *)&defaultState); GC gc = Tk_GCForColor(highlightColor, d); - Tk_DrawFocusHighlight(tkwin, gc, highlightThickness, d); + if (defaultState == TTK_BUTTON_DEFAULT_NORMAL) { + TkDrawInsetFocusHighlight(tkwin, gc, highlightThickness, d, 5); + } else { + Tk_DrawFocusHighlight(tkwin, gc, highlightThickness, d); + } } } @@ -471,17 +483,44 @@ TTK_LAYOUT("TEntry", TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))) -/* Notebook tabs -- omit focus ring */ -TTK_LAYOUT("Tab", - TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, - TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, - TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) +/* "classic" combobox, includes highlight border */ +TTK_LAYOUT("TCombobox", + TTK_GROUP("Combobox.highlight", TTK_FILL_BOTH, + TTK_GROUP("Combobox.field", TTK_FILL_BOTH, + TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) + TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, + TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) + +/* "classic" spinbox, includes highlight border */ +TTK_LAYOUT("TSpinbox", + TTK_GROUP("Spinbox.highlight", TTK_FILL_BOTH, + TTK_GROUP("Spinbox.field", TTK_FILL_BOTH|TTK_FILL_X, + TTK_GROUP("null", TTK_PACK_RIGHT, + TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E) + TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E)) + TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH, + TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH))))) + +/* "classic" scale, includes highlight border */ +TTK_LAYOUT("Vertical.TScale", + TTK_GROUP("Vertical.Scale.highlight", TTK_FILL_BOTH, + TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH, + TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP)))) + +TTK_LAYOUT("Horizontal.TScale", + TTK_GROUP("Horizontal.Scale.highlight", TTK_FILL_BOTH, + TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, + TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT)))) + +/* put highlight border around treeview */ +TTK_LAYOUT("Treeview", + TTK_GROUP("Treeview.highlight", TTK_FILL_BOTH, + TTK_GROUP("Treeview.field", TTK_FILL_BOTH|TTK_BORDER, + TTK_GROUP("Treeview.padding", TTK_FILL_BOTH, + TTK_NODE("Treeview.treearea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE -/* POSSIBLY: include Scale layouts w/focus border - */ - /*------------------------------------------------------------------------ * TtkClassicTheme_Init -- * Install classic theme. diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 19bd71a..126feb1 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -274,6 +274,7 @@ static Ttk_ElementSpec PaddingElementSpec = { typedef struct { Tcl_Obj *focusColorObj; Tcl_Obj *focusThicknessObj; + Tcl_Obj *focusSolidObj; } FocusElement; /* @@ -281,7 +282,8 @@ typedef struct { * Draw a dotted rectangle to indicate focus. */ static void DrawFocusRing( - Tk_Window tkwin, Drawable d, Tcl_Obj *colorObj, Ttk_Box b) + Tk_Window tkwin, Drawable d, Tcl_Obj *colorObj, int thickness, int solid, + Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, colorObj); unsigned long mask = 0UL; @@ -289,11 +291,16 @@ static void DrawFocusRing( GC gc; gcvalues.foreground = color->pixel; - gcvalues.line_style = LineOnOffDash; - gcvalues.line_width = 1; - gcvalues.dashes = 1; - gcvalues.dash_offset = 1; - mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth; + gcvalues.line_width = thickness < 1 ? 1 : thickness; + if (solid) { + gcvalues.line_style = LineSolid; + mask = GCForeground | GCLineStyle | GCLineWidth; + } else { + gcvalues.line_style = LineOnOffDash; + gcvalues.dashes = 1; + gcvalues.dash_offset = 1; + mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth; + } gc = Tk_GetGC(tkwin, mask, &gcvalues); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); @@ -305,6 +312,8 @@ static Ttk_ElementOptionSpec FocusElementOptions[] = { Tk_Offset(FocusElement,focusColorObj), "black" }, { "-focusthickness",TK_OPTION_PIXELS, Tk_Offset(FocusElement,focusThicknessObj), "1" }, + { "-focussolid",TK_OPTION_BOOLEAN, + offsetof(FocusElement,focusSolidObj), "0" }, { NULL, 0, 0, NULL } }; @@ -325,10 +334,13 @@ static void FocusElementDraw( { FocusElement *focus = elementRecord; int focusThickness = 0; + int focusSolid = 0; if (state & TTK_STATE_FOCUS) { Tk_GetPixelsFromObj(NULL, tkwin, focus->focusThicknessObj, &focusThickness); - DrawFocusRing(tkwin, d, focus->focusColorObj, b); + Tcl_GetBooleanFromObj(NULL, focus->focusSolidObj, &focusSolid); + DrawFocusRing(tkwin, d, focus->focusColorObj, focusThickness, + focusSolid, b); } } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 85ec1da..4ff6716 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -2123,12 +2123,12 @@ TTK_BEGIN_LAYOUT(ComboboxLayout) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(SpinboxLayout) - TTK_GROUP("Spinbox.field", TTK_PACK_TOP|TTK_FILL_X, - TTK_GROUP("null", TTK_PACK_RIGHT, - TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E) - TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E)) - TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH, - TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH))) + TTK_GROUP("Spinbox.field", TTK_PACK_TOP|TTK_FILL_X, + TTK_GROUP("null", TTK_PACK_RIGHT, + TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E) + TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E)) + TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH, + TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT /*------------------------------------------------------------------------ diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index f237fba..2fcfd57 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -6,11 +6,12 @@ namespace eval ttk::theme::classic { - variable colors; array set colors { + variable colors + array set colors { -frame "#d9d9d9" -window "#ffffff" -activebg "#ececec" - -troughbg "#c3c3c3" + -troughbg "#b3b3b3" -selectbg "#c3c3c3" -selectfg "#000000" -disabledfg "#a3a3a3" @@ -31,7 +32,7 @@ namespace eval ttk::theme::classic { -highlightthickness 1 \ -selectborderwidth 1 \ -insertwidth 2 \ - ; + -borderwidth 1 # To match pre-Xft X11 appearance, use: # ttk::style configure . -font {Helvetica 12 bold} @@ -53,8 +54,7 @@ namespace eval ttk::theme::classic { pressed $colors(-frame) \ alternate $colors(-altindicator) \ selected $colors(-indicator)] \ - -indicatorrelief {alternate raised selected sunken pressed sunken} \ - ; + -indicatorrelief {alternate raised selected sunken pressed sunken} ttk::style configure TRadiobutton -indicatorrelief raised ttk::style map TRadiobutton \ @@ -62,27 +62,30 @@ namespace eval ttk::theme::classic { pressed $colors(-frame) \ alternate $colors(-altindicator) \ selected $colors(-indicator)] \ - -indicatorrelief {alternate raised selected sunken pressed sunken} \ - ; + -indicatorrelief {alternate raised selected sunken pressed sunken} ttk::style configure TMenubutton -relief raised -padding "3m 1m" ttk::style configure TEntry -relief sunken -padding 1 -font TkTextFont ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] - ttk::style configure TCombobox -padding 1 + + ttk::style element create Combobox.downarrow from default + ttk::style configure TCombobox -padding 1 -arrowsize 12 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 + ttk::style element create Spinbox.uparrow from default + ttk::style element create Spinbox.downarrow from default ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} ttk::style map TSpinbox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TLabelframe -borderwidth 2 -relief groove - ttk::style configure TScrollbar -relief raised + ttk::style configure TScrollbar -relief raised -arrowsize 12 -width 12 ttk::style map TScrollbar -relief {{pressed !disabled} sunken} ttk::style configure TScale -sliderrelief raised @@ -91,7 +94,8 @@ namespace eval ttk::theme::classic { ttk::style configure TProgressbar -background SteelBlue ttk::style configure TNotebook.Tab \ -padding {3m 1m} \ - -background $colors(-troughbg) + -background $colors(-troughbg) \ + -focussolid 1 ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: -- cgit v0.12 From caa2d058af16a9fedfd454550c9fc195131bda31 Mon Sep 17 00:00:00 2001 From: csaba Date: Sat, 11 May 2024 17:31:13 +0000 Subject: Backported the focus highlighting for the ttk::entry, ttk::combobox, and ttk::spinbox widgets of the themes default, alt, and clam. --- generic/ttk/ttkDefaultTheme.c | 61 +++++++++++++++++++++-- generic/ttk/ttkElements.c | 111 +++++++++++++++++++++++++++++++++++++++--- library/ttk/altTheme.tcl | 26 +++++----- library/ttk/clamTheme.tcl | 31 ++++++------ library/ttk/classicTheme.tcl | 3 +- library/ttk/defaults.tcl | 19 ++++++-- tests/ttk/entry.test | 2 +- 7 files changed, 204 insertions(+), 49 deletions(-) diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index 302e872..1e87c7e 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -330,6 +330,8 @@ static Ttk_ElementSpec BorderElementSpec = { typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra border color */ + Tcl_Obj *focusWidthObj; + Tcl_Obj *focusColorObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { @@ -337,6 +339,10 @@ static Ttk_ElementOptionSpec FieldElementOptions[] = { "white" }, { "-bordercolor",TK_OPTION_COLOR, Tk_Offset(FieldElement,borderColorObj), "black" }, + { "-focuswidth", TK_OPTION_PIXELS, offsetof(FieldElement,focusWidthObj), + "2" }, + { "-focuscolor", TK_OPTION_COLOR, offsetof(FieldElement,focusColorObj), + "#4a6984" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; @@ -359,10 +365,57 @@ static void FieldElementDraw( FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, field->borderColorObj); - - Tk_Fill3DRectangle( - tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_SUNKEN); - DrawFieldBorder(tkwin, d, border, borderColor, b); + int focusWidth = 2; + + Tk_GetPixelsFromObj(NULL, tkwin, field->focusWidthObj, &focusWidth); + + if (focusWidth > 0 && (state & TTK_STATE_FOCUS)) { + Display *disp = Tk_Display(tkwin); + XColor *focusColor = Tk_GetColorFromObj(tkwin, field->focusColorObj); + GC focusGC = Tk_GCForColor(focusColor, d); + + if (focusWidth > 1) { + int x1 = b.x, x2 = b.x + b.width - 1; + int y1 = b.y, y2 = b.y + b.height - 1; + int w = WIN32_XDRAWLINE_HACK; + + /* + * Draw the outer rounded rectangle + */ + XDrawLine(disp, d, focusGC, x1+1, y1, x2-1+w, y1); /* N */ + XDrawLine(disp, d, focusGC, x1+1, y2, x2-1+w, y2); /* S */ + XDrawLine(disp, d, focusGC, x1, y1+1, x1, y2-1+w); /* W */ + XDrawLine(disp, d, focusGC, x2, y1+1, x2, y2-1+w); /* E */ + + /* + * Draw the inner rectangle + */ + b.x += 1; b.y += 1; b.width -= 2; b.height -= 2; + XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); + + /* + * Fill the inner rectangle + */ + GC bgGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); + XFillRectangle(disp, d, bgGC, b.x+1, b.y+1, b.width-2, b.height-2); + } else { + /* + * Draw the field element as usual + */ + Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, + 0, TK_RELIEF_SUNKEN); + DrawFieldBorder(tkwin, d, border, borderColor, b); + + /* + * Change the color of the border's outermost pixels + */ + XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); + } + } else { + Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, + 0, TK_RELIEF_SUNKEN); + DrawFieldBorder(tkwin, d, border, borderColor, b); + } } static Ttk_ElementSpec FieldElementSpec = { diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 126feb1..543429b 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -176,6 +176,8 @@ static Ttk_ElementSpec BorderElementSpec = { typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; + Tcl_Obj *focusWidthObj; + Tcl_Obj *focusColorObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { @@ -183,6 +185,10 @@ static Ttk_ElementOptionSpec FieldElementOptions[] = { Tk_Offset(FieldElement,borderObj), "white" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(FieldElement,borderWidthObj), "2" }, + { "-focuswidth", TK_OPTION_PIXELS, + offsetof(FieldElement,focusWidthObj), "2" }, + { "-focuscolor", TK_OPTION_COLOR, + offsetof(FieldElement,focusColorObj), "#4a6984" }, { NULL, 0, 0, NULL } }; @@ -190,9 +196,14 @@ static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - FieldElement *field = elementRecord; - int borderWidth = 2; + FieldElement *field = (FieldElement *)elementRecord; + int borderWidth = 2, focusWidth = 2; + Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); + Tk_GetPixelsFromObj(NULL, tkwin, field->focusWidthObj, &focusWidth); + if (focusWidth > 0 && borderWidth < 2) { + borderWidth += (focusWidth - borderWidth); + } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } @@ -200,13 +211,62 @@ static void FieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); - int borderWidth = 2; - - Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); - Tk_Fill3DRectangle(tkwin, d, border, - b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN); + int focusWidth = 2; + + Tk_GetPixelsFromObj(NULL, tkwin, field->focusWidthObj, &focusWidth); + + if (focusWidth > 0 && (state & TTK_STATE_FOCUS)) { + Display *disp = Tk_Display(tkwin); + XColor *focusColor = Tk_GetColorFromObj(tkwin, field->focusColorObj); + GC focusGC = Tk_GCForColor(focusColor, d); + + if (focusWidth > 1) { + int x1 = b.x, x2 = b.x + b.width - 1; + int y1 = b.y, y2 = b.y + b.height - 1; + int w = WIN32_XDRAWLINE_HACK; + + /* + * Draw the outer rounded rectangle + */ + XDrawLine(disp, d, focusGC, x1+1, y1, x2-1+w, y1); /* N */ + XDrawLine(disp, d, focusGC, x1+1, y2, x2-1+w, y2); /* S */ + XDrawLine(disp, d, focusGC, x1, y1+1, x1, y2-1+w); /* W */ + XDrawLine(disp, d, focusGC, x2, y1+1, x2, y2-1+w); /* E */ + + /* + * Draw the inner rectangle + */ + b.x += 1; b.y += 1; b.width -= 2; b.height -= 2; + XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); + + /* + * Fill the inner rectangle + */ + GC bgGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); + XFillRectangle(disp, d, bgGC, b.x+1, b.y+1, b.width-2, b.height-2); + } else { + /* + * Draw the field element as usual + */ + int borderWidth = 2; + Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, + &borderWidth); + Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, + borderWidth, TK_RELIEF_SUNKEN); + + /* + * Change the color of the border's outermost pixels + */ + XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); + } + } else { + int borderWidth = 2; + Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); + Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, + borderWidth, TK_RELIEF_SUNKEN); + } } static Ttk_ElementSpec FieldElementSpec = { @@ -1206,6 +1266,8 @@ static Ttk_ElementSpec PbarElementSpec = { typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *backgroundObj; + Tcl_Obj *highlightObj; + Tcl_Obj *highlightColorObj; } TabElement; static Ttk_ElementOptionSpec TabElementOptions[] = { @@ -1213,6 +1275,10 @@ static Ttk_ElementOptionSpec TabElementOptions[] = { Tk_Offset(TabElement,borderWidthObj), "1" }, { "-background", TK_OPTION_BORDER, Tk_Offset(TabElement,backgroundObj), DEFAULT_BACKGROUND }, + { "-highlight", TK_OPTION_BOOLEAN, + offsetof(TabElement,highlightObj), "0" }, + { "-highlightcolor", TK_OPTION_COLOR, + offsetof(TabElement,highlightColorObj), "#4a6984" }, {0,TK_OPTION_BOOLEAN,0,0} }; @@ -1261,6 +1327,8 @@ static void TabElementDraw( TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; TabElement *tab = (TabElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); + int highlight = 0; + XColor *hlColor = NULL; XPoint pts[6]; int cut = 2; Display *disp = Tk_Display(tkwin); @@ -1290,6 +1358,11 @@ static void TabElementDraw( b.width += 1; b.x -= 1; break; } + + Tcl_GetBooleanFromObj(NULL, tab->highlightObj, &highlight); + if (highlight) { + hlColor = Tk_GetColorFromObj(tkwin, tab->highlightColorObj); + } } switch (nbTabsStickBit) { @@ -1374,6 +1447,28 @@ static void TabElementDraw( break; } } + + if (highlight) { + switch (nbTabsStickBit) { + default: + case TTK_STICK_S: + XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), + b.x + cut, b.y, b.width - 2*cut, cut); + break; + case TTK_STICK_N: + XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), + b.x + cut, b.y + b.height - cut, b.width - 2*cut, cut); + break; + case TTK_STICK_E: + XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), + b.x, b.y + cut, cut, b.height - 2*cut); + break; + case TTK_STICK_W: + XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), + b.x + b.width - cut, b.y + cut, cut, b.height - 2*cut); + break; + } + } } static Ttk_ElementSpec TabElementSpec = { diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index 80ef415..8c0bfd6 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -26,8 +26,7 @@ namespace eval ttk::theme::alt { -bordercolor $colors(-border) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ - -font TkDefaultFont \ - ; + -font TkDefaultFont ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ; @@ -38,7 +37,6 @@ namespace eval ttk::theme::alt { -anchor center -width -11 -padding "1 1" \ -relief raised -shiftrelief 1 \ -highlightthickness 1 -highlightcolor $colors(-frame) - ttk::style map TButton -relief { {pressed !disabled} sunken {active !disabled} raised @@ -58,17 +56,20 @@ namespace eval ttk::theme::alt { ttk::style configure TMenubutton \ -width -11 -padding "3 3" -relief raised - ttk::style configure TEntry -padding 1 + ttk::style configure TEntry -padding 1 \ + -focuswidth 2 -focuscolor $colors(-selectbg) ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] - ttk::style configure TCombobox -padding 1 + + ttk::style configure TCombobox -padding 1 \ + -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] - ttk::style configure ComboboxPopdownFrame \ - -relief solid -borderwidth 1 + ttk::style configure ComboboxPopdownFrame -relief solid -borderwidth 1 - ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} \ + -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TSpinbox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] @@ -84,12 +85,11 @@ namespace eval ttk::theme::alt { ttk::style configure TLabelframe -relief groove -borderwidth 2 ttk::style configure TNotebook -tabmargins {2 2 1 0} - ttk::style configure TNotebook.Tab \ - -padding {4 2} -background $colors(-darker) + ttk::style configure TNotebook.Tab -background $colors(-darker) \ + -padding {4 2} ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] \ -expand [list selected {2 2 1 0}] \ - ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised @@ -101,8 +101,8 @@ namespace eval ttk::theme::alt { selected $colors(-selectfg)] ttk::style configure TScale \ - -groovewidth 4 -troughrelief sunken \ - -sliderwidth raised -borderwidth 2 + -groovewidth 4 -troughrelief sunken -borderwidth 2 + ttk::style configure TProgressbar \ -background $colors(-selectbg) -borderwidth 0 } diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl index bfcb194..fda7234 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -5,6 +5,7 @@ # namespace eval ttk::theme::clam { + variable colors array set colors { -disabledfg "#999999" @@ -33,16 +34,15 @@ namespace eval ttk::theme::clam { -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -selectborderwidth 0 \ - -font TkDefaultFont \ - ; + -font TkDefaultFont ttk::style map "." \ -background [list disabled $colors(-frame) \ active $colors(-lighter)] \ -foreground [list disabled $colors(-disabledfg)] \ -selectbackground [list !focus $colors(-darkest)] \ - -selectforeground [list !focus white] \ - ; + -selectforeground [list !focus white] + # -selectbackground [list !focus "#847d73"] ttk::style configure TButton \ @@ -54,8 +54,7 @@ namespace eval ttk::theme::clam { active $colors(-lighter)] \ -lightcolor [list pressed $colors(-darker)] \ -darkcolor [list pressed $colors(-darker)] \ - -bordercolor [list alternate "#000000"] \ - ; + -bordercolor [list alternate "#000000"] ttk::style configure Toolbutton \ -anchor center -padding 2 -relief flat @@ -70,17 +69,16 @@ namespace eval ttk::theme::clam { pressed $colors(-darker) \ active $colors(-lighter)] \ -lightcolor [list pressed $colors(-darker)] \ - -darkcolor [list pressed $colors(-darker)] \ - ; + -darkcolor [list pressed $colors(-darker)] ttk::style configure TCheckbutton \ -indicatorbackground "#ffffff" \ -indicatormargin {1 1 4 1} \ - -padding 2 ; + -padding 2 ttk::style configure TRadiobutton \ -indicatorbackground "#ffffff" \ -indicatormargin {1 1 4 1} \ - -padding 2 ; + -padding 2 ttk::style map TCheckbutton -indicatorbackground \ [list pressed $colors(-frame) \ {!disabled alternate} $colors(-altindicator) \ @@ -99,9 +97,7 @@ namespace eval ttk::theme::clam { ttk::style map TEntry \ -background [list readonly $colors(-frame)] \ -bordercolor [list focus $colors(-selectbg)] \ - -lightcolor [list focus "#6f9dc6"] \ - -darkcolor [list focus "#6f9dc6"] \ - ; + -lightcolor [list focus "#6f9dc6"] ttk::style configure TCombobox -padding 1 -insertwidth 1 ttk::style map TCombobox \ @@ -110,21 +106,22 @@ namespace eval ttk::theme::clam { -fieldbackground [list {readonly focus} $colors(-selectbg) \ readonly $colors(-frame)] \ -foreground [list {readonly focus} $colors(-selectfg)] \ - -arrowcolor [list disabled $colors(-disabledfg)] + -arrowcolor [list disabled $colors(-disabledfg)] \ + -bordercolor [list focus $colors(-selectbg)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} ttk::style map TSpinbox \ -background [list readonly $colors(-frame)] \ - -arrowcolor [list disabled $colors(-disabledfg)] + -arrowcolor [list disabled $colors(-disabledfg)] \ + -bordercolor [list focus $colors(-selectbg)] ttk::style configure TNotebook.Tab -padding {6 2 6 2} ttk::style map TNotebook.Tab \ -padding [list selected {6 4 6 2}] \ -background [list selected $colors(-frame) {} $colors(-darker)] \ - -lightcolor [list selected $colors(-lighter) {} $colors(-dark)] \ - ; + -lightcolor [list selected $colors(-lighter) {} $colors(-dark)] # Treeview: ttk::style configure Heading \ diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index 2fcfd57..a19751e 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -32,7 +32,8 @@ namespace eval ttk::theme::classic { -highlightthickness 1 \ -selectborderwidth 1 \ -insertwidth 2 \ - -borderwidth 1 + -borderwidth 1 \ + -focuswidth 0 # To match pre-Xft X11 appearance, use: # ttk::style configure . -font {Helvetica 12 bold} diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index 2db9a37..b68f501 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -28,7 +28,7 @@ namespace eval ttk::theme::default { -foreground $colors(-foreground) \ -troughcolor $colors(-darker) \ -font TkDefaultFont \ - -selectborderwidth 1 \ + -selectborderwidth 0 \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -insertwidth 1 \ @@ -71,16 +71,23 @@ namespace eval ttk::theme::default { -relief raised -padding "10 3" ttk::style configure TEntry \ - -relief sunken -fieldbackground white -padding 1 + -fieldbackground white -padding 1 \ + -focuswidth 2 -focuscolor $colors(-selectbg) ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] - ttk::style configure TCombobox -arrowsize 12 -padding 1 + ttk::style configure TCombobox \ + -arrowsize 12 -arrowcolor black \ + -fieldbackground white -padding 1 \ + -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] - ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} + ttk::style configure TSpinbox \ + -arrowsize 10 -arrowcolor black \ + -fieldbackground white -padding {2 0 10 0} \ + -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TSpinbox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] @@ -101,7 +108,9 @@ namespace eval ttk::theme::default { ttk::style configure TNotebook.Tab \ -padding {4 2} -background $colors(-darker) ttk::style map TNotebook.Tab \ - -background [list selected $colors(-frame)] + -background [list selected $colors(-frame)] \ + -highlight [list selected 1] \ + -highlightcolor [list selected $colors(-selectbg)] # Treeview. # diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 46e08b8..59ae992 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -107,7 +107,7 @@ test entry-3.0 "Series 3 setup" -body { variable fixed TkFixedFont variable cw [font measure $fixed a] variable ch [font metrics $fixed -linespace] - variable bd 2 ;# border + padding + variable bd 3 ;# border + padding + extra space for focus ring variable ux [font measure $fixed \u4e4e] pack [ttk::entry .e -font $fixed -width 20] -- cgit v0.12 From 5c8f06b4fd10909dce43f80fbb67e2c1deddb26a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 11 May 2024 23:24:15 +0000 Subject: Two more Tk_GetPixelsFromObj usages. Remove double MODULE_SCOPE definitions. All backported --- generic/ttk/ttkButton.c | 4 ++-- generic/ttk/ttkDefaultTheme.c | 4 +++- generic/ttk/ttkElements.c | 8 ++++---- generic/ttk/ttkEntry.c | 5 +++-- generic/ttk/ttkFrame.c | 4 ++-- generic/ttk/ttkImage.c | 4 ++-- generic/ttk/ttkLabel.c | 4 ++-- generic/ttk/ttkLayout.c | 1 + generic/ttk/ttkNotebook.c | 4 ++-- generic/ttk/ttkPanedwindow.c | 11 ++++++----- generic/ttk/ttkProgress.c | 4 ++-- generic/ttk/ttkScale.c | 5 +++-- generic/ttk/ttkScrollbar.c | 4 ++-- generic/ttk/ttkSeparator.c | 4 ++-- generic/ttk/ttkTheme.c | 12 ++++++------ generic/ttk/ttkTreeview.c | 4 ++-- macosx/tkMacOSXTest.c | 1 + macosx/ttkMacOSXTheme.c | 4 ++-- win/ttkWinTheme.c | 4 ++-- win/ttkWinXPTheme.c | 3 ++- 20 files changed, 51 insertions(+), 43 deletions(-) diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index b096f63..a02bfa5 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -863,8 +863,8 @@ TTK_END_LAYOUT * +++ Initialization. */ -MODULE_SCOPE -void TtkButton_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkButton_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index 1e87c7e..58bf85a 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -1321,7 +1321,9 @@ static Ttk_ElementSpec TreeitemIndicatorElementSpec = { * TtkAltTheme_Init -- * Install alternate theme. */ -MODULE_SCOPE int TtkAltTheme_Init(Tcl_Interp *interp) + +MODULE_SCOPE int +TtkAltTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "alt", NULL); diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 543429b..f136a21 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -299,7 +299,7 @@ static Ttk_ElementOptionSpec PaddingElementOptions[] = { Tk_Offset(PaddingElement,paddingObj), "0" }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(PaddingElement,reliefObj), "flat" }, - { "-shiftrelief", TK_OPTION_INT, + { "-shiftrelief", TK_OPTION_PIXELS, Tk_Offset(PaddingElement,shiftreliefObj), "0" }, { NULL, 0, 0, NULL } }; @@ -314,7 +314,7 @@ static void PaddingElementSize( Ttk_Padding pad; Tk_GetReliefFromObj(NULL, padding->reliefObj, &relief); - Tcl_GetIntFromObj(NULL, padding->shiftreliefObj, &shiftRelief); + Tk_GetPixelsFromObj(NULL, tkwin, padding->shiftreliefObj, &shiftRelief); Ttk_GetPaddingFromObj(NULL,tkwin,padding->paddingObj,&pad); *paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief); } @@ -1529,8 +1529,8 @@ static Ttk_ElementSpec ClientElementSpec = { * Register default element implementations. */ -MODULE_SCOPE -void TtkElements_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkElements_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 4ff6716..2ee148a 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -2134,8 +2134,9 @@ TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ -MODULE_SCOPE -void TtkEntry_Init(Tcl_Interp *interp) + +MODULE_SCOPE void +TtkEntry_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index b8b3477..0570502 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -654,8 +654,8 @@ TTK_END_LAYOUT * +++ Initialization. */ -MODULE_SCOPE -void TtkFrame_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkFrame_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index c47e432..7de4d92 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -445,8 +445,8 @@ error: return TCL_ERROR; } -MODULE_SCOPE -void TtkImage_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkImage_Init(Tcl_Interp *interp) { Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL); } diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 850ad2b..c34d479 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -710,8 +710,8 @@ static Ttk_ElementSpec LabelElementSpec = { * +++ Initialization. */ -MODULE_SCOPE -void TtkLabel_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkLabel_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index d4c14f3..3e77ba4 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -257,6 +257,7 @@ Ttk_Box Ttk_PlaceBox( * Ttk_PositionBox -- * Pack and stick a box according to PositionSpec flags. */ + MODULE_SCOPE Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int width, int height, Ttk_PositionSpec flags) { diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 600eca9..160740d 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1425,8 +1425,8 @@ TTK_END_LAYOUT * +++ Initialization. */ -MODULE_SCOPE -void TtkNotebook_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkNotebook_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index eae99a2..f3ac1dc 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -925,7 +925,7 @@ typedef struct { } SashElement; static Ttk_ElementOptionSpec SashElementOptions[] = { - { "-sashthickness", TK_OPTION_INT, + { "-sashthickness", TK_OPTION_PIXELS, Tk_Offset(SashElement,thicknessObj), "5" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; @@ -933,7 +933,7 @@ static Ttk_ElementOptionSpec SashElementOptions[] = { static void SashElementSize( TCL_UNUSED(void *), void *elementRecord, - TCL_UNUSED(Tk_Window), + Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) @@ -941,7 +941,7 @@ static void SashElementSize( SashElement *sash = (SashElement *)elementRecord; int thickness = DEFAULT_SASH_THICKNESS; - Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); + Tk_GetPixelsFromObj(NULL, tkwin, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } @@ -968,8 +968,9 @@ TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Registration routine. */ -MODULE_SCOPE -void TtkPanedwindow_Init(Tcl_Interp *interp) + +MODULE_SCOPE void +TtkPanedwindow_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); RegisterWidget(interp, "ttk::panedwindow", &PanedWidgetSpec); diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index d83603a..0b6d30f 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -542,8 +542,8 @@ TTK_END_LAYOUT * Initialization: */ -MODULE_SCOPE -void TtkProgressbar_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkProgressbar_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 34ed2e1..a80d6e8 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -522,8 +522,9 @@ TTK_END_LAYOUT /* * Initialization. */ -MODULE_SCOPE -void TtkScale_Init(Tcl_Interp *interp) + +MODULE_SCOPE void +TtkScale_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 7663b6b..31f291a 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -331,8 +331,8 @@ TTK_END_LAYOUT * +++ Initialization. */ -MODULE_SCOPE -void TtkScrollbar_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkScrollbar_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c index 6e305fe..26c169f 100644 --- a/generic/ttk/ttkSeparator.c +++ b/generic/ttk/ttkSeparator.c @@ -120,8 +120,8 @@ TTK_END_LAYOUT /* +++ Initialization: */ -MODULE_SCOPE -void TtkSeparator_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkSeparator_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 3cea404..730de5d 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -679,8 +679,8 @@ Ttk_GetResourceCache(Tcl_Interp *interp) * Register a new layout specification with a style. * @@@ TODO: Make sure layoutName is not ".", root style must not have a layout */ -MODULE_SCOPE -void Ttk_RegisterLayoutTemplate( +MODULE_SCOPE void +Ttk_RegisterLayoutTemplate( Ttk_Theme theme, /* Target theme */ const char *layoutName, /* Name of new layout */ Ttk_LayoutTemplate layoutTemplate) /* Template */ @@ -1143,8 +1143,8 @@ Ttk_DrawElement( * Side effects: Sets interp's result. */ -MODULE_SCOPE -int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) +MODULE_SCOPE int +TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) { Tcl_HashSearch search; Tcl_Obj *result = Tcl_NewListObj(0, NULL); @@ -1692,8 +1692,8 @@ StyleObjCmd( return Ttk_InvokeEnsemble(StyleEnsemble, 1, clientData,interp,objc,objv); } -MODULE_SCOPE -int Ttk_InvokeEnsemble( /* Run an ensemble command */ +MODULE_SCOPE int +Ttk_InvokeEnsemble( /* Run an ensemble command */ const Ttk_Ensemble *ensemble, int cmdIndex, void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index ce37e04..0d441e2 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -3479,8 +3479,8 @@ static Ttk_ElementSpec RowElementSpec = { * +++ Initialisation. */ -MODULE_SCOPE -void TtkTreeview_Init(Tcl_Interp *interp) +MODULE_SCOPE void +TtkTreeview_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index ad3b108..e7e2a7e 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -146,6 +146,7 @@ MenuBarHeightObjCmd( * *---------------------------------------------------------------------- */ + MODULE_SCOPE Bool TkTestLogDisplay( Drawable drawable) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index c6857b3..5465bec 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -3333,8 +3333,8 @@ static int AquaTheme_Init( return TCL_OK; } -MODULE_SCOPE -int Ttk_MacOSXPlatformInit( +MODULE_SCOPE int +Ttk_MacOSXPlatformInit( Tcl_Interp *interp) { return AquaTheme_Init(interp); diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 6288da1..79f115f 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -940,8 +940,8 @@ TTK_END_LAYOUT_TABLE /* ---------------------------------------------------------------------- */ -MODULE_SCOPE -int TtkWinTheme_Init( +MODULE_SCOPE int +TtkWinTheme_Init( Tcl_Interp *interp, TCL_UNUSED(HWND)) { diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 179bf0e..b01bdcd 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1404,7 +1404,8 @@ retErr: * +++ Initialization routine: */ -MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) +MODULE_SCOPE int +TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { XPThemeData *themeData; XPThemeProcs *procs; -- cgit v0.12