summary refs log tree commit diff
path: root/git-gui
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-04-25 13:28:49 +0900
committerJunio C Hamano <gitster@pobox.com>2018-04-25 13:28:49 +0900
commit18a6a8571fa150441de06e007e9c61856bfadc5d (patch)
tree8f63748a6debdc91f01efb6232a686124c41af95 /git-gui
parentb1218e46a6255a3bdbe2af1c9c329c20722df112 (diff)
parent4891961105c3af1022b1166e8dc5d1fe154a74b7 (diff)
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
Diffstat (limited to 'git-gui')
-rw-r--r--git-gui/lib/themed.tcl15
1 files changed, 10 insertions, 5 deletions
diff --git a/git-gui/lib/themed.tcl b/git-gui/lib/themed.tcl
index 351a712c8c..88b3119a75 100644
--- a/git-gui/lib/themed.tcl
+++ b/git-gui/lib/themed.tcl
@@ -1,6 +1,14 @@
 # Functions for supporting the use of themed Tk widgets in git-gui.
 # Copyright (C) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
 
+proc ttk_get_current_theme {} {
+	# Handle either current Tk or older versions of 8.5
+	if {[catch {set theme [ttk::style theme use]}]} {
+		set theme  $::ttk::currentTheme
+	}
+	return $theme
+}
+
 proc InitTheme {} {
 	# Create a color label style (bg can be overridden by widget option)
 	ttk::style layout Color.TLabel {
@@ -28,10 +36,7 @@ proc InitTheme {} {
 		}
 	}
 
-	# Handle either current Tk or older versions of 8.5
-	if {[catch {set theme [ttk::style theme use]}]} {
-		set theme  $::ttk::currentTheme
-	}
+	set theme [ttk_get_current_theme]
 
 	if {[lsearch -exact {default alt classic clam} $theme] != -1} {
 		# Simple override of standard ttk::entry to change the field
@@ -248,7 +253,7 @@ proc tspinbox {w args} {
 proc ttext {w args} {
 	global use_ttk
 	if {$use_ttk} {
-		switch -- [ttk::style theme use] {
+		switch -- [ttk_get_current_theme] {
 			"vista" - "xpnative" {
 				lappend args -highlightthickness 0 -borderwidth 0
 			}