Commit ea1d71c7 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Set the NET_WM_ICON hint for 32-bpp icons.

parent ab13ffa4
...@@ -835,22 +835,58 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data, HICO ...@@ -835,22 +835,58 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data, HICO
{ {
HBITMAP hbmOrig; HBITMAP hbmOrig;
RECT rcMask; RECT rcMask;
BITMAP bmMask; BITMAP bm;
ICONINFO ii; ICONINFO ii;
HDC hDC; HDC hDC;
GetIconInfo(hIcon, &ii); GetIconInfo(hIcon, &ii);
GetObjectA(ii.hbmMask, sizeof(bmMask), &bmMask); GetObjectW(ii.hbmMask, sizeof(bm), &bm);
rcMask.top = 0; rcMask.top = 0;
rcMask.left = 0; rcMask.left = 0;
rcMask.right = bmMask.bmWidth; rcMask.right = bm.bmWidth;
rcMask.bottom = bmMask.bmHeight; rcMask.bottom = bm.bmHeight;
hDC = CreateCompatibleDC(0); hDC = CreateCompatibleDC(0);
hbmOrig = SelectObject(hDC, ii.hbmMask); hbmOrig = SelectObject(hDC, ii.hbmMask);
InvertRect(hDC, &rcMask); InvertRect(hDC, &rcMask);
SelectObject(hDC, ii.hbmColor); /* force the color bitmap to x11drv mode too */ SelectObject(hDC, ii.hbmColor); /* force the color bitmap to x11drv mode too */
GetObjectW(ii.hbmColor, sizeof(bm), &bm);
if (bm.bmBitsPixel == 32) /* FIXME: do this for other depths too */
{
BITMAPINFO info;
unsigned int size, *bits;
info.bmiHeader.biSize = sizeof(info);
info.bmiHeader.biWidth = bm.bmWidth;
info.bmiHeader.biHeight = -bm.bmHeight;
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 32;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = bm.bmWidth * bm.bmHeight * 4;
info.bmiHeader.biXPelsPerMeter = 0;
info.bmiHeader.biYPelsPerMeter = 0;
info.bmiHeader.biClrUsed = 0;
info.bmiHeader.biClrImportant = 0;
size = bm.bmWidth * bm.bmHeight + 2;
bits = HeapAlloc( GetProcessHeap(), 0, size * sizeof(long) );
if (bits && GetDIBits( hDC, ii.hbmColor, 0, bm.bmHeight, bits + 2, &info, DIB_RGB_COLORS ))
{
bits[0] = bm.bmWidth;
bits[1] = bm.bmHeight;
if (sizeof(long) > sizeof(int)) /* convert to array of longs */
{
int i = size;
while (--i >= 0) ((unsigned long *)bits)[i] = bits[i];
}
wine_tsx11_lock();
XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)bits, size );
wine_tsx11_unlock();
}
HeapFree( GetProcessHeap(), 0, bits );
}
SelectObject(hDC, hbmOrig); SelectObject(hDC, hbmOrig);
DeleteDC(hDC); DeleteDC(hDC);
......
...@@ -641,6 +641,7 @@ enum x11drv_atoms ...@@ -641,6 +641,7 @@ enum x11drv_atoms
XATOM__NET_SUPPORTED, XATOM__NET_SUPPORTED,
XATOM__NET_SYSTEM_TRAY_OPCODE, XATOM__NET_SYSTEM_TRAY_OPCODE,
XATOM__NET_SYSTEM_TRAY_S0, XATOM__NET_SYSTEM_TRAY_S0,
XATOM__NET_WM_ICON,
XATOM__NET_WM_MOVERESIZE, XATOM__NET_WM_MOVERESIZE,
XATOM__NET_WM_NAME, XATOM__NET_WM_NAME,
XATOM__NET_WM_PID, XATOM__NET_WM_PID,
......
...@@ -138,6 +138,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = ...@@ -138,6 +138,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"_NET_SUPPORTED", "_NET_SUPPORTED",
"_NET_SYSTEM_TRAY_OPCODE", "_NET_SYSTEM_TRAY_OPCODE",
"_NET_SYSTEM_TRAY_S0", "_NET_SYSTEM_TRAY_S0",
"_NET_WM_ICON",
"_NET_WM_MOVERESIZE", "_NET_WM_MOVERESIZE",
"_NET_WM_NAME", "_NET_WM_NAME",
"_NET_WM_PID", "_NET_WM_PID",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment