git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Provide a window icon on Windows platforms
@ 2009-12-31 19:57 Kirill
  2009-12-31 20:02 ` Jeff Epler
  2009-12-31 21:12 ` [msysGit] " Pat Thoyts
  0 siblings, 2 replies; 6+ messages in thread
From: Kirill @ 2009-12-31 19:57 UTC (permalink / raw)
  To: git; +Cc: msysgit

Looks like 37871b73 by Giuseppe Bilotta does not work very well on Windows.
Instead of a former tcl/tk icon, the window has a black square as an icon.

This patch is a copy-paste from Git Gui, which uses a separate .ico file
when it runs on Windows platforms.
---
The patch is in line with what Giuseppe Bilotta proposed in
[PATCH] gitk: try to set program icon on 2008-11-15 23:45:45 GMT 
Unfortunately, I could not find any particular reason why that
patch was not applied, but without it, Gitk on Windows does
not look as nice as it could.

The changes in the Makefile were only sanity-checked, not tested in the
full-fledged build or install.

CC to msysGit list is because the changes are actually made and
tested on top of git version 1.6.4.msysgit.0.597.gcd48

 gitk-git/Makefile     |    3 ++
 gitk-git/gitk         |   50 ++++++++++++++++++++++++++++++------------------
 gitk-git/gitk-gui.ico |  Bin 0 -> 3638 bytes
 3 files changed, 34 insertions(+), 19 deletions(-)
 create mode 100644 gitk-git/gitk-gui.ico

diff --git a/gitk-git/Makefile b/gitk-git/Makefile
index e1b6045..dd158bf 100644
--- a/gitk-git/Makefile
+++ b/gitk-git/Makefile
@@ -5,6 +5,7 @@ prefix ?= $(HOME)
 bindir ?= $(prefix)/bin
 sharedir ?= $(prefix)/share
 gitk_libdir   ?= $(sharedir)/gitk/lib
+gitk_libdir_SQ  = $(subst ','\'',$(gitk_libdir))
 msgsdir    ?= $(gitk_libdir)/msgs
 msgsdir_SQ  = $(subst ','\'',$(msgsdir))
 
