Index: windialogs.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/windialogs.c,v retrieving revision 1.7 diff -r1.7 windialogs.c 56a57,60 > #if defined(XWIN_MULTIWINDOW) > extern HICON g_hIconX; > extern HICON g_hSmallIconX; > #endif 183a188 > * and set small and large icons to X icons. 187c192 < winCenterDialog (HWND hwndDlg) --- > winInitDialog (HWND hwndDlg) 190c195,196 < RECT rc, rcDlg, rcDesk; --- > RECT rc, rcDlg, rcDesk; > HICON hIcon, hIconSmall; 196,202c202,226 < GetWindowRect (hwndDesk, &rcDesk); < GetWindowRect (hwndDlg, &rcDlg); < CopyRect (&rc, &rcDesk); < < OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); < OffsetRect (&rc, -rc.left, -rc.top); < OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); --- > /* Remove minimize and maximize buttons */ > SetWindowLong (hwndDlg, GWL_STYLE, > GetWindowLong (hwndDlg, GWL_STYLE) > & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); > > /* Set Window not to show in the task bar */ > SetWindowLong (hwndDlg, GWL_EXSTYLE, > GetWindowLong (hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); > > /* Center dialog window in the screen. Not done for multi-monitor systems, where > * it is likely to end up split across the screens. In that case, it appears > * near the Tray icon. > */ > if (GetSystemMetrics(SM_CMONITORS)>1) { > /* Still need to refresh the frame change. */ > SetWindowPos (hwndDlg, HWND_TOP, 0,0,0,0, > SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); > } else { > GetWindowRect (hwndDesk, &rcDesk); > GetWindowRect (hwndDlg, &rcDlg); > CopyRect (&rc, &rcDesk); > > OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); > OffsetRect (&rc, -rc.left, -rc.top); > OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); 204c228 < SetWindowPos (hwndDlg, --- > SetWindowPos (hwndDlg, 209c233,253 < SWP_NOSIZE | SWP_NOZORDER); --- > SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); > } > > #ifdef XWIN_MULTIWINDOW > if (g_hIconX) hIcon=g_hIconX; > else > #endif > hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); > > #ifdef XWIN_MULTIWINDOW > if (g_hSmallIconX) hIconSmall=g_hSmallIconX; > else > #endif > hIconSmall = LoadImage (g_hInstance, > MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, > GetSystemMetrics(SM_CXSMICON), > GetSystemMetrics(SM_CYSMICON), > LR_SHARED); > > PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); > PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); 223c267 < /* Count up running clinets (clients[0] is serverClient) */ --- > /* Count up running clients (clients[0] is serverClient) */ 274,282d317 < /* Drop minimize and maximize buttons */ < SetWindowLong (g_hDlgExit, GWL_STYLE, < GetWindowLong (g_hDlgExit, GWL_STYLE) < & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); < SetWindowLong (g_hDlgExit, GWL_EXSTYLE, < GetWindowLong (g_hDlgExit, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); < SetWindowPos (g_hDlgExit, HWND_TOPMOST, 0, 0, 0, 0, < SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE); < 317,324c352 < winCenterDialog (hDialog); < < /* Set icon to standard app icon */ < PostMessage (hDialog, < WM_SETICON, < ICON_SMALL, < (LPARAM) LoadIcon (g_hInstance, < MAKEINTRESOURCE(IDI_XWIN))); --- > winInitDialog (hDialog); 416,426d443 < < /* Drop minimize and maximize buttons */ < SetWindowLong (g_hDlgDepthChange, GWL_STYLE, < GetWindowLong (g_hDlgDepthChange, GWL_STYLE) < & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); < SetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE, < GetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE) < & ~WS_EX_APPWINDOW ); < SetWindowPos (g_hDlgDepthChange, 0, 0, 0, 0, 0, < SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE); < 483,489c500 < winCenterDialog( hwndDialog ); < < /* Set icon to standard app icon */ < PostMessage (hwndDialog, < WM_SETICON, < ICON_SMALL, < (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN))); --- > winInitDialog( hwndDialog ); 575,583d585 < /* Drop minimize and maximize buttons */ < SetWindowLong (g_hDlgAbout, GWL_STYLE, < GetWindowLong (g_hDlgAbout, GWL_STYLE) < & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); < SetWindowLong (g_hDlgAbout, GWL_EXSTYLE, < GetWindowLong (g_hDlgAbout, GWL_EXSTYLE) & ~WS_EX_APPWINDOW); < SetWindowPos (g_hDlgAbout, 0, 0, 0, 0, 0, < SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE); < 625,631c627 < winCenterDialog (hwndDialog); < < /* Set icon to standard app icon */ < PostMessage (hwndDialog, < WM_SETICON, < ICON_SMALL, < (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN))); --- > winInitDialog (hwndDialog); Index: winmultiwindowicons.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowicons.c,v retrieving revision 1.5 diff -r1.5 winmultiwindowicons.c 39a40,42 > #include "propertyst.h" > #include "windowstr.h" > 87,88c90,91 < /* Need 32-bit aligned rows */ < stride = ((iconSize * effBPP + 31) & (~31)) / 8; --- > /* Need 16-bit aligned rows for DDBitmaps */ > stride = ((iconSize * effBPP + 15) & (~15)) / 8; 263a267,332 > HICON NetWMToWinIcon(uint32_t *icon){ > int height, width; > uint32_t *pixels; > HICON result; > HDC hdcMem; > uint32_t *DIB_pixels; > ICONINFO ii={TRUE}; > BITMAPV4HEADER bmh={sizeof(bmh)}; > int row; > > width=icon[0]; > height=icon[1]; > pixels=&icon[2]; > > /* Define an ARGB pixel format used for Color+Alpha icons */ > bmh.bV4Width = width; > bmh.bV4Height = height; > bmh.bV4Planes=1; > bmh.bV4BitCount=32; > bmh.bV4V4Compression=BI_BITFIELDS; > bmh.bV4AlphaMask = 0xFF000000; > bmh.bV4RedMask = 0x00FF0000; > bmh.bV4GreenMask = 0x0000FF00; > bmh.bV4BlueMask = 0x000000FF; > > hdcMem=CreateCompatibleDC(NULL); > ii.hbmColor=CreateDIBSection(hdcMem,(BITMAPINFO*)&bmh, > DIB_RGB_COLORS,(void**)(&DIB_pixels),NULL,0); > ii.hbmMask=CreateBitmap(width,height,1,1,NULL); > /* Rows are in reverse order */ > for (row=0;row memcpy(&DIB_pixels[row*width],&pixels[(height-row-1)*width],width*4); > } > > result=CreateIconIndirect(&ii); > > DeleteDC(hdcMem); > DeleteObject(ii.hbmColor); > DeleteObject(ii.hbmMask); > > ErrorF ("NetIcon To WinBitmap: %d x %d = %p\n",icon[0],icon[1],result); > return result; > } > > 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; > } 280c349,371 < HICON hIcon; --- > HICON hIcon=NULL; > > /* Try to get _NET_WM_ICON icons first */ > static Atom _XA_NET_WM_ICON=0; > uint32_t *icon, *icon_data; > long int size; > > if (!_XA_NET_WM_ICON) _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON",12,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; > icon=&icon[icon[0]*icon[1]+2]) { > ErrorF("Window %x: found %d x %d NetIcon\n",pWin,icon[0],icon[1]); > if (icon[0]==iconSize && icon[1]==iconSize) { > return NetWMToWinIcon(icon); > } > } > } > } > ErrorF("Window %x: no %d x %d NetIcon\n",pWin,iconSize,iconSize); 300,301c391,392 < /* Need 32-bit aligned rows */ < stride = ((iconSize * effBPP + 31) & (~31)) / 8; --- > /* Need 16-bit aligned rows for DDBitmaps */ > stride = ((iconSize * effBPP + 15) & (~15)) / 8; 304c395 < maskStride = ((iconSize * 1 + 31) & (~31)) / 8; --- > maskStride = ((iconSize + 15) & (~15)) / 8; 370c461 < HICON hIcon, hiconOld; --- > HICON hIcon, hIconSmall=NULL, hIconOld; 373,390c464,475 < hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); < < if (!hIcon) < hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON)); < < if (hIcon) < { < winWindowPriv(pWin); < < if (pWinPriv->hWnd) < { < hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, < GCL_HICON, < (int) hIcon); < < /* Delete the icon if its not the default */ < winDestroyIcon(hiconOld); < } --- > winWindowPriv(pWin); > if (pWinPriv->hWnd) { > hIcon = (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)); > } 392,396d476 < < hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON)); < if (hIcon) < { < winWindowPriv(pWin); 398,405c478,490 < if (pWinPriv->hWnd) < { < hiconOld = (HICON) SetClassLong (pWinPriv->hWnd, < GCL_HICONSM, < (int) hIcon); < winDestroyIcon (hiconOld); < } < } --- > /* Set the large icon */ > hIconOld = (HICON) SendMessage (pWinPriv->hWnd, > WM_SETICON, ICON_BIG, (LPARAM) hIcon); > > /* Delete the icon if its not the default */ > winDestroyIcon(hIconOld); > > /* Same for the small icon */ > hIconOld = (HICON) SendMessage (pWinPriv->hWnd, > WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); > winDestroyIcon(hIconOld); > > } Index: winmultiwindowwindow.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c,v retrieving revision 1.14 diff -r1.14 winmultiwindowwindow.c 46c46,48 < extern HWND g_hDlgDepthChange; --- > extern HICON g_hIconX; > extern HICON g_hSmallIconX; > extern HWND g_hDlgDepthChange; 84a87,115 > ATOM winInitMultiWindowClass(BOOL Reset){ > static ATOM atomXWinClass=0; > WNDCLASSEX wcx; > > if (atomXWinClass==0 || Reset) { > > /* Setup our window class */ > wcx.cbSize=sizeof(WNDCLASSEX); > wcx.style = CS_HREDRAW | CS_VREDRAW; > wcx.lpfnWndProc = winTopLevelWindowProc; > wcx.cbClsExtra = 0; > wcx.cbWndExtra = 0; > wcx.hInstance = g_hInstance; > wcx.hIcon = g_hIconX; > wcx.hCursor = 0; > wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); > wcx.lpszMenuName = NULL; > wcx.lpszClassName = WINDOW_CLASS_X; > wcx.hIconSm = g_hSmallIconX; > > #if CYGMULTIWINDOW_DEBUG > ErrorF ("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X); > #endif > > atomXWinClass = RegisterClassEx (&wcx); > } > return atomXWinClass; > } > 490d520 < WNDCLASSEX wc; 500a531 > winInitMultiWindowClass(FALSE); 522,573d552 < winSelectIcons(pWin, &hIcon, &hIconSmall); < < /* Set standard class name prefix so we can identify window easily */ < strncpy (pszClass, WINDOW_CLASS_X, sizeof(pszClass)); < < if (winMultiWindowGetClassHint (pWin, &res_name, &res_class)) < { < strncat (pszClass, "-", 1); < strncat (pszClass, res_name, CLASS_NAME_LENGTH - strlen (pszClass)); < strncat (pszClass, "-", 1); < strncat (pszClass, res_class, CLASS_NAME_LENGTH - strlen (pszClass)); < < /* Check if a window class is provided by the WM_WINDOW_ROLE property, < * if not use the WM_CLASS information. < * For further information see: < * http://tronche.com/gui/x/icccm/sec-5.html < */ < if (winMultiWindowGetWindowRole (pWin, &res_role) ) < { < strcat (pszClass, "-"); < strcat (pszClass, res_role); < free (res_role); < } < < free (res_name); < free (res_class); < } < < /* Add incrementing window ID to make unique class name */ < snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++); < pszWindowID[sizeof(pszWindowID)-1] = 0; < strcat (pszClass, pszWindowID); < < #if CYGMULTIWINDOW_DEBUG < ErrorF ("winCreateWindowsWindow - Creating class: %s\n", pszClass); < #endif < < /* Setup our window class */ < wc.cbSize = sizeof(wc); < wc.style = CS_HREDRAW | CS_VREDRAW; < wc.lpfnWndProc = winTopLevelWindowProc; < wc.cbClsExtra = 0; < wc.cbWndExtra = 0; < wc.hInstance = g_hInstance; < wc.hIcon = hIcon; < wc.hIconSm = hIconSmall; < wc.hCursor = 0; < wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); < wc.lpszMenuName = NULL; < wc.lpszClassName = pszClass; < RegisterClassEx (&wc); < 578c557 < pszClass, /* Class name */ --- > WINDOW_CLASS_X, /* Class name */ 593a573,578 > 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); 602,603d586 < pWinPriv->hWnd = hWnd; < 604a588 > #if 0 605a590,592 > #else > SetupSysMenu ((unsigned long)hWnd); > #endif 607c594 < SetProp (pWinPriv->hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin)); --- > SetProp (hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin)); 610c597 < SetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0); --- > SetProp (hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0); 643a631 > #if 0 648a637 > #endif 665a655 > #if 0 680a671 > #endif Index: winprefs.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefs.c,v retrieving revision 1.6 diff -r1.6 winprefs.c 191c191,192 < hicon = (HICON)GetClassLong(hwnd, GCL_HICON); --- > /* Reset the window's icon to undefined. */ > hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0); 193,196c194 < /* Unselect any icon in the class structure */ < SetClassLong (hwnd, GCL_HICON, (LONG)LoadIcon (NULL, IDI_APPLICATION)); < < /* If it's generated on-the-fly, get rid of it, will regen */ --- > /* If the old icon is generated on-the-fly, get rid of it, will regen */ 198,202d195 < < hicon = (HICON)GetClassLong(hwnd, GCL_HICONSM); < < /* Unselect any icon in the class structure */ < SetClassLong (hwnd, GCL_HICONSM, 0); 204c197,198 < /* If it's generated on-the-fly, get rid of it, will regen */ --- > /* Same for the small icon */ > hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0); 206,207c200,201 < < /* Remove any menu additions, use bRevert flag */ --- > > /* Remove any menu additions; bRevert=TRUE destroys any modified menus */ 210c204 < /* This window is now clean of our taint */ --- > /* This window is now clean of our taint (but with undefined icons) */ 214,216c208 < /* Make the icon default, dynamic, or from xwinrc */ < SetClassLong (hwnd, GCL_HICON, (LONG)g_hIconX); < SetClassLong (hwnd, GCL_HICONSM, (LONG)g_hSmallIconX); --- > /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */ 219a212 > 243,244c236,241 < /* First, iterate over all windows replacing their icon with system */ < /* default one and deleting any custom system menus */ --- > /* First, iterate over all windows, deleting their icons and custom menus. > * This is really only needed because winDestroyIcon() will try to > * destroy the old global icons, which will have changed. > * It is probably better to set a windows USER_DATA to flag locally defined > * icons, and use that to accurately know when to destroy old icons. > */ Index: winwin32rootlesswindow.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwin32rootlesswindow.c,v retrieving revision 1.6 diff -r1.6 winwin32rootlesswindow.c 180,183c180,182 < hiconOld = (HICON) SetClassLong (pRLWinPriv->hWnd, < GCL_HICON, < (int) hIcon); < --- > > hiconOld = (HICON) SendMessage (pRLWinPriv->hWnd, > WM_SETICON, ICON_BIG, (LPARAM) hIcon); 185a185 > hIcon=NULL; Index: winwindow.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwindow.h,v retrieving revision 1.7 diff -r1.7 winwindow.h 140a141,143 > ATOM > winInitMultiWindowClass(BOOL Reset); >