This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XWin and the ICON on xterm window


On Wed, 19 May 2004, Earle F. Philhower, III wrote:

> Howdy AGO,
> 
> Just a while back AGO wrote...
> > > On Wed, 19 May 2004, Earle F. Philhower III wrote:
> > > I'm not sure what's being to referred to in the original problem from Angelo,
> > > but FWIW the change back a while was getting rid of all LoadIcon() calls > and
> > > instead using LoadImage()s instead (since we support DLL icons, .ico files,
> > > etc.).  You need to use DestroyIcon() if the HANDLE is a from LoadIcon, and
> > > just plain DestroyObject() if the HANDLE is from LoadImage or you get a
> > > GDI leak.
> > DeleteObject is never called on an icon handle in out code. Only DestroyIcon is.
> 
> You're right, Alexander, I remembered that Kensuke fixed a
> bug w/this but I got the wrong direction. It's been a busy
> month and I've not looked at the XWin code recently.  :)
> 
> > Using LoadImage results in broken images now. I'd like to revert
> > to LoadIcon but in a safe way. 
> 
> I kind of agree about this, but would really like to fix the
> problem with LoadImage() instead of reverting to LoadIcon().
> Not all systems (I know my W2K and WXP boxes are among these) have
> no problem at all with the icons, so there must be some difference
> between the pretty and non-pretty icon displays (custom themes with
> odd icon sizes, specific drivers, etc?)...
> 
> Lev made some comments about doing dual LoadImages (both SM_ICON
> and SM_SMICON) to get rid of any bad scaling issues, IIRC.

my tests revealed we have to do this anyway.

LoadIcon returs an icon which has all sizes. CopyIcon and DuplicateIcon
return only one of the sizes. LoadImage with LR_DEFAULTSIZE loads the
large (32x32) icon and scales this down to small (16x16) for the title
bar. If I load explicitly the 16x16 it is scaled up to 32x32 for the 
alt-tab list.

But that's not a big problem. We currently use RegisterClass with the
WNDCLASS structure. The function RegisterClassEx uses WNDCLASSEX structure
which has an entry for the small icon. 

I don't know if the icon set in the configfile will contain two sizes or 
if it suffers from the same problem. 


So the goal is 
  winOverrideDefaultIcon(&hIcon, &hSmallIcon)
  
  if (!hIcon && !hSmallIcon)
  {
    winXIconToHICON(pWin, &hIcon, &hSmallIcon)
  }

  if (!hicon && !hsmallicon)
  {
    hIcon = LoadImage(..., SM_CXICON, SM_CYICON, 0)
    hIconSmall = LoadImage(..., SM_CXSMICON, SM_CYSMICON, 0)
  }


 WINDOWCLASSEX wc;
 wc.cbSize = sizeof(wc);
 ...
 wc.hIcon = (hIcon ? hIcon : hIconSmall);
 wc.hIconSm = hSmallIcon;

 RegisterClassEx(wc);

bye
	ago
-- 
 Alexander.Gottwald@s1999.tu-chemnitz.de 
 http://www.gotti.org           ICQ: 126018723


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]