@@ -43,10 +44,12 @@ install:: all
 	$(INSTALL) -m 755 gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)'
 	$(foreach p,$(ALL_MSGFILES), $(INSTALL) -m 644 $p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true
+	$(INSTALL) -m 644 gitk-gui.ico '$(DESTDIR_SQ)$(gitk_libdir_SQ)'/gitk-gui.ico
 
 uninstall::
 	$(foreach p,$(ALL_MSGFILES), $(RM) '$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) &&) true
 	$(RM) '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
+	$(RM) '$(DESTDIR_SQ)$(gitk_libdir_SQ)'/gitk-gui.ico
 
 clean::
 	$(RM) gitk-wish po/*.msg
diff --git a/gitk-git/gitk b/gitk-git/gitk
index b6a0daa..661904f 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -11248,30 +11248,42 @@ set patchnum 0
 set lserial 0
 set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
 setcoords
-makewindow
-catch {
-    image create photo gitlogo      -width 16 -height 16
 
-    image create photo gitlogominus -width  4 -height  2
-    gitlogominus put #C00000 -to 0 0 4 2
-    gitlogo copy gitlogominus -to  1 5
-    gitlogo copy gitlogominus -to  6 5
-    gitlogo copy gitlogominus -to 11 5
-    image delete gitlogominus
+if {$::tcl_platform(platform) eq {windows}} {
+	wm iconbitmap . -default $gitk_libdir/gitk-gui.ico
+	set ::tk::AlwaysShowSelection 1
+
+	# Spoof an X11 display for SSH
+	if {![info exists env(DISPLAY)]} {
+		set env(DISPLAY) :9999
+	}
+} else {
+	catch {
+	    image create photo gitlogo      -width 16 -height 16
+
+	    image create photo gitlogominus -width  4 -height  2
+	    gitlogominus put #C00000 -to 0 0 4 2
+	    gitlogo copy gitlogominus -to  1 5
+	    gitlogo copy gitlogominus -to  6 5
+	    gitlogo copy gitlogominus -to 11 5
+	    image delete gitlogominus
 
-    image create photo gitlogoplus  -width  4 -height  4
-    gitlogoplus  put #008000 -to 1 0 3 4
-    gitlogoplus  put #008000 -to 0 1 4 3
-    gitlogo copy gitlogoplus  -to  1 9
-    gitlogo copy gitlogoplus  -to  6 9
-    gitlogo copy gitlogoplus  -to 11 9
-    image delete gitlogoplus
+	    image create photo gitlogoplus  -width  4 -height  4
+	    gitlogoplus  put #008000 -to 1 0 3 4
+	    gitlogoplus  put #008000 -to 0 1 4 3
+	    gitlogo copy gitlogoplus  -to  1 9
+	    gitlogo copy gitlogoplus  -to  6 9
+	    gitlogo copy gitlogoplus  -to 11 9
+	    image delete gitlogoplus
 
-    image create photo gitlogo32    -width 32 -height 32
-    gitlogo32 copy gitlogo -zoom 2 2
+	    image create photo gitlogo32    -width 32 -height 32
+	    gitlogo32 copy gitlogo -zoom 2 2
 
-    wm iconphoto . -default gitlogo gitlogo32
+	    wm iconphoto . -default gitlogo gitlogo32
+	}
 }
+
+makewindow
 # wait for the window to become visible
 tkwait visibility .
 wm title . "[file tail $argv0]: [file tail [pwd]]"
diff --git a/gitk-git/gitk-gui.ico b/gitk-git/gitk-gui.ico
new file mode 100644
index 0000000000000000000000000000000000000000..0f7a43d7b544e19581b0be7b6611b8ff9da94434
GIT binary patch
literal 3638
zcmeH~y-S=y5QoR)0>^O>ZLBQRBE&8*l~sa8I>E-;Zb_fQCdC!OIuH=Hvq(Zxr13Af
zDn%SDwTYEQKmyTDNMQ2Jyq=yPs1Vac_ipy%w;%Jovv;?9A|rB7CMSi|mXB?bN7P0~
zoA!$bBAaNBX-;C#uo1>(YBfdXBjjP3dLq1~*J}!Ls?zWGrT?uj`(HmutJRWryDi;r
zSH{N1WPE&FCMG6idU{%BW@cn@aZ%>y=VfkgPG)CkrT5BZVZr6CY>EFc`Lgv>w!VLt
zH=jP^NU?%d%$la6DVm~bXx<Dd=mou?7xaQ2(<*vJuQV!pMW+x$H*`Zc1VeY)PTMU#
zE4kudSxA|r;*##k6b6MsVNe(n2?m8hVNe(phQx$HVNe(p28AKfVNe(p28BUkP)CD9
z;n3i4&j_GU#;an6p~oY`QgB{yR9LjYl3}2;P${q!STZbd6gUbT1&#toh6;`XLxG{d
z5TPq@6c`E&hA$`25aOqK(a!KjbfCg_WmJY5-xa2c(~5%%Q^j|sv$9CVcg1&ZNBTy`
zf5m^re{503e<d~*h6+O^4zX=SC7&LJl03GN7#RKxHiN_Pms=Yg#K7RN;NZb>yP0IL
z7%T>a;V?e}uox4KL55(k@Wxn&Juz4;;*l)zX^34wgTY~N7#s$N!C}ac6AT7}!{9I&
z3@n2&9tMZOVQ?5&8bgP{VQ?560LQ<vm^0BCR9K_XE^v6R9b<}2$$ME^T9W1EWm#ES
zk=4~z+1S{S_4Rex-rkm-ogLZT-Icw)Jvlfyki)}6+5hG8Zf%Y4agXT6cOVMZ%T}x#
zO_xq2wA-6H9e%qOGY;o!5tXa@V|Juw-051(&(43?e-+=={mrvqlsC_RQBR}YME~=n
z)ajhB#ro&flaV*kA8Xv+#Bac*Y5(`rhhhCE-TT8f(9cdD9uxJm{b$>8Pl>C`BzAmH
zIlh;qcy~`ZIvwL=;yA*%OK>LL-BY+X5R1Ee3TOF$eox_-;4c$@P~tE?$*9NK++;)5
v6i*MmhU++{@~mpIp=$PAV}(nHH21Z<!sXp<^QFk^sm7u{=pSf<_MrR&teD_?

literal 0
HcmV?d00001

-- 
1.6.4.msysgit.0.597.gcd48

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Provide a window icon on Windows platforms
  2009-12-31 19:57 [PATCH] Provide a window icon on Windows platforms Kirill
@ 2009-12-31 20:02 ` Jeff Epler
  2009-12-31 20:13   ` Kirill
  2009-12-31 21:12 ` [msysGit] " Pat Thoyts
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Epler @ 2009-12-31 20:02 UTC (permalink / raw)
  To: Kirill; +Cc: git, msysgit

On Thu, Dec 31, 2009 at 02:57:50PM -0500, Kirill wrote:
> +	set ::tk::AlwaysShowSelection 1
> +
> +	# Spoof an X11 display for SSH
> +	if {![info exists env(DISPLAY)]} {
> +		set env(DISPLAY) :9999
> +	}

these bits look unrelated and should probably be in a separate
submission.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Provide a window icon on Windows platforms
  2009-12-31 20:02 ` Jeff Epler
@ 2009-12-31 20:13   ` Kirill
  0 siblings, 0 replies; 6+ messages in thread
From: Kirill @ 2009-12-31 20:13 UTC (permalink / raw)
  To: Jeff Epler; +Cc: git, msysgit

On Thu, Dec 31, 2009 at 3:02 PM, Jeff Epler wrote:
> On Thu, Dec 31, 2009 at 02:57:50PM -0500, Kirill wrote:
>> +     set ::tk::AlwaysShowSelection 1
>> +
>> +     # Spoof an X11 display for SSH
>> +     if {![info exists env(DISPLAY)]} {
>> +             set env(DISPLAY) :9999
>> +     }
>
> these bits look unrelated and should probably be in a separate
> submission.
The only reason this code is here: Git Gui has it in the same section.
Given my total lack of Tcl/Tk skills and deep understanding, I hoped
to fix some other Windows-specific annoyances "by accident".

If Tcl/Tk gurus, for example, Paul Mackerras, say they're wrong, I'll
gladly remove them. If the only objection is the inclusion into the
same patch, I can do that too.

Thanks for your time!

--
Kirill.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [msysGit] [PATCH] Provide a window icon on Windows platforms
  2009-12-31 19:57 [PATCH] Provide a window icon on Windows platforms Kirill
  2009-12-31 20:02 ` Jeff Epler
@ 2009-12-31 21:12 ` Pat Thoyts
  2009-12-31 22:42   ` Kirill
  1 sibling, 1 reply; 6+ messages in thread
From: Pat Thoyts @ 2009-12-31 21:12 UTC (permalink / raw)
  To: Kirill; +Cc: git, msysgit

2009/12/31 Kirill <kirillathome@gmail.com>:
> Looks like 37871b73 by Giuseppe Bilotta does not work very well on Windows.
> Instead of a former tcl/tk icon, the window has a black square as an icon.

I've been using versions of gitk on Windows with that patch since it
was applied in March and it has been fine. On Windows XP and Windows
7. So there is more to this than you are telling. Are you using
windows via remote desktop? There was a patch committed to Tk a while
ago about the program icon displaying as a black square over remote
desktop. If so, this requires an updated Tk and not a patch to gitk -
tk 8.5.8 should be ok if this is the problem.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] Provide a window icon on Windows platforms
  2009-12-31 21:12 ` [msysGit] " Pat Thoyts
@ 2009-12-31 22:42   ` Kirill
  2009-12-31 23:47     ` Pat Thoyts
  0 siblings, 1 reply; 6+ messages in thread
From: Kirill @ 2009-12-31 22:42 UTC (permalink / raw)
  To: 'Pat Thoyts'; +Cc: git, msysgit

Unfortunately, I have to insist on my patch :)

> -----Original Message-----
> From: Pat Thoyts [mailto:patthoyts@googlemail.com]
> Sent: Thursday, December 31, 2009 4:12 PM

> 2009/12/31 Kirill <kirillathome@gmail.com>:
> > Looks like 37871b73 by Giuseppe Bilotta does not work very well on
> > Windows. Instead of a former tcl/tk icon, the window has a black
> > square as an icon.
> 
> I've been using versions of gitk on Windows with that patch since it
> was applied in March and it has been fine. On Windows XP and Windows
> 7. So there is more to this than you are telling. Are you using
> windows via remote desktop?
You're absolutely right about *unintentional* withdrawal of facts in my original message, but no, I'm not using Remote Desktop. However, my XP SP3 has 16-bit colors and apparently 8.5.7 can't display those photos correctly in this case either. Most probable reason why the issue was first discovered in Remote Desktop is because most of RDP sessions are limited to 16-bit colors.

> If so, this requires an updated Tk and not a patch to gitk -
> tk 8.5.8 should be ok if this is the problem.
Unfortunately, the situation is improved with 8.5.8, but definitely not resolved (tested on msysGit devel branch). The sequence image create photo && wm iconphoto on 16-bit displays in XP SP3 renders the background black, not transparent. The fact that I'm using Classic color schema may play some role too. I'd speculate that 8.5.8 on Windows 7 (admittedly, it's much harder to switch to 16-bit colors there) may have exactly the same issue, given that 8.5.7 has exactly the same symptoms.

Is there a way to replace the "simplistic"

if {$::tcl_platform(platform) eq {windows}}

with something more elaborate that takes into account 16-bit colors?

--
Kirill.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Provide a window icon on Windows platforms
  2009-12-31 22:42   ` Kirill
@ 2009-12-31 23:47     ` Pat Thoyts
  0 siblings, 0 replies; 6+ messages in thread
From: Pat Thoyts @ 2009-12-31 23:47 UTC (permalink / raw)
  To: Kirill; +Cc: git, msysgit

2009/12/31 Kirill <kirillathome@gmail.com>:
> Unfortunately, I have to insist on my patch :)
>
>> -----Original Message-----
>> From: Pat Thoyts [mailto:patthoyts@googlemail.com]
>> Sent: Thursday, December 31, 2009 4:12 PM
>
>> 2009/12/31 Kirill <kirillathome@gmail.com>:
>> > Looks like 37871b73 by Giuseppe Bilotta does not work very well on
>> > Windows. Instead of a former tcl/tk icon, the window has a black
>> > square as an icon.
>>
>> I've been using versions of gitk on Windows with that patch since it
>> was applied in March and it has been fine. On Windows XP and Windows
>> 7. So there is more to this than you are telling. Are you using
>> windows via remote desktop?
> You're absolutely right about *unintentional* withdrawal of facts in my original message, but no, I'm not using Remote Desktop. However, my XP SP3 has 16-bit colors and apparently 8.5.7 can't display those photos correctly in this case either. Most probable reason why the issue was first discovered in Remote Desktop is because most of RDP sessions are limited to 16-bit colors.
>
>> If so, this requires an updated Tk and not a patch to gitk -
>> tk 8.5.8 should be ok if this is the problem.
> Unfortunately, the situation is improved with 8.5.8, but definitely not resolved (tested on msysGit devel branch). The sequence image create photo && wm iconphoto on 16-bit displays in XP SP3 renders the background black, not transparent. The fact that I'm using Classic color schema may play some role too. I'd speculate that 8.5.8 on Windows 7 (admittedly, it's much harder to switch to 16-bit colors there) may have exactly the same issue, given that 8.5.7 has exactly the same symptoms.

No - it will be the use of 16bit color. Classic gets used a lot, 16
bit colour - well, you might be the only one now so such a system has
limited testing.

>
> Is there a way to replace the "simplistic"
>
> if {$::tcl_platform(platform) eq {windows}}
>
> with something more elaborate that takes into account 16-bit colors?

That is better done using 'if {[tk windowingsystem] eq "win32"}
{...}'. The windowingsystem command is preferred over platform because
they are not always equivalent (for instance, MacOSX may use either
x11 or aqua).
To test the colour-depth there is [winfo depth .] which returns 16
when using the 16bit color on XP and 32 on Win7 with full color.

Pat Thoyts

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-12-31 23:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-31 19:57 [PATCH] Provide a window icon on Windows platforms Kirill
2009-12-31 20:02 ` Jeff Epler
2009-12-31 20:13   ` Kirill
2009-12-31 21:12 ` [msysGit] " Pat Thoyts
2009-12-31 22:42   ` Kirill
2009-12-31 23:47     ` Pat Thoyts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).