threads / discuss / 29699

gitk: set uicolor SystemButtonFace error on X11 if .gitk created using Win32 tk

Subject: gitk: set uicolor SystemButtonFace error on X11 if .gitk created using Win32 tk

## tl;dr

3 messages between Feb 22, 2012 and Feb 23, 2012.

replies: 2people: 2as markdown or json

Matt Seitz (matseitz)· Feb 22, 2012, 22:13 UTC · lore

Would you please change gitk to not hard-code Win32-specific color values when creating .gitk on a Win32 windowing system?

Gitk stopped working for me on Cygwin when Cygwin changed from using a Win32 native version of tk to using the standard X11 version. The error was because gitk had previously created a .gitk file using Win32 specific color values:

https://github.com/gitster/git/commit/1924d1bc0dc99cd3460d3551671908cc76 c09d3b

I was able to work around the problem by replacing the Win32 specific
colors in my .gitk file with the default colors gitk uses on other
windowing systems.
 
See also:
http://cygwin.com/ml/cygwin/2012-02/msg00391.html
Erik Faye-Lund· Feb 23, 2012, 14:03 UTC · re: Matt Seitz (matseitz) · lore

Re: gitk: set uicolor SystemButtonFace error on X11 if .gitk created using Win32 tk

On Wed, Feb 22, 2012 at 11:13 PM, Matt Seitz (matseitz) <matseitz@cisco.com> wrote:

Show 15 quoted lines
> Would you please change gitk to not hard-code Win32-specific color
> values when creating .gitk on a Win32 windowing system?
>
> Gitk stopped working for me on Cygwin when Cygwin changed from using a
> Win32 native version of tk to using the standard X11 version.  The error
> was because gitk had previously created a .gitk file using Win32
> specific color values:
>
> https://github.com/gitster/git/commit/1924d1bc0dc99cd3460d3551671908cc76
> c09d3b
>
> I was able to work around the problem by replacing the Win32 specific
> colors in my .gitk file with the default colors gitk uses on other
> windowing systems.
>

Are you saying that the tk shipped with recent Cygwin reports "win32" for "[tk windowingsystem]", but does not recognize the "SystemButtonFace" etc values?

If so, perhaps adding a check for one of the constant values might make sense. But I'd expect "[tk windowingsystem]" to report "x11" if it's simply a Cygwin build of the X11-version as you say...

Anyway, this does sound like a regression in Cygwin; we're probably not the only ones to use "SystemButtonFace" etc after consulting "[tk windowingsystem]"...

Hm, no wait, the documentation seems to suggest ditching the System-prefix to these constants: http://www.tcl.tk/man/tcl/TkCmd/colors.htm

Does this patch help?
---
diff --git a/gitk-git/gitk b/gitk-git/gitk
index f9e936d..7e9a01f 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -11559,10 +11559,10 @@ if {[tk windowingsystem] eq "aqua"} {

 set colors {green red blue magenta darkgrey brown orange}
 if {[tk windowingsystem] eq "win32"} {
-    set uicolor SystemButtonFace
-    set bgcolor SystemWindow
-    set fgcolor SystemButtonText
-    set selectbgcolor SystemHighlight
+    set uicolor ButtonFace
+    set bgcolor Window
+    set fgcolor ButtonText
+    set selectbgcolor Highlight
 } else {
     set uicolor grey85
     set bgcolor white
Matt Seitz (matseitz)· Feb 23, 2012, 19:20 UTC · re: Erik Faye-Lund · lore

RE: gitk: set uicolor SystemButtonFace error on X11 if .gitk created using Win32 tk

Show 5 quoted lines
> From: Erik Faye-Lund [mailto:kusmabite@gmail.com]
> 
> Are you saying that the tk shipped with recent Cygwin reports "win32"
> for "[tk windowingsystem]", but does not recognize the
> "SystemButtonFace" etc values?
Here is what I am saying:
1.  Cygwin tk 8.4.x and earlier:
-Reports "win32" for "[tk windowingsystem]"
-Recognizes the "SystemButtonFace" etc values
2.  Cygwin tk 8.5.11:
-Reports "x11" for "[tk windowingsystem]"
-Does not recognize the "SystemButtonFace" etc values
> Does this patch help?

No, this has the same problem: if gitk is installed using a tk that reports "win32" for "[tk windowingsystem]", then gitk hard codes win32 specific values into .gitk. If the user later changes to a tk that doesn't support win32 specific values, gitk will no longer work.

Two use cases:  
1.  My situation:  User replaces a win32 tk with an x11 tk
2.  User uses a common .gitk file when running Windows and Linux.
Here's the error:
$ uname -a
CYGWIN_NT-5.1 matseitz-wxp 1.7.10(0.259/5/3) 2012-02-05 12:36 i686
Cygwin
$ wish
% tk windowingsystem
x11
% exit
$ gitk &
[1] 6312
$ Error in startup script: unknown color name "ButtonFace"
    while executing
"winfo rgb . $c"
    (procedure "setui" line 3)
    invoked from within
"setui $uicolor"
    (file "/usr/bin/gitk" line 11522)

← back to recent threads