{"thread":{"id":"22073","subject":"[PATCH] Provide a window icon on Windows platforms","startedAt":"2009-12-31T19:57:50Z","lastAt":"2009-12-31T23:47:04Z","messageCount":6,"participants":["Kirill","Jeff Epler","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"130626","messageId":"1262289470-4208-1-git-send-email-kirillathome@gmail.com","threadId":"22073","inReplyTo":null,"subject":"[PATCH] Provide a window icon on Windows platforms","fromName":"Kirill","fromEmail":"kirillathome@gmail.com","sentAt":"2009-12-31T19:57:50Z","receivedAt":"2009-12-31T19:57:50Z","isPatch":true,"sender":{"key":"kirillathome@gmail.com","avatar":null},"body":"Looks like 37871b73 by Giuseppe Bilotta does not work very well on Windows.\nInstead of a former tcl/tk icon, the window has a black square as an icon.\n\nThis patch is a copy-paste from Git Gui, which uses a separate .ico file\nwhen it runs on Windows platforms.\n---\nThe patch is in line with what Giuseppe Bilotta proposed in\n[PATCH] gitk: try to set program icon on 2008-11-15 23:45:45 GMT \nUnfortunately, I could not find any particular reason why that\npatch was not applied, but without it, Gitk on Windows does\nnot look as nice as it could.\n\nThe changes in the Makefile were only sanity-checked, not tested in the\nfull-fledged build or install.\n\nCC to msysGit list is because the changes are actually made and\ntested on top of git version 1.6.4.msysgit.0.597.gcd48\n\n gitk-git/Makefile     |    3 ++\n gitk-git/gitk         |   50 ++++++++++++++++++++++++++++++------------------\n gitk-git/gitk-gui.ico |  Bin 0 -> 3638 bytes\n 3 files changed, 34 insertions(+), 19 deletions(-)\n create mode 100644 gitk-git/gitk-gui.ico\n\ndiff --git a/gitk-git/Makefile b/gitk-git/Makefile\nindex e1b6045..dd158bf 100644\n--- a/gitk-git/Makefile\n+++ b/gitk-git/Makefile\n@@ -5,6 +5,7 @@ prefix ?= $(HOME)\n bindir ?= $(prefix)/bin\n sharedir ?= $(prefix)/share\n gitk_libdir   ?= $(sharedir)/gitk/lib\n+gitk_libdir_SQ  = $(subst ','\\'',$(gitk_libdir))\n msgsdir    ?= $(gitk_libdir)/msgs\n msgsdir_SQ  = $(subst ','\\'',$(msgsdir))\n \n@@ -43,10 +44,12 @@ install:: all\n \t$(INSTALL) -m 755 gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)'\n \t$(foreach p,$(ALL_MSGFILES), $(INSTALL) -m 644 $p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true\n+\t$(INSTALL) -m 644 gitk-gui.ico '$(DESTDIR_SQ)$(gitk_libdir_SQ)'/gitk-gui.ico\n \n uninstall::\n \t$(foreach p,$(ALL_MSGFILES), $(RM) '$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) &&) true\n \t$(RM) '$(DESTDIR_SQ)$(bindir_SQ)'/gitk\n+\t$(RM) '$(DESTDIR_SQ)$(gitk_libdir_SQ)'/gitk-gui.ico\n \n clean::\n \t$(RM) gitk-wish po/*.msg\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex b6a0daa..661904f 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -11248,30 +11248,42 @@ set patchnum 0\n set lserial 0\n set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == \"true\"}]\n setcoords\n-makewindow\n-catch {\n-    image create photo gitlogo      -width 16 -height 16\n \n-    image create photo gitlogominus -width  4 -height  2\n-    gitlogominus put #C00000 -to 0 0 4 2\n-    gitlogo copy gitlogominus -to  1 5\n-    gitlogo copy gitlogominus -to  6 5\n-    gitlogo copy gitlogominus -to 11 5\n-    image delete gitlogominus\n+if {$::tcl_platform(platform) eq {windows}} {\n+\twm iconbitmap . -default $gitk_libdir/gitk-gui.ico\n+\tset ::tk::AlwaysShowSelection 1\n+\n+\t# Spoof an X11 display for SSH\n+\tif {![info exists env(DISPLAY)]} {\n+\t\tset env(DISPLAY) :9999\n+\t}\n+} else {\n+\tcatch {\n+\t    image create photo gitlogo      -width 16 -height 16\n+\n+\t    image create photo gitlogominus -width  4 -height  2\n+\t    gitlogominus put #C00000 -to 0 0 4 2\n+\t    gitlogo copy gitlogominus -to  1 5\n+\t    gitlogo copy gitlogominus -to  6 5\n+\t    gitlogo copy gitlogominus -to 11 5\n+\t    image delete gitlogominus\n \n-    image create photo gitlogoplus  -width  4 -height  4\n-    gitlogoplus  put #008000 -to 1 0 3 4\n-    gitlogoplus  put #008000 -to 0 1 4 3\n-    gitlogo copy gitlogoplus  -to  1 9\n-    gitlogo copy gitlogoplus  -to  6 9\n-    gitlogo copy gitlogoplus  -to 11 9\n-    image delete gitlogoplus\n+\t    image create photo gitlogoplus  -width  4 -height  4\n+\t    gitlogoplus  put #008000 -to 1 0 3 4\n+\t    gitlogoplus  put #008000 -to 0 1 4 3\n+\t    gitlogo copy gitlogoplus  -to  1 9\n+\t    gitlogo copy gitlogoplus  -to  6 9\n+\t    gitlogo copy gitlogoplus  -to 11 9\n+\t    image delete gitlogoplus\n \n-    image create photo gitlogo32    -width 32 -height 32\n-    gitlogo32 copy gitlogo -zoom 2 2\n+\t    image create photo gitlogo32    -width 32 -height 32\n+\t    gitlogo32 copy gitlogo -zoom 2 2\n \n-    wm iconphoto . -default gitlogo gitlogo32\n+\t    wm iconphoto . -default gitlogo gitlogo32\n+\t}\n }\n+\n+makewindow\n # wait for the window to become visible\n tkwait visibility .\n wm title . \"[file tail $argv0]: [file tail [pwd]]\"\ndiff --git a/gitk-git/gitk-gui.ico b/gitk-git/gitk-gui.ico\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..0f7a43d7b544e19581b0be7b6611b8ff9da94434\nGIT binary patch\nliteral 3638\nzcmeH~y-S=y5QoR)0>^O>ZLBQRBE&8*l~sa8I>E-;Zb_fQCdC!OIuH=Hvq(Zxr13Af\nzDn%SDwTYEQKmyTDNMQ2Jyq=yPs1Vac_ipy%w;%Jovv;?9A|rB7CMSi|mXB?bN7P0~\nzoA!$bBAaNBX-;C#uo1>(YBfdXBjjP3dLq1~*J}!Ls?zWGrT?uj`(HmutJRWryDi;r\nzSH{N1WPE&FCMG6idU{%BW@cn@aZ%>y=VfkgPG)CkrT5BZVZr6CY>EFc`Lgv>w!VLt\nzH=jP^NU?%d%$la6DVm~bXx<Dd=mou?7xaQ2(<*vJuQV!pMW+x$H*`Zc1VeY)PTMU#\nzE4kudSxA|r;*##k6b6MsVNe(n2?m8hVNe(phQx$HVNe(p28AKfVNe(p28BUkP)CD9\nz;n3i4&j_GU#;an6p~oY`QgB{yR9LjYl3}2;P${q!STZbd6gUbT1&#toh6;`XLxG{d\nz5TPq@6c`E&hA$`25aOqK(a!KjbfCg_WmJY5-xa2c(~5%%Q^j|sv$9CVcg1&ZNBTy`\nzf5m^re{503e<d~*h6+O^4zX=SC7&LJl03GN7#RKxHiN_Pms=Yg#K7RN;NZb>yP0IL\nz7%T>a;V?e}uox4KL55(k@Wxn&Juz4;;*l)zX^34wgTY~N7#s$N!C}ac6AT7}!{9I&\nz3@n2&9tMZOVQ?5&8bgP{VQ?560LQ<vm^0BCR9K_XE^v6R9b<}2$$ME^T9W1EWm#ES\nzk=4~z+1S{S_4Rex-rkm-ogLZT-Icw)Jvlfyki)}6+5hG8Zf%Y4agXT6cOVMZ%T}x#\nzO_xq2wA-6H9e%qOGY;o!5tXa@V|Juw-051(&(43?e-+=={mrvqlsC_RQBR}YME~=n\nz)ajhB#ro&flaV*kA8Xv+#Bac*Y5(`rhhhCE-TT8f(9cdD9uxJm{b$>8Pl>C`BzAmH\nzIlh;qcy~`ZIvwL=;yA*%OK>LL-BY+X5R1Ee3TOF$eox_-;4c$@P~tE?$*9NK++;)5\nv6i*MmhU++{@~mpIp=$PAV}(nHH21Z<!sXp<^QFk^sm7u{=pSf<_MrR&teD_?\n\nliteral 0\nHcmV?d00001\n\n-- \n1.6.4.msysgit.0.597.gcd48\n"},{"id":"130627","messageId":"20091231200240.GC13700@unpythonic.net","threadId":"22073","inReplyTo":"1262289470-4208-1-git-send-email-kirillathome@gmail.com","subject":"Re: [PATCH] Provide a window icon on Windows platforms","fromName":"Jeff Epler","fromEmail":"jepler@unpythonic.net","sentAt":"2009-12-31T20:02:40Z","receivedAt":"2009-12-31T20:02:40Z","isPatch":true,"sender":{"key":"jepler@unpythonic.net","avatar":"https://avatars.githubusercontent.com/u/1517291?v=4"},"body":"On Thu, Dec 31, 2009 at 02:57:50PM -0500, Kirill wrote:\n> +\tset ::tk::AlwaysShowSelection 1\n> +\n> +\t# Spoof an X11 display for SSH\n> +\tif {![info exists env(DISPLAY)]} {\n> +\t\tset env(DISPLAY) :9999\n> +\t}\n\nthese bits look unrelated and should probably be in a separate\nsubmission.\n"},{"id":"130628","messageId":"f579dd580912311213u2515334fxb811354f59fe05a5@mail.gmail.com","threadId":"22073","inReplyTo":"20091231200240.GC13700@unpythonic.net","subject":"Re: [PATCH] Provide a window icon on Windows platforms","fromName":"Kirill","fromEmail":"kirillathome@gmail.com","sentAt":"2009-12-31T20:13:43Z","receivedAt":"2009-12-31T20:13:43Z","isPatch":true,"sender":{"key":"kirillathome@gmail.com","avatar":null},"body":"On Thu, Dec 31, 2009 at 3:02 PM, Jeff Epler wrote:\n> On Thu, Dec 31, 2009 at 02:57:50PM -0500, Kirill wrote:\n>> +     set ::tk::AlwaysShowSelection 1\n>> +\n>> +     # Spoof an X11 display for SSH\n>> +     if {![info exists env(DISPLAY)]} {\n>> +             set env(DISPLAY) :9999\n>> +     }\n>\n> these bits look unrelated and should probably be in a separate\n> submission.\nThe only reason this code is here: Git Gui has it in the same section.\nGiven my total lack of Tcl/Tk skills and deep understanding, I hoped\nto fix some other Windows-specific annoyances \"by accident\".\n\nIf Tcl/Tk gurus, for example, Paul Mackerras, say they're wrong, I'll\ngladly remove them. If the only objection is the inclusion into the\nsame patch, I can do that too.\n\nThanks for your time!\n\n--\nKirill.\n"},{"id":"130632","messageId":"a5b261830912311312if3d71aax5bb693a907dc5c0f@mail.gmail.com","threadId":"22073","inReplyTo":"1262289470-4208-1-git-send-email-kirillathome@gmail.com","subject":"Re: [msysGit] [PATCH] Provide a window icon on Windows platforms","fromName":"Pat Thoyts","fromEmail":"patthoyts@googlemail.com","sentAt":"2009-12-31T21:12:18Z","receivedAt":"2009-12-31T21:12:18Z","isPatch":true,"sender":{"key":"patthoyts@googlemail.com","avatar":"https://gravatar.com/avatar/2300f94d9f59174a551dbc71278ac2cb2489f56afda920a57e189ad9de0a3f92?d=mp&s=160"},"body":"2009/12/31 Kirill <kirillathome@gmail.com>:\n> Looks like 37871b73 by Giuseppe Bilotta does not work very well on Windows.\n> Instead of a former tcl/tk icon, the window has a black square as an icon.\n\nI've been using versions of gitk on Windows with that patch since it\nwas applied in March and it has been fine. On Windows XP and Windows\n7. So there is more to this than you are telling. Are you using\nwindows via remote desktop? There was a patch committed to Tk a while\nago about the program icon displaying as a black square over remote\ndesktop. If so, this requires an updated Tk and not a patch to gitk -\ntk 8.5.8 should be ok if this is the problem.\n"},{"id":"130637","messageId":"000701ca8a6a$7c002070$74006150$@com","threadId":"22073","inReplyTo":"a5b261830912311312if3d71aax5bb693a907dc5c0f@mail.gmail.com","subject":"RE: [PATCH] Provide a window icon on Windows platforms","fromName":"Kirill","fromEmail":"kirillathome@gmail.com","sentAt":"2009-12-31T22:42:05Z","receivedAt":"2009-12-31T22:42:05Z","isPatch":true,"sender":{"key":"kirillathome@gmail.com","avatar":null},"body":"Unfortunately, I have to insist on my patch :)\n\n> -----Original Message-----\n> From: Pat Thoyts [mailto:patthoyts@googlemail.com]\n> Sent: Thursday, December 31, 2009 4:12 PM\n\n> 2009/12/31 Kirill <kirillathome@gmail.com>:\n> > Looks like 37871b73 by Giuseppe Bilotta does not work very well on\n> > Windows. Instead of a former tcl/tk icon, the window has a black\n> > square as an icon.\n> \n> I've been using versions of gitk on Windows with that patch since it\n> was applied in March and it has been fine. On Windows XP and Windows\n> 7. So there is more to this than you are telling. Are you using\n> windows via remote desktop?\nYou'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.\n\n> If so, this requires an updated Tk and not a patch to gitk -\n> tk 8.5.8 should be ok if this is the problem.\nUnfortunately, 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.\n\nIs there a way to replace the \"simplistic\"\n\nif {$::tcl_platform(platform) eq {windows}}\n\nwith something more elaborate that takes into account 16-bit colors?\n\n--\nKirill.\n"},{"id":"130640","messageId":"a5b261830912311547n37c113avcc5089bd15c17bbe@mail.gmail.com","threadId":"22073","inReplyTo":"000701ca8a6a$7c002070$74006150$@com","subject":"Re: [PATCH] Provide a window icon on Windows platforms","fromName":"Pat Thoyts","fromEmail":"patthoyts@googlemail.com","sentAt":"2009-12-31T23:47:04Z","receivedAt":"2009-12-31T23:47:04Z","isPatch":true,"sender":{"key":"patthoyts@googlemail.com","avatar":"https://gravatar.com/avatar/2300f94d9f59174a551dbc71278ac2cb2489f56afda920a57e189ad9de0a3f92?d=mp&s=160"},"body":"2009/12/31 Kirill <kirillathome@gmail.com>:\n> Unfortunately, I have to insist on my patch :)\n>\n>> -----Original Message-----\n>> From: Pat Thoyts [mailto:patthoyts@googlemail.com]\n>> Sent: Thursday, December 31, 2009 4:12 PM\n>\n>> 2009/12/31 Kirill <kirillathome@gmail.com>:\n>> > Looks like 37871b73 by Giuseppe Bilotta does not work very well on\n>> > Windows. Instead of a former tcl/tk icon, the window has a black\n>> > square as an icon.\n>>\n>> I've been using versions of gitk on Windows with that patch since it\n>> was applied in March and it has been fine. On Windows XP and Windows\n>> 7. So there is more to this than you are telling. Are you using\n>> windows via remote desktop?\n> 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.\n>\n>> If so, this requires an updated Tk and not a patch to gitk -\n>> tk 8.5.8 should be ok if this is the problem.\n> 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.\n\nNo - it will be the use of 16bit color. Classic gets used a lot, 16\nbit colour - well, you might be the only one now so such a system has\nlimited testing.\n\n>\n> Is there a way to replace the \"simplistic\"\n>\n> if {$::tcl_platform(platform) eq {windows}}\n>\n> with something more elaborate that takes into account 16-bit colors?\n\nThat is better done using 'if {[tk windowingsystem] eq \"win32\"}\n{...}'. The windowingsystem command is preferred over platform because\nthey are not always equivalent (for instance, MacOSX may use either\nx11 or aqua).\nTo test the colour-depth there is [winfo depth .] which returns 16\nwhen using the 16bit color on XP and 32 on Win7 with full color.\n\nPat Thoyts\n"}]}