diff options
author | marha <marha@users.sourceforge.net> | 2012-08-01 11:13:44 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-01 11:13:44 +0200 |
commit | ebfd1ae8f80dd16f99f9ef89c28a06f809d07f8d (patch) | |
tree | 5934936b4eab90a9d29753a6dd80b557e111fc0a /xorg-server/hw | |
parent | e7912ee7dc5d7556254e1fd831174520d7447608 (diff) | |
download | vcxsrv-ebfd1ae8f80dd16f99f9ef89c28a06f809d07f8d.tar.gz vcxsrv-ebfd1ae8f80dd16f99f9ef89c28a06f809d07f8d.tar.bz2 vcxsrv-ebfd1ae8f80dd16f99f9ef89c28a06f809d07f8d.zip |
Synchronised with xwin master branch
Diffstat (limited to 'xorg-server/hw')
-rw-r--r-- | xorg-server/hw/xwin/win.h | 12 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowicons.c | 422 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowicons.h | 42 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwindow.c | 95 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwm.c | 183 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winprefs.c | 48 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winprefs.h | 2 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwin32rootless.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwin32rootlesswindow.c | 31 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwindow.h | 13 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwindowswm.c | 2 |
11 files changed, 435 insertions, 417 deletions
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 965be46f1..4135db1f2 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -1142,15 +1142,6 @@ Bool void winSetShapeRootless(WindowPtr pWindow, int kind); -/* - * winmultiwindowicons.c - Used by both multi-window and Win32Rootless - */ - -HICON winXIconToHICON(WindowPtr pWin, int iconSize); - -void - winSelectIcons(WindowPtr pWin, HICON * pIcon, HICON * pSmallIcon); - #ifdef XWIN_MULTIWINDOW /* * winmultiwindowshape.c @@ -1330,9 +1321,6 @@ void winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h); void - winMWExtWMUpdateIcon(Window id); - -void winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv, winScreenInfoPtr pScreenInfo); diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c index 42bdb5f9c..28bf35303 100644 --- a/xorg-server/hw/xwin/winmultiwindowicons.c +++ b/xorg-server/hw/xwin/winmultiwindowicons.c @@ -31,75 +31,65 @@ #ifdef HAVE_XWIN_CONFIG_H #include <xwin-config.h> #endif -#include "win.h" -#include "dixevents.h" -#include "winmultiwindowclass.h" -#include "winprefs.h" -#include "propertyst.h" -#include "windowstr.h" +#ifndef WINVER +#define WINVER 0x0500 +#endif + +#include <X11/Xwindows.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include "winresource.h" +#include "winprefs.h" +#include "winmsg.h" +#include "winmultiwindowicons.h" +#include "winglobals.h" /* - * Prototypes for local functions + * global variables */ - -static void - -winScaleXBitmapToWindows(int iconSize, int effBPP, - PixmapPtr pixmap, unsigned char *image); +extern HINSTANCE g_hInstance; /* - * Scale an X icon bitmap into a Windoze icon bitmap + * Scale an X icon ZPixmap into a Windoze icon bitmap */ static void -winScaleXBitmapToWindows(int iconSize, - int effBPP, PixmapPtr pixmap, unsigned char *image) +winScaleXImageToWindowsIcon(int iconSize, + int effBPP, + int stride, XImage * pixmap, unsigned char *image) { int row, column, effXBPP, effXDepth; unsigned char *outPtr; - char *iconData = 0; - int stride, xStride; + unsigned char *iconData = 0; + int xStride; float factX, factY; int posX, posY; unsigned char *ptr; unsigned int zero; unsigned int color; - effXBPP = BitsPerPixel(pixmap->drawable.depth); - effXDepth = pixmap->drawable.depth; - - if (pixmap->drawable.bitsPerPixel == 15) + effXBPP = pixmap->bits_per_pixel; + if (pixmap->bits_per_pixel == 15) effXBPP = 16; - if (pixmap->drawable.depth == 15) + effXDepth = pixmap->depth; + if (pixmap->depth == 15) effXDepth = 16; - /* Need 16-bit aligned rows for DDBitmaps */ - stride = ((iconSize * effBPP + 15) & (~15)) / 8; - xStride = PixmapBytePad(pixmap->drawable.width, pixmap->drawable.depth); + xStride = pixmap->bytes_per_line; if (stride == 0 || xStride == 0) { ErrorF("winScaleXBitmapToWindows - stride or xStride is zero. " "Bailing.\n"); return; } - /* Allocate memory for icon data */ - iconData = malloc(xStride * pixmap->drawable.height); - if (!iconData) { - ErrorF("winScaleXBitmapToWindows - malloc failed for iconData. " - "Bailing.\n"); - return; - } - /* Get icon data */ - miGetImage((DrawablePtr) &(pixmap->drawable), 0, 0, - pixmap->drawable.width, pixmap->drawable.height, - ZPixmap, 0xffffffff, iconData); + iconData = (unsigned char *) pixmap->data; /* Keep aspect ratio */ - factX = ((float) pixmap->drawable.width) / ((float) iconSize); - factY = ((float) pixmap->drawable.height) / ((float) iconSize); + factX = ((float) pixmap->width) / ((float) iconSize); + factY = ((float) pixmap->height) / ((float) iconSize); if (factX > factY) factY = factX; else @@ -119,8 +109,7 @@ winScaleXBitmapToWindows(int iconSize, ptr += posX / 8; /* Out of X icon bounds, leave space blank */ - if (posX >= pixmap->drawable.width - || posY >= pixmap->drawable.height) + if (posX >= pixmap->width || posY >= pixmap->height) ptr = (unsigned char *) &zero; if ((*ptr) & (1 << (posX & 7))) @@ -162,8 +151,7 @@ winScaleXBitmapToWindows(int iconSize, ptr += posX * (effXBPP / 8); /* Out of X icon bounds, leave space blank */ - if (posX >= pixmap->drawable.width - || posY >= pixmap->drawable.height) + if (posX >= pixmap->width || posY >= pixmap->height) ptr = (unsigned char *) &zero; color = (((*ptr) << 16) + ((*(ptr + 1)) << 8) @@ -203,8 +191,7 @@ winScaleXBitmapToWindows(int iconSize, ptr += posX * (effXBPP / 8); /* Out of X icon bounds, leave space blank */ - if (posX >= pixmap->drawable.width - || posY >= pixmap->drawable.height) + if (posX >= pixmap->width || posY >= pixmap->height) ptr = (unsigned char *) &zero; color = ((*ptr) << 8) + (*(ptr + 1)); switch (effBPP) { @@ -238,7 +225,6 @@ winScaleXBitmapToWindows(int iconSize, } /* end if effxbpp==16) */ } /* end for column */ } /* end for row */ - free(iconData); } static HICON @@ -250,22 +236,25 @@ NetWMToWinIconAlpha(uint32_t * icon) HICON result; HDC hdc = GetDC(NULL); uint32_t *DIB_pixels; - ICONINFO ii; - BITMAPV5HEADER bmh; + ICONINFO ii; + BITMAPV5HEADER bmh; /* Define an ARGB pixel format used for Color+Alpha icons */ - 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; + 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.fIcon = TRUE; + ii.xHotspot = 0; /* ignored */ + ii.yHotspot = 0; /* ignored */ ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) & bmh, DIB_RGB_COLORS, (void **) &DIB_pixels, NULL, 0); @@ -276,9 +265,6 @@ 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); @@ -302,6 +288,9 @@ NetWMToWinIconThreshold(uint32_t * icon) HDC xorDC = CreateCompatibleDC(hdc); HDC andDC = CreateCompatibleDC(hdc); + ii.fIcon = TRUE; + ii.xHotspot = 0; /* ignored */ + ii.yHotspot = 0; /* ignored */ ii.hbmColor = CreateCompatibleBitmap(hdc, width, height); ii.hbmMask = CreateCompatibleBitmap(hdc, width, height); ReleaseDC(NULL, hdc); @@ -326,9 +315,6 @@ NetWMToWinIconThreshold(uint32_t * icon) DeleteDC(xorDC); DeleteDC(andDC); - ii.fIcon = TRUE; - ii.xHotspot = 0; - ii.yHotspot = 0; result = CreateIconIndirect(&ii); DeleteObject(ii.hbmColor); @@ -363,7 +349,7 @@ NetWMToWinIcon(int bpp, uint32_t * icon) dwlConditionMask); versionChecked = TRUE; - winDebug("OS has icon alpha channel support: %s\n", + winDebug("OS has icon alpha channel support: %s\n", hasIconAlphaChannel ? "yes" : "no"); } @@ -373,202 +359,220 @@ NetWMToWinIcon(int bpp, uint32_t * icon) return NetWMToWinIconThreshold(icon); } -static pointer -GetWindowProp(WindowPtr pWin, Atom name, long int *size_return) -{ - struct _Window *pwin; - struct _Property *prop; - - if (!pWin || !name) { - ErrorF("GetWindowProp - pWin or name was NULL\n"); - return 0; - } - pwin = (struct _Window *) pWin; - if (!pwin->optional) - return NULL; - for (prop = (struct _Property *) pwin->optional->userProps; - prop; prop = prop->next) { - if (prop->propertyName == name) { - *size_return = prop->size; - return prop->data; - } - } - return NULL; -} - /* * Attempt to create a custom icon from the WM_HINTS bitmaps */ -HICON -winXIconToHICON(WindowPtr pWin, int iconSize) +static + HICON +winXIconToHICON(Display * pDisplay, Window id, int iconSize) { - unsigned char *mask, *image, *imageMask; + unsigned char *mask, *image = NULL, *imageMask; unsigned char *dst, *src; - PixmapPtr iconPtr; - PixmapPtr maskPtr; - int planes, bpp, effBPP, stride, maskStride, i; + int planes, bpp, i; int biggest_size = 0; HDC hDC; ICONINFO ii; - WinXWMHints hints; + XWMHints *hints; HICON hIcon = NULL; uint32_t *biggest_icon = NULL; - /* Try to get _NET_WM_ICON icons first */ static Atom _XA_NET_WM_ICON; static int generation; uint32_t *icon, *icon_data = NULL; - long int size = 0; + unsigned long int size; + unsigned long int type; + int format; + unsigned long int left; hDC = GetDC(GetDesktopWindow()); planes = GetDeviceCaps(hDC, PLANES); bpp = GetDeviceCaps(hDC, BITSPIXEL); ReleaseDC(GetDesktopWindow(), hDC); + /* Always prefer _NET_WM_ICON icons */ if (generation != serverGeneration) { generation = serverGeneration; - _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON", 12, TRUE); + _XA_NET_WM_ICON = XInternAtom(pDisplay, "_NET_WM_ICON", FALSE); } - if (_XA_NET_WM_ICON) - icon_data = GetWindowProp(pWin, _XA_NET_WM_ICON, &size); - if (icon_data) { - for (icon = icon_data; - icon < &icon_data[size] && *icon; + if ((XGetWindowProperty(pDisplay, id, _XA_NET_WM_ICON, + 0, MAXINT, FALSE, + AnyPropertyType, &type, &format, &size, &left, + (unsigned char **) &icon_data) == Success) && + (icon_data != NULL)) { + for (icon = icon_data; icon < &icon_data[size] && *icon; icon = &icon[icon[0] * icon[1] + 2]) { - if (icon[0] == iconSize && icon[1] == iconSize) - return NetWMToWinIcon(bpp, icon); - /* Find the biggest icon and let Windows scale the size */ + /* Find an exact match to the size we require... */ + if (icon[0] == iconSize && icon[1] == iconSize) { + winDebug("winXIconToHICON: found %lu x %lu NetIcon\n", icon[0], + icon[1]); + hIcon = NetWMToWinIcon(bpp, icon); + break; + } + /* Otherwise, find the biggest icon and let Windows scale the size */ else if (biggest_size < icon[0]) { biggest_icon = icon; biggest_size = icon[0]; } } - if (biggest_icon) - return NetWMToWinIcon(bpp, biggest_icon); - } - winDebug("winXIconToHICON - pWin %x: no suitable NetIcon\n", (int) pWin, - iconSize); - winMultiWindowGetWMHints(pWin, &hints); - if (!hints.icon_pixmap) - return NULL; + if (!hIcon && biggest_icon) { + winDebug + ("winXIconToHICON: selected %lu x %lu NetIcon for scaling to %u x %u\n", + biggest_icon[0], biggest_icon[1], iconSize, iconSize); - dixLookupResourceByType((pointer) &iconPtr, hints.icon_pixmap, RT_PIXMAP, - NullClient, DixUnknownAccess); + hIcon = NetWMToWinIcon(bpp, biggest_icon); + } - if (!iconPtr) - return NULL; + XFree(icon_data); + } - /* 15 BPP is really 16BPP as far as we care */ - if (bpp == 15) - effBPP = 16; - else - effBPP = bpp; + if (!hIcon) { + winDebug("winXIconToHICON: no suitable NetIcon\n"); + + hints = XGetWMHints(pDisplay, id); + if (hints) { + winDebug("winXIconToHICON: id 0x%x icon_pixmap hint %x\n", id, + hints->icon_pixmap); + + if (hints->icon_pixmap) { + Window root; + int x, y; + unsigned int width, height, border_width, depth; + XImage *xImageIcon; + XImage *xImageMask = NULL; + + XGetGeometry(pDisplay, hints->icon_pixmap, &root, &x, &y, + &width, &height, &border_width, &depth); + + xImageIcon = + XGetImage(pDisplay, hints->icon_pixmap, 0, 0, width, height, + 0xFFFFFFFF, ZPixmap); + winDebug("winXIconToHICON: id 0x%x icon Ximage 0x%x\n", id, + xImageIcon); + + if (hints->icon_mask) + xImageMask = + XGetImage(pDisplay, hints->icon_mask, 0, 0, width, + height, 0xFFFFFFFF, ZPixmap); + + if (xImageIcon) { + int effBPP, stride, maskStride; + + /* 15 BPP is really 16BPP as far as we care */ + if (bpp == 15) + effBPP = 16; + else + effBPP = bpp; - /* Need 16-bit aligned rows for DDBitmaps */ - stride = ((iconSize * effBPP + 15) & (~15)) / 8; + /* Need 16-bit aligned rows for DDBitmaps */ + stride = ((iconSize * effBPP + 15) & (~15)) / 8; - /* Mask is 1-bit deep */ - maskStride = ((iconSize * 1 + 15) & (~15)) / 8; + /* Mask is 1-bit deep */ + maskStride = ((iconSize * 1 + 15) & (~15)) / 8; - image = malloc(stride * iconSize); - imageMask = malloc(stride * iconSize); - /* Default to a completely black mask */ - mask = calloc(maskStride, iconSize); + image = malloc(stride * iconSize); + imageMask = malloc(stride * iconSize); + mask = malloc(maskStride * iconSize); - winScaleXBitmapToWindows(iconSize, effBPP, iconPtr, image); - dixLookupResourceByType((pointer) &maskPtr, hints.icon_mask, RT_PIXMAP, - NullClient, DixUnknownAccess); + /* Default to a completely black mask */ + memset(imageMask, 0, stride * iconSize); + memset(mask, 0, maskStride * iconSize); - if (maskPtr) { - winScaleXBitmapToWindows(iconSize, 1, maskPtr, mask); + winScaleXImageToWindowsIcon(iconSize, effBPP, stride, + xImageIcon, image); - winScaleXBitmapToWindows(iconSize, effBPP, maskPtr, imageMask); + if (xImageMask) { + winScaleXImageToWindowsIcon(iconSize, 1, maskStride, + xImageMask, mask); + winScaleXImageToWindowsIcon(iconSize, effBPP, stride, + xImageMask, imageMask); + } - /* Now we need to set all bits of the icon which are not masked */ - /* on to 0 because Color is really an XOR, not an OR function */ - dst = image; - src = imageMask; + /* Now we need to set all bits of the icon which are not masked */ + /* on to 0 because Color is really an XOR, not an OR function */ + dst = image; + src = imageMask; - for (i = 0; i < (stride * iconSize); i++) - if ((*(src++))) - *(dst++) = 0; - else - dst++; - } + for (i = 0; i < (stride * iconSize); i++) + if ((*(src++))) + *(dst++) = 0; + else + dst++; - ii.fIcon = TRUE; - ii.xHotspot = 0; /* ignored */ - ii.yHotspot = 0; /* ignored */ + ii.fIcon = TRUE; + ii.xHotspot = 0; /* ignored */ + ii.yHotspot = 0; /* ignored */ - /* Create Win32 mask from pixmap shape */ - ii.hbmMask = CreateBitmap(iconSize, iconSize, planes, 1, mask); + /* Create Win32 mask from pixmap shape */ + ii.hbmMask = + CreateBitmap(iconSize, iconSize, planes, 1, mask); - /* Create Win32 bitmap from pixmap */ - ii.hbmColor = CreateBitmap(iconSize, iconSize, planes, bpp, image); + /* Create Win32 bitmap from pixmap */ + ii.hbmColor = + CreateBitmap(iconSize, iconSize, planes, bpp, image); - /* Merge Win32 mask and bitmap into icon */ - hIcon = CreateIconIndirect(&ii); + /* Merge Win32 mask and bitmap into icon */ + hIcon = CreateIconIndirect(&ii); - /* Release Win32 mask and bitmap */ - DeleteObject(ii.hbmMask); - DeleteObject(ii.hbmColor); + /* Release Win32 mask and bitmap */ + DeleteObject(ii.hbmMask); + DeleteObject(ii.hbmColor); + + /* Free X mask and bitmap */ + free(mask); + free(image); + free(imageMask); - /* Free X mask and bitmap */ - free(mask); - free(image); - free(imageMask); + if (xImageMask) + XDestroyImage(xImageMask); + XDestroyImage(xImageIcon); + } + } + XFree(hints); + } + } return hIcon; } /* - * Change the Windows window icon + * Change the Windows window icon */ #ifdef XWIN_MULTIWINDOW void -winUpdateIcon(Window id) +winUpdateIcon(HWND hWnd, Display * pDisplay, Window id, HICON hIconNew) { - WindowPtr pWin; HICON hIcon, hIconSmall = NULL, hIconOld; - dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, - DixUnknownAccess); - if (pWin) { - winWindowPriv(pWin); - if (pWinPriv->hWnd) { - hIcon = winOverrideIcon((unsigned long) pWin); - if (!hIcon) { - hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON)); - if (!hIcon) { - hIcon = g_hIconX; - hIconSmall = g_hSmallIconX; - } - else { - /* Leave undefined if not found */ - hIconSmall = - winXIconToHICON(pWin, GetSystemMetrics(SM_CXSMICON)); - } - } - - /* Set the large icon */ - hIconOld = (HICON) SendMessage(pWinPriv->hWnd, - WM_SETICON, ICON_BIG, - (LPARAM) hIcon); + /* Start with the icon from preferences, if any */ + hIcon = hIconNew; + hIconSmall = hIconNew; - /* Delete the icon if its not the default */ - winDestroyIcon(hIconOld); + /* If we still need an icon, try and get the icon from WM_HINTS */ + if (!hIcon) + hIcon = winXIconToHICON(pDisplay, id, GetSystemMetrics(SM_CXICON)); + if (!hIconSmall) + hIconSmall = + winXIconToHICON(pDisplay, id, GetSystemMetrics(SM_CXSMICON)); - /* Same for the small icon */ - hIconOld = (HICON) SendMessage(pWinPriv->hWnd, - WM_SETICON, ICON_SMALL, - (LPARAM) hIconSmall); - winDestroyIcon(hIconOld); - } + /* If we got the small, but not the large one swap them */ + if (!hIcon && hIconSmall) { + hIcon = hIconSmall; + hIconSmall = NULL; } + + /* Set the large icon */ + hIconOld = (HICON) SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon); + /* Delete the old icon if its not the default */ + winDestroyIcon(hIconOld); + + /* Same for the small icon */ + hIconOld = + (HICON) SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); + winDestroyIcon(hIconOld); } void @@ -599,37 +603,21 @@ winInitGlobalIcons(void) } void -winSelectIcons(WindowPtr pWin, HICON * pIcon, HICON * pSmallIcon) +winSelectIcons(HICON * pIcon, HICON * pSmallIcon) { HICON hIcon, hSmallIcon; winInitGlobalIcons(); - /* Try and get the icon from WM_HINTS */ - hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON)); - hSmallIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXSMICON)); - - /* If we got the small, but not the large one swap them */ - if (!hIcon && hSmallIcon) { - hIcon = hSmallIcon; - hSmallIcon = NULL; - } - - /* Use default X icon if no icon loaded from WM_HINTS */ - if (!hIcon) { - hIcon = g_hIconX; - hSmallIcon = g_hSmallIconX; - } + /* Use default X icon */ + hIcon = g_hIconX; + hSmallIcon = g_hSmallIconX; if (pIcon) *pIcon = hIcon; - else - winDestroyIcon(hIcon); if (pSmallIcon) *pSmallIcon = hSmallIcon; - else - winDestroyIcon(hSmallIcon); } void diff --git a/xorg-server/hw/xwin/winmultiwindowicons.h b/xorg-server/hw/xwin/winmultiwindowicons.h new file mode 100644 index 000000000..bf7f6eda7 --- /dev/null +++ b/xorg-server/hw/xwin/winmultiwindowicons.h @@ -0,0 +1,42 @@ +/* + * File: winmultiwindowicons.h + * Purpose: interface for multiwindow mode icon functions + * + * Copyright (c) Jon TURNEY 2012 + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef WINMULTIWINDOWICONS_H +#define WINMULTIWINDOWICONS_H + +void + winUpdateIcon(HWND hWnd, Display * pDisplay, Window id, HICON hIconNew); + +void + winInitGlobalIcons(void); + +void + winDestroyIcon(HICON hIcon); + +void + winSelectIcons(HICON * pIcon, HICON * pSmallIcon); + +#endif /* WINMULTIWINDOWICONS_H */ diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 3bdc2138d..3100ea640 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -63,6 +63,11 @@ winInitMultiWindowClass(void) WNDCLASSEX wcx; if (atomXWinClass == 0) { + HICON hIcon, hIconSmall; + + /* Load the default icons */ + winSelectIcons(&hIcon, &hIconSmall); + /* Setup our window class */ wcx.cbSize = sizeof(WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0); @@ -70,15 +75,15 @@ winInitMultiWindowClass(void) wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = g_hInstance; - wcx.hIcon = g_hIconX; + wcx.hIcon = hIcon; wcx.hCursor = 0; wcx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wcx.lpszMenuName = NULL; wcx.lpszClassName = WINDOW_CLASS_X; - wcx.hIconSm = g_hSmallIconX; + wcx.hIconSm = hIconSmall; #if CYGMULTIWINDOW_DEBUG - winDebug ("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X); + winDebug ("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X); #endif atomXWinClass = RegisterClassEx(&wcx); @@ -99,7 +104,7 @@ winCreateWindowMultiWindow(WindowPtr pWin) winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG - winDebug ("winCreateWindowMultiWindow - pWin: %p\n", pWin); + winDebug ("winCreateWindowMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(CreateWindow); @@ -132,7 +137,7 @@ winDestroyWindowMultiWindow(WindowPtr pWin) winScreenPriv(pScreen); #if CYGMULTIWINDOW_DEBUG - winDebug ("winDestroyWindowMultiWindow - pWin: %p\n", pWin); + winDebug ("winDestroyWindowMultiWindow - pWin: %p\n", pWin); #endif WIN_UNWRAP(DestroyWindow); @@ -169,6 +174,7 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y) HWND hWnd = pWinPriv->hWnd; RECT rcNew; RECT rcOld; + #ifdef WINDBG RECT rcClient; RECT *lpRc; @@ -176,23 +182,22 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y) DWORD dwExStyle; DWORD dwStyle; - winDebug ("winPositionWindowMultiWindow - pWin: %p\n", pWin); + winDebug ("winPositionWindowMultiWindow - pWin: %p\n", pWin); WIN_UNWRAP(PositionWindow); fResult = (*pScreen->PositionWindow) (pWin, x, y); WIN_WRAP(PositionWindow, winPositionWindowMultiWindow); - winDebug ("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n", - x, y); + winDebug ("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n", x, y); /* Bail out if the Windows window handle is bad */ if (!hWnd) { - winDebug ("\timmediately return since hWnd is NULL\n"); - if (pWin->redirectDraw != RedirectDrawNone) - { - winDebug("winPositionWindowMultiWindow: Calling compReallocPixmap to make sure the pixmap buffer is valid.\n"); - compReallocPixmap(pWin, x, y, pWin->drawable.width, pWin->drawable.height, pWin->borderWidth); - } + winDebug ("\timmediately return since hWnd is NULL\n"); + if (pWin->redirectDraw != RedirectDrawNone) + { + winDebug("winPositionWindowMultiWindow: Calling compReallocPixmap to make sure the pixmap buffer is valid.\n"); + compReallocPixmap(pWin, x, y, pWin->drawable.width, pWin->drawable.height, pWin->borderWidth); + } return fResult; } @@ -213,7 +218,7 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y) #if CYGMULTIWINDOW_DEBUG lpRc = &rcNew; - winDebug ("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n", + winDebug ("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n", GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom); #endif @@ -256,15 +261,13 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y) int iHeight=rcNew.bottom - rcNew.top; ScreenToClient(GetParent(hWnd), (LPPOINT)&rcNew); MoveWindow (hWnd, - rcNew.left, rcNew.top, - iWidth, iHeight, - TRUE); + rcNew.left, rcNew.top, + iWidth, iHeight, TRUE); } else MoveWindow (hWnd, - rcNew.left, rcNew.top, - rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, - TRUE); + rcNew.left, rcNew.top, + rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, TRUE); } else { winDebug ("winPositionWindowMultiWindow - Not need to move\n"); @@ -400,7 +403,7 @@ winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib) winScreenPriv(pScreen); - winDebug ("winRestackMultiWindow - %08x\n", pWin); + winDebug ("winRestackMultiWindow - %08x\n", pWin); WIN_UNWRAP(RestackWindow); if (pScreen->RestackWindow) @@ -429,8 +432,6 @@ winCreateWindowsWindow(WindowPtr pWin) HWND hFore = NULL; winWindowPriv(pWin); - HICON hIcon; - HICON hIconSmall; winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv; WinXSizeHints hints; WindowPtr pDaddy; @@ -452,12 +453,9 @@ winCreateWindowsWindow(WindowPtr pWin) make sure the window actually ends up somewhere where it will be visible Dont't do it by making just one of the two iX and iY CW_USEDEFAULT since this will create a window at place CW_USEDEFAULT which is 0x80000000 */ - if (pWin->drawable.class != InputOnly) - { - while (1) - { - if (iX < GetSystemMetrics (SM_XVIRTUALSCREEN)) - { + if (pWin->drawable.class != InputOnly) { + while (1) { + if (iX < GetSystemMetrics (SM_XVIRTUALSCREEN)) { iX = GetSystemMetrics (SM_XVIRTUALSCREEN); ErrorF("Resetting iX to %d\n",iX); } @@ -470,15 +468,12 @@ winCreateWindowsWindow(WindowPtr pWin) break; } - while (1) - { - if (iY < GetSystemMetrics (SM_YVIRTUALSCREEN)) - { + while (1) { + if (iY < GetSystemMetrics (SM_YVIRTUALSCREEN)) { iY = GetSystemMetrics (SM_YVIRTUALSCREEN); ErrorF("Resetting iY to %d\n",iY); } - else if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN)) - { + else if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN)) { iY = GetSystemMetrics (SM_CYVIRTUALSCREEN)-iHeight; ErrorF("Resetting iY to %d\n",iY); } @@ -551,21 +546,13 @@ winCreateWindowsWindow(WindowPtr pWin) } pWinPriv->hWnd = hWnd; - /* Set application or .XWinrc defined Icons */ - winSelectIcons(pWin, &hIcon, &hIconSmall); - if (hIcon) - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon); - if (hIconSmall) - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); - - /* If we asked the native WM to place the window, synchronize the X window position. - Do this before the next SetWindowPos because this one is generating a WM_STYLECHANGED - message which is causing a window move, which is wrong if the Xwindow does not - have the correct coordinates yet */ - if (iX == CW_USEDEFAULT) - { - winAdjustXWindow(pWin, hWnd); - } + /* If we asked the native WM to place the window, synchronize the X window position. + Do this before the next SetWindowPos because this one is generating a WM_STYLECHANGED + message which is causing a window move, which is wrong if the Xwindow does not + have the correct coordinates yet */ + if (iX == CW_USEDEFAULT) { + winAdjustXWindow(pWin, hWnd); + } /* Change style back to popup, already placed... */ SetWindowLongPtr(hWnd, GWL_STYLE, @@ -718,7 +705,7 @@ winUpdateWindowsWindow(WindowPtr pWin) } #if CYGMULTIWINDOW_DEBUG - winDebug ("-winUpdateWindowsWindow\n"); + winDebug ("-winUpdateWindowsWindow\n"); #endif } @@ -736,7 +723,7 @@ winGetWindowID(WindowPtr pWin) FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi); #if CYGMULTIWINDOW_DEBUG - winDebug ("winGetWindowID - Window ID: %d\n", wi.id); + winDebug ("winGetWindowID - Window ID: %d\n", wi.id); #endif return wi.id; @@ -775,7 +762,7 @@ winReorderWindowsMultiWindow(void) if (fRestacking) { /* It is a recusive call so immediately exit */ - winDebug ("winReorderWindowsMultiWindow - " + winDebug ("winReorderWindowsMultiWindow - " "exit because fRestacking == TRUE\n"); return; } diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index df44b1d6c..88109ceab 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -159,7 +159,7 @@ static Bool InitQueue(WMMsgQueuePtr pQueue); static void - GetWindowName(Display * pDpy, Window iWin, wchar_t ** ppName); + GetWindowName(Display * pDpy, Window iWin, char **ppWindowName); static int SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData); @@ -373,34 +373,19 @@ InitQueue(WMMsgQueuePtr pQueue) return TRUE; } -/* - * GetWindowName - Retrieve the title of an X Window - */ - -static void -GetWindowName(Display * pDisplay, Window iWin, wchar_t ** ppName) +static +char * +Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp) { - int nResult, nNum; + int nNum; char **ppList; char *pszReturnData; - int iLen, i; - XTextProperty xtpName; - - winDebug ("GetWindowName\n"); - /* Intialize ppName to NULL */ - *ppName = NULL; + if (Xutf8TextPropertyToTextList(pDisplay, xtp, &ppList, &nNum) >= Success && + nNum > 0 && *ppList) { + int i; + int iLen = 0; - /* Try to get --- */ - nResult = XGetWMName(pDisplay, iWin, &xtpName); - if (!nResult || !xtpName.value || !xtpName.nitems) { - ErrorF("GetWindowName - XGetWMName failed. No name.\n"); - return; - } - - if (Xutf8TextPropertyToTextList(pDisplay, &xtpName, &ppList, &nNum) >= - Success && nNum > 0 && *ppList) { - iLen = 0; for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]); pszReturnData = (char *) malloc(iLen + 1); @@ -414,12 +399,36 @@ GetWindowName(Display * pDisplay, Window iWin, wchar_t ** ppName) pszReturnData = (char *) malloc(1); pszReturnData[0] = '\0'; } - iLen = MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, NULL, 0); - *ppName = (wchar_t *) malloc(sizeof(wchar_t) * (iLen + 1)); - MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, *ppName, iLen); - XFree(xtpName.value); - free(pszReturnData); - winDebug ("GetWindowName - Returning\n"); + + return pszReturnData; +} + +/* + * GetWindowName - Retrieve the title of an X Window + */ + +static void +GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) +{ + int nResult; + XTextProperty xtpWindowName; + char *pszWindowName; + + winDebug ("GetWindowName\n"); + + /* Intialize ppWindowName to NULL */ + *ppWindowName = NULL; + + /* Try to get window name */ + nResult = XGetWMName(pDisplay, iWin, &xtpWindowName); + if (!nResult || !xtpWindowName.value || !xtpWindowName.nitems) { + ErrorF("GetWindowName - XGetWMName failed. No name.\n"); + return; + } + + pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName); + XFree(xtpWindowName.value); + *ppWindowName = pszWindowName; } /* @@ -495,18 +504,70 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow) if (!hWnd) return; - /* Set the Windows window name */ - GetWindowName(pWMInfo->pDisplay, iWindow, &pszName); - if (pszName) { - /* Get the window attributes */ - XGetWindowAttributes(pWMInfo->pDisplay, iWindow, &attr); - if (!attr.override_redirect) { - SetWindowTextW(hWnd, pszName); - winUpdateIcon(iWindow); + /* If window isn't override-redirect */ + XGetWindowAttributes(pWMInfo->pDisplay, iWindow, &attr); + if (!attr.override_redirect) { + char *pszWindowName; + + /* Get the X windows window name */ + GetWindowName(pWMInfo->pDisplay, iWindow, &pszWindowName); + + if (pszWindowName) { + /* Convert from UTF-8 to wide char */ + int iLen = + MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, NULL, 0); + wchar_t *pwszWideWindowName = + (wchar_t *) malloc(sizeof(wchar_t) * (iLen + 1)); + MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, + pwszWideWindowName, iLen); + + /* Set the Windows window name */ + SetWindowTextW(hWnd, pwszWideWindowName); + + free(pwszWideWindowName); + free(pszWindowName); } + } +} + +/* + * Updates the icon of a HWND according to its X icon properties + */ + +static void +UpdateIcon(WMInfoPtr pWMInfo, Window iWindow) +{ + HWND hWnd; + HICON hIconNew = NULL; + XWindowAttributes attr; + + hWnd = getHwnd(pWMInfo, iWindow); + if (!hWnd) + return; - free(pszName); + /* If window isn't override-redirect */ + XGetWindowAttributes(pWMInfo->pDisplay, iWindow, &attr); + if (!attr.override_redirect) { + XClassHint class_hint = { 0, 0 }; + char *window_name = 0; + + if (XGetClassHint(pWMInfo->pDisplay, iWindow, &class_hint)) { + XFetchName(pWMInfo->pDisplay, iWindow, &window_name); + + hIconNew = + (HICON) winOverrideIcon(class_hint.res_name, + class_hint.res_class, window_name); + + if (class_hint.res_name) + XFree(class_hint.res_name); + if (class_hint.res_class) + XFree(class_hint.res_class); + if (window_name) + XFree(window_name); + } } + + winUpdateIcon(hWnd, pWMInfo->pDisplay, iWindow, hIconNew); } #if 0 @@ -613,7 +674,7 @@ winMultiWindowWMProc(void *pArg) PropModeReplace, (unsigned char *) &(pNode->msg.hwndWindow), 1); UpdateName(pWMInfo, pNode->msg.iWindow); - winUpdateIcon(pNode->msg.iWindow); + UpdateIcon(pWMInfo, pNode->msg.iWindow); { HWND zstyle = HWND_NOTOPMOST; winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle); @@ -639,7 +700,7 @@ winMultiWindowWMProc(void *pArg) PropModeReplace, (unsigned char *) &(pNode->msg.hwndWindow), 1); UpdateName(pWMInfo, pNode->msg.iWindow); - winUpdateIcon(pNode->msg.iWindow); + UpdateIcon(pWMInfo, pNode->msg.iWindow); { HWND zstyle = HWND_NOTOPMOST; @@ -695,8 +756,8 @@ winMultiWindowWMProc(void *pArg) UpdateName(pWMInfo, pNode->msg.iWindow); break; - case WM_WM_HINTS_EVENT: - winUpdateIcon(pNode->msg.iWindow); + case WM_WM_ICON_EVENT: + UpdateIcon(pWMInfo, pNode->msg.iWindow); break; case WM_WM_CHANGE_STATE: @@ -748,6 +809,7 @@ winMultiWindowXMsgProc(void *pArg) Atom atmWmName; Atom atmWmHints; Atom atmWmChange; + Atom atmNetWmIcon; int iReturn; XIconSize *xis; @@ -873,6 +935,7 @@ winMultiWindowXMsgProc(void *pArg) atmWmName = XInternAtom(pProcArg->pDisplay, "WM_NAME", False); atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False); atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False); + atmNetWmIcon = XInternAtom(pProcArg->pDisplay, "_NET_WM_ICON", False); /* iiimxcf had a bug until 2009-04-27, assuming that the @@ -1003,25 +1066,25 @@ winMultiWindowXMsgProc(void *pArg) True, StructureNotifyMask, &event_send); } } - else if (event.type == PropertyNotify - && event.xproperty.atom == atmWmName) { - memset(&msg, 0, sizeof(msg)); + else if (event.type == PropertyNotify) { + if (event.xproperty.atom == atmWmName) { + memset(&msg, 0, sizeof(msg)); - msg.msg = WM_WM_NAME_EVENT; - msg.iWindow = event.xproperty.window; + msg.msg = WM_WM_NAME_EVENT; + msg.iWindow = event.xproperty.window; - /* Other fields ignored */ - winSendMessageToWM(pProcArg->pWMInfo, &msg); - } - else if (event.type == PropertyNotify - && event.xproperty.atom == atmWmHints) { - memset(&msg, 0, sizeof(msg)); - - msg.msg = WM_WM_HINTS_EVENT; - msg.iWindow = event.xproperty.window; - - /* Other fields ignored */ - winSendMessageToWM(pProcArg->pWMInfo, &msg); + /* Other fields ignored */ + winSendMessageToWM(pProcArg->pWMInfo, &msg); + } + else if ((event.xproperty.atom == atmWmHints) || + (event.xproperty.atom == atmNetWmIcon)) { + memset(&msg, 0, sizeof(msg)); + msg.msg = WM_WM_ICON_EVENT; + msg.iWindow = event.xproperty.window; + + /* Other fields ignored */ + winSendMessageToWM(pProcArg->pWMInfo, &msg); + } } else if (event.type == ClientMessage && event.xclient.message_type == atmWmChange diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c index 8f403cec3..c66e11396 100644 --- a/xorg-server/hw/xwin/winprefs.c +++ b/xorg-server/hw/xwin/winprefs.c @@ -150,7 +150,6 @@ static wBOOL CALLBACK ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam) { HICON hicon; - Window wid; if (!hwnd) { ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n"); @@ -175,10 +174,23 @@ ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam) /* This window is now clean of our taint (but with undefined icons) */ } else { - /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */ - wid = (Window) GetProp(hwnd, WIN_WID_PROP); - if (wid) - winUpdateIcon(wid); + /* Send a message to WM thread telling it re-evaluate the icon for this window */ + { + winWMMessageRec wmMsg; + + WindowPtr pWin = GetProp(hwnd, WIN_WINDOW_PROP); + + if (pWin) { + winPrivWinPtr pWinPriv = winGetWindowPriv(pWin); + winPrivScreenPtr s_pScreenPriv = pWinPriv->pScreenPriv; + + wmMsg.msg = WM_WM_ICON_EVENT; + wmMsg.hwndWindow = hwnd; + wmMsg.iWindow = (Window) GetProp(hwnd, WIN_WID_PROP); + + winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); + } + } /* Update the system menu for this window */ SetupSysMenu((unsigned long) hwnd); @@ -579,31 +591,15 @@ LoadImageComma(char *fname, int sx, int sy, int flags) * ICONS{} section in the prefs file, and load the icon from a file */ HICON -winOverrideIcon(unsigned long longWin) +winOverrideIcon(char *res_name, char *res_class, char *wmName) { - WindowPtr pWin = (WindowPtr) longWin; - char *res_name, *res_class; int i; HICON hicon; - char *wmName; - - if (pWin == NULL) - return 0; - - /* If we can't find the class, we can't override from default! */ - if (!winMultiWindowGetClassHint(pWin, &res_name, &res_class)) - return 0; - - winMultiWindowGetWMName(pWin, &wmName); for (i = 0; i < pref.iconItems; i++) { - if (!strcmp(pref.icon[i].match, res_name) || - !strcmp(pref.icon[i].match, res_class) || + if ((res_name && !strcmp(pref.icon[i].match, res_name)) || + (res_class && !strcmp(pref.icon[i].match, res_class)) || (wmName && strstr(wmName, pref.icon[i].match))) { - free(res_name); - free(res_class); - free(wmName); - if (pref.icon[i].hicon) return pref.icon[i].hicon; @@ -618,10 +614,6 @@ winOverrideIcon(unsigned long longWin) } /* Didn't find the icon, fail gracefully */ - free(res_name); - free(res_class); - free(wmName); - return 0; } diff --git a/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h index fcce8d840..5de5719e1 100644 --- a/xorg-server/hw/xwin/winprefs.h +++ b/xorg-server/hw/xwin/winprefs.h @@ -164,7 +164,7 @@ Bool int winIconIsOverride(unsigned hiconIn); -HICON winOverrideIcon(unsigned long longpWin); +HICON winOverrideIcon(char *res_name, char *res_class, char *wmName); unsigned long winOverrideStyle(char *res_name, char *res_class, char *wmName); diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c index 9ec1cbdf3..a3afec186 100644 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -228,7 +228,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, // Store the implementation private frame ID pFrame->wid = (RootlessFrameID) pRLWinPriv; - winSelectIcons(pFrame->win, &hIcon, &hIconSmall); + winSelectIcons(&hIcon, &hIconSmall); /* Set standard class name prefix so we can identify window easily */ strncpy(pszClass, WINDOW_CLASS_X, sizeof(pszClass)); diff --git a/xorg-server/hw/xwin/winwin32rootlesswindow.c b/xorg-server/hw/xwin/winwin32rootlesswindow.c index 19478ad60..e76da2dd9 100644 --- a/xorg-server/hw/xwin/winwin32rootlesswindow.c +++ b/xorg-server/hw/xwin/winwin32rootlesswindow.c @@ -147,39 +147,8 @@ winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h) } /* - * winMWExtWMUpdateIcon - * Change the Windows window icon - */ - -void -winMWExtWMUpdateIcon(Window id) -{ - WindowPtr pWin; - HICON hIcon, hiconOld; - - dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, - DixUnknownAccess); - hIcon = winOverrideIcon((unsigned long) pWin); - - if (!hIcon) - hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON)); - if (hIcon) { - win32RootlessWindowPtr pRLWinPriv - = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); - if (pRLWinPriv->hWnd) { - - hiconOld = (HICON) SendMessage(pRLWinPriv->hWnd, - WM_SETICON, ICON_BIG, - (LPARAM) hIcon); - winDestroyIcon(hiconOld); - } - hIcon = NULL; - } -} - -/* * winMWExtWMDecorateWindow - Update window style. Called by EnumWindows. */ diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index ce8157d8a..ffb744e66 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -69,7 +69,7 @@ typedef struct { DWORD dwDummy; HRGN hRgn; HWND hWnd; - BOOL OpenGlWindow; + BOOL OpenGlWindow; winPrivScreenPtr pScreenPriv; Bool fXKilled; HDWP hDwp; @@ -110,7 +110,7 @@ typedef struct _winWMMessageRec { #define WM_WM_KILL (WM_USER + 7) #define WM_WM_ACTIVATE (WM_USER + 8) #define WM_WM_NAME_EVENT (WM_USER + 9) -#define WM_WM_HINTS_EVENT (WM_USER + 10) +#define WM_WM_ICON_EVENT (WM_USER + 10) #define WM_WM_CHANGE_STATE (WM_USER + 11) #define WM_WM_MAP2 (WM_USER + 12) #define WM_WM_MAP3 (WM_USER + 13) @@ -166,14 +166,5 @@ winSetAppID (HWND hWnd, const char* AppID); * winmultiwindowicons.c */ -void - winUpdateIcon(Window id); - -void - winInitGlobalIcons(void); - -void - winDestroyIcon(HICON hIcon); - #endif /* XWIN_MULTIWINDOW */ #endif diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index e15fdc676..0389c7e22 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -423,8 +423,6 @@ ProcWindowsWMFrameDraw(ClientPtr client) ShowWindow(pRLWinPriv->hWnd, nCmdShow); - winMWExtWMUpdateIcon(pWin->drawable.id); - if (wBoundingShape(pWin) != NULL) { /* wBoundingShape is relative to *inner* origin of window. Translate by borderWidth to get the outside-relative position. */ |