Tk Source Code

View Ticket
Login
Ticket UUID: 2504402
Title: wm iconphoto fails on many Windows display setups
Type: Bug Version: obsolete: 8.5.5
Submitter: cjmcdonald Created on: 2009-01-13 12:05:17
Subsystem: 68. Win Window Operations Assigned To: chengyemao
Priority: 8 Severity:
Status: Closed Last Modified: 2009-04-30 22:05:39
Resolution: Accepted Closed By: patthoyts
    Closed on: 2009-04-30 15:05:39
Description:
On Windows the wm iconphoto command only works with 32-bit color
displays. Other display settings produce a black icon.  Even today not
all Windows displays are 32-bit.  I discovered the problem connecting to
a server using Microsoft's Remote Desktop Connection protocol, which
gives a 24-bit color display.

The problem is that 32-bit image data is being passed to the win32
CreateIcon() function.  According to MSDN that function requires the
data in a device-dependent format, so it only works when the device
format happens to be 32-bits, matching the given data.  Using
CreateIconIndirect() instead solves the problem, as it accepts bitmaps
in device-independent format, and converts them as required.

I attach updated versions of win/tkWinWm.c, for Tk 8.5.6 and for the
current 8.6 CVS HEAD.  Tested on Windows-XP & Windows-2003.
User Comments: patthoyts added on 2009-04-30 22:05:39:

allow_comments - 1

Tested this on XP remote desktop using PNG based image and some generated in code.
Applied to 8.6 HEAD and 8.5 branch.

cjmcdonald added on 2009-01-13 19:06:48:

File Added - 308937: tkWinWm.c-8.6

cjmcdonald added on 2009-01-13 19:05:17:

File Added - 308936: tkWinWm.c-8.5.6

Attachments: