Skip to content

Commit 18a6a85

Browse files
committed
Merge branch 'cb/git-gui-ttk-style'
"git gui" has been taught to work with old versions of tk (like 8.5.7) that do not support "ttk::style theme use" as a way to query the current theme. * cb/git-gui-ttk-style: git-gui: workaround ttk:style theme use
2 parents b1218e4 + 4891961 commit 18a6a85

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

git-gui/lib/themed.tcl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Functions for supporting the use of themed Tk widgets in git-gui.
22
# Copyright (C) 2009 Pat Thoyts <[email protected]>
33

4+
proc ttk_get_current_theme {} {
5+
# Handle either current Tk or older versions of 8.5
6+
if {[catch {set theme [ttk::style theme use]}]} {
7+
set theme $::ttk::currentTheme
8+
}
9+
return $theme
10+
}
11+
412
proc InitTheme {} {
513
# Create a color label style (bg can be overridden by widget option)
614
ttk::style layout Color.TLabel {
@@ -28,10 +36,7 @@ proc InitTheme {} {
2836
}
2937
}
3038

31-
# Handle either current Tk or older versions of 8.5
32-
if {[catch {set theme [ttk::style theme use]}]} {
33-
set theme $::ttk::currentTheme
34-
}
39+
set theme [ttk_get_current_theme]
3540

3641
if {[lsearch -exact {default alt classic clam} $theme] != -1} {
3742
# Simple override of standard ttk::entry to change the field
@@ -248,7 +253,7 @@ proc tspinbox {w args} {
248253
proc ttext {w args} {
249254
global use_ttk
250255
if {$use_ttk} {
251-
switch -- [ttk::style theme use] {
256+
switch -- [ttk_get_current_theme] {
252257
"vista" - "xpnative" {
253258
lappend args -highlightthickness 0 -borderwidth 0
254259
}

0 commit comments

Comments
 (0)