On Thu, Apr 15, 2010 at 7:04 AM, Erich Hoover <ehoo...@mines.edu> wrote:

> On Thu, Apr 15, 2010 at 2:22 AM, Roderick Colenbrander <
> thunderbir...@gmail.com> wrote:
>
>> I can't see the screenshot well but that's notepad? What display
>> drivers are you using?
>>
>> Roderick
>>
>> On Thu, Apr 15, 2010 at 3:36 AM, Erich Hoover <ehoo...@mines.edu> wrote:
>> > I noticed a problem with the icons in Wine when alt+tabbing today.
>> After
>> > doing a regression test it appears that commit
>> > c29cf0591976f96c3adb30c3c3b6db59f4983251 results in pixmaps that do not
>> > always display properly when alt+tabbing (see attached screenshot).
>> >
>>
>
> That's the notepad window in the compiz alt+tab dialog (everything except
> the window icon gets scaled).  The key feature is that in the bottom right
> corner the icon for the window is really messed up (black with a few dots of
> color).  It's also worth noting that the window icon does not display in the
> gnome taskbar at all after this patch, just a generic "this program has no
> icon" icon.  I'm using the nVidia driver version 185.18.36.
>

I looked into this a little and it appears like it's necessary to use the
extended window manager hint _NET_WM_ICON to use 32-bit window icons.  I've
whipped up a small patch (attached) that does this and it fixes the problem
I'm seeing (both with alt+tab and in the gnome taskbar), does this solution
appear acceptable?

Erich Hoover
ehoo...@mines.edu
From 279f193db8424110463d8077920435b9186af1dc Mon Sep 17 00:00:00 2001
From: Erich Hoover <ehoo...@mines.edu>
Date: Thu, 15 Apr 2010 10:02:06 -0600
Subject: winex11.drv: Set the _NET_WM_ICON for 32-bit window icons.

---
 dlls/winex11.drv/window.c      |   21 +++++++++++++++++++++
 dlls/winex11.drv/x11drv.h      |    1 +
 dlls/winex11.drv/x11drv_main.c |    1 +
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index a9a3769..f42f537 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -833,6 +833,7 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data, HICO
     }
     else
     {
+        DIBSECTION bmpXor;
         HBITMAP hbmOrig;
         RECT rcMask;
         BITMAP bmMask;
@@ -861,6 +862,26 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data, HICO
         hints->icon_mask = X11DRV_get_pixmap(data->hWMIconMask);
         destroy_icon_window( display, data );
         hints->flags = (hints->flags & ~IconWindowHint) | IconPixmapHint | IconMaskHint;
+
+        GetObjectW( ii.hbmColor, sizeof(bmpXor), &bmpXor );
+        /* Icons with an alpha channel need to be handled using the _NET_WM_ICON property */
+        if (bmpXor.dsBm.bmBitsPixel == 32)
+        {
+            int xorLength, wm_icon_size;
+            char *xor_bits;
+
+            wm_icon_size = 2 + bmpXor.dsBm.bmWidth * bmpXor.dsBm.bmHeight;
+            xorLength = bmpXor.dsBm.bmWidth * bmpXor.dsBm.bmHeight * 4;
+            xor_bits = (char *) HeapAlloc( GetProcessHeap(), 0, wm_icon_size * 4 );
+            memcpy(&xor_bits[0*4], &bmpXor.dsBm.bmWidth, 4);
+            memcpy(&xor_bits[1*4], &bmpXor.dsBm.bmHeight, 4);
+            GetBitmapBits( ii.hbmColor, xorLength, &xor_bits[2*4] );
+            wine_tsx11_lock();
+            XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON), XA_CARDINAL, 32,
+                             PropModeReplace, (unsigned char *) xor_bits, wm_icon_size);
+            wine_tsx11_unlock();
+            HeapFree( GetProcessHeap(), 0, xor_bits );
+        }
     }
 }
 
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index b4ccff3..cd96700 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -635,6 +635,7 @@ enum x11drv_atoms
     XATOM__NET_WM_NAME,
     XATOM__NET_WM_PID,
     XATOM__NET_WM_PING,
+    XATOM__NET_WM_ICON,
     XATOM__NET_WM_STATE,
     XATOM__NET_WM_STATE_ABOVE,
     XATOM__NET_WM_STATE_FULLSCREEN,
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index a7f7ae0..56e64f4 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -142,6 +142,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
     "_NET_WM_NAME",
     "_NET_WM_PID",
     "_NET_WM_PING",
+    "_NET_WM_ICON",
     "_NET_WM_STATE",
     "_NET_WM_STATE_ABOVE",
     "_NET_WM_STATE_FULLSCREEN",
-- 
1.6.3.3



Reply via email to