{"thread":{"id":"47972","subject":"[PATCH] git-gui: workaround ttk:style theme use","startedAt":"2018-03-03T22:39:43Z","lastAt":"2018-03-03T22:39:43Z","messageCount":1,"participants":["Clemens Buchacher"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"340961","messageId":"20180303223919.GA5854@Sonnenschein.localdomain","threadId":"47972","inReplyTo":null,"subject":"[PATCH] git-gui: workaround ttk:style theme use","fromName":"Clemens Buchacher","fromEmail":"drizzd@gmx.net","sentAt":"2018-03-03T22:39:19Z","receivedAt":"2018-03-03T22:39:43Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"Tk 8.5.7, which is the latest version on Centos 6, does not support\ngetting the current theme with [ttk::style theme use]. Use the existing\nworkaround for this in all places.\n\nSigned-off-by: Clemens Buchacher <drizzd@gmx.net>\n---\n git-gui/lib/themed.tcl | 15 ++++++++++-----\n 1 file changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/git-gui/lib/themed.tcl b/git-gui/lib/themed.tcl\nindex 351a712..88b3119 100644\n--- a/git-gui/lib/themed.tcl\n+++ b/git-gui/lib/themed.tcl\n@@ -1,6 +1,14 @@\n # Functions for supporting the use of themed Tk widgets in git-gui.\n # Copyright (C) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>\n \n+proc ttk_get_current_theme {} {\n+\t# Handle either current Tk or older versions of 8.5\n+\tif {[catch {set theme [ttk::style theme use]}]} {\n+\t\tset theme  $::ttk::currentTheme\n+\t}\n+\treturn $theme\n+}\n+\n proc InitTheme {} {\n \t# Create a color label style (bg can be overridden by widget option)\n \tttk::style layout Color.TLabel {\n@@ -28,10 +36,7 @@ proc InitTheme {} {\n \t\t}\n \t}\n \n-\t# Handle either current Tk or older versions of 8.5\n-\tif {[catch {set theme [ttk::style theme use]}]} {\n-\t\tset theme  $::ttk::currentTheme\n-\t}\n+\tset theme [ttk_get_current_theme]\n \n \tif {[lsearch -exact {default alt classic clam} $theme] != -1} {\n \t\t# Simple override of standard ttk::entry to change the field\n@@ -248,7 +253,7 @@ proc tspinbox {w args} {\n proc ttext {w args} {\n \tglobal use_ttk\n \tif {$use_ttk} {\n-\t\tswitch -- [ttk::style theme use] {\n+\t\tswitch -- [ttk_get_current_theme] {\n \t\t\t\"vista\" - \"xpnative\" {\n \t\t\t\tlappend args -highlightthickness 0 -borderwidth 0\n \t\t\t}\n-- \n2.7.4\n\n"}]}