# HG changeset patch # User ib # Date 1319114915 0 # Node ID 568f3a8e1b891c4cc2a842c9f278b2c1d99c25a2 # Parent 085b62ad0cf91dfdd7cce8ef6badbf0b212b15e7 Support transparency in decorated windows in the Win32 GUI. So far, the Win32 GUI only supports transparency in non-decorated windows. Now there is equal support of skin transparency for both GUIs, because skins are universal for both of them. diff -r 085b62ad0cf9 -r 568f3a8e1b89 gui/win32/gui.c --- a/gui/win32/gui.c Thu Oct 20 12:24:00 2011 +0000 +++ b/gui/win32/gui.c Thu Oct 20 12:48:35 2011 +0000 @@ -1240,16 +1240,23 @@ static void maketransparent(HWND hwnd, COLORREF crTransparent) { HDC mdc = GetDC(hwnd); - RECT rd; + RECT wrd, crd; HRGN crRgnres, crRgn, crRgnTmp; int iX = 0, iY = 0, iLeftX = 0; + int border, title; int width, height; - GetWindowRect(hwnd, &rd); - width = rd.right - rd.left; - height = rd.bottom - rd.top; + + GetWindowRect(hwnd, &wrd); + GetClientRect(hwnd, &crd); - /* create an empty region */ - crRgn = CreateRectRgn(0, 0, 0, 0); + border = (wrd.right - wrd.left - crd.right) / 2; + title = (wrd.bottom - wrd.top - crd.bottom) - border; + + width = crd.right - crd.left; + height = crd.bottom - crd.top; + + /* create the title bar region */ + crRgn = CreateRectRgn(0, 0, width + border + border, title); /* Create a region from a bitmap with transparency colour of Purple */ for (iY = -1; iY < height; iY++) @@ -1262,11 +1269,11 @@ /* remember this pixel */ iLeftX = iX; - /* now find first non transparent pixel */ + /* now find last non transparent pixel */ while (iX <= width && GetPixel(mdc,iX, iY) != crTransparent) ++iX; /* create a temp region on this info */ - crRgnTmp = CreateRectRgn(iLeftX, iY, iX, iY+1); + crRgnTmp = CreateRectRgn(iLeftX + border, iY + title, iX + border, iY + title + 1); /* combine into main region */ crRgnres = crRgn; @@ -1278,6 +1285,22 @@ } while (iX < width); iX = 0; } + + /* left border region */ + crRgnTmp = CreateRectRgn(0, title, border, title + height); + CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR); + DeleteObject(crRgnTmp); + + /* right border region */ + crRgnTmp = CreateRectRgn(width + border, title, width + border + border, title + height); + CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR); + DeleteObject(crRgnTmp); + + /* bottom region */ + crRgnTmp = CreateRectRgn(0, title + height, width + border + border, title + height + border); + CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR); + DeleteObject(crRgnTmp); + SetWindowRgn(hwnd, crRgn, TRUE); DeleteObject(crRgn); ReleaseDC(hwnd,mdc);