git-gui: workaround ttk:style theme use

Tk 8.5.7, which is the latest version on Centos 6, does not support getting the current theme with [ttk::style theme use]. Use the existing workaround for this in all places. Signed-off-by: Clemens Buchacher <drizzd@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Clemens Buchacher committed Mar 3, 2018 at 23:39 UTC f50d5055bf9bb2aa35e629d31943334afc4a9f10
1 file changed +10 -5
lib/themed.tcl
+10 -5
@@ -1,6 +1,14 @@
1 # Functions for supporting the use of themed Tk widgets in git-gui.
2 # Copyright (C) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
3
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 +
12 proc InitTheme {} {
13 # Create a color label style (bg can be overridden by widget option)
14 ttk::style layout Color.TLabel {
@@ -28,10 +36,7 @@ proc InitTheme {} {
36 }
37 }
38
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]
40
41 if {[lsearch -exact {default alt classic clam} $theme] != -1} {
42 # Simple override of standard ttk::entry to change the field
@@ -248,7 +253,7 @@ proc tspinbox {w args} {
253 proc ttext {w args} {
254 global use_ttk
255 if {$use_ttk} {
251 - switch -- [ttk::style theme use] {
256 + switch -- [ttk_get_current_theme] {
257 "vista" - "xpnative" {
258 lappend args -highlightthickness 0 -borderwidth 0
259 }