From 2b82d3a5e4cdf2b9af7c0ff65c713a792109bb91 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 23 Nov 2009 19:47:43 +0000 Subject: Make sure that uninitilised members of ICONINFO are put to zero. --- xorg-server/hw/xwin/winmultiwindowicons.c | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'xorg-server/hw/xwin/winmultiwindowicons.c') diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c index 89acf72be..8dae068af 100644 --- a/xorg-server/hw/xwin/winmultiwindowicons.c +++ b/xorg-server/hw/xwin/winmultiwindowicons.c @@ -273,19 +273,21 @@ NetWMToWinIconAlpha(uint32_t *icon) HICON result; HDC hdc = GetDC(NULL); uint32_t *DIB_pixels; - ICONINFO ii = {TRUE}; - BITMAPV4HEADER bmh = {sizeof(bmh)}; + ICONINFO ii; + BITMAPV5HEADER bmh; /* Define an ARGB pixel format used for Color+Alpha icons */ - bmh.bV4Width = width; - bmh.bV4Height = -height; /* Invert the image */ - bmh.bV4Planes = 1; - bmh.bV4BitCount = 32; - bmh.bV4V4Compression = BI_BITFIELDS; - bmh.bV4AlphaMask = 0xFF000000; - bmh.bV4RedMask = 0x00FF0000; - bmh.bV4GreenMask = 0x0000FF00; - bmh.bV4BlueMask = 0x000000FF; + ZeroMemory(&bmh,sizeof(bmh)); + bmh.bV5Size = sizeof(bmh); + bmh.bV5Width = width; + bmh.bV5Height = -height; /* Invert the image */ + bmh.bV5Planes = 1; + bmh.bV5BitCount = 32; + bmh.bV5Compression = BI_BITFIELDS; + bmh.bV5AlphaMask = 0xFF000000; + bmh.bV5RedMask = 0x00FF0000; + bmh.bV5GreenMask = 0x0000FF00; + bmh.bV5BlueMask = 0x000000FF; ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO*)&bmh, DIB_RGB_COLORS, (void**)&DIB_pixels, NULL, 0); @@ -296,6 +298,9 @@ NetWMToWinIconAlpha(uint32_t *icon) /* CreateIconIndirect() traditionally required DDBitmaps */ /* Systems from WinXP accept 32-bit ARGB DIBitmaps with full 8-bit alpha support */ /* The icon is created with a DIB + empty DDB mask (an MS example does the same) */ + ii.fIcon = TRUE; + ii.xHotspot = 0; + ii.yHotspot = 0; result = CreateIconIndirect(&ii); DeleteObject(ii.hbmColor); @@ -313,7 +318,7 @@ NetWMToWinIconThreshold(uint32_t *icon) uint32_t *pixels = &icon[2]; int row, col; HICON result; - ICONINFO ii = {TRUE}; + ICONINFO ii; HDC hdc = GetDC(NULL); HDC xorDC = CreateCompatibleDC(hdc); @@ -341,6 +346,9 @@ NetWMToWinIconThreshold(uint32_t *icon) DeleteDC(xorDC); DeleteDC(andDC); + ii.fIcon = TRUE; + ii.xHotspot = 0; + ii.yHotspot = 0; result = CreateIconIndirect(&ii); DeleteObject(ii.hbmColor); -- cgit v1.2.3