diff options
Diffstat (limited to 'xorg-server/hw/xwin/winwin32rootless.c')
-rwxr-xr-x[-rw-r--r--] | xorg-server/hw/xwin/winwin32rootless.c | 217 |
1 files changed, 14 insertions, 203 deletions
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c index 974309248..55039bccd 100644..100755 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -83,8 +83,7 @@ winMWExtWMQueryDIBFormat(win32RootlessWindowPtr pRLWinPriv, BITMAPINFOHEADER * pbmih) { HBITMAP hbmp; - -#if CYGMULTIWINDOW_DEBUG +#ifdef _DEBUG LPDWORD pdw = NULL; #endif @@ -107,7 +106,7 @@ winMWExtWMQueryDIBFormat(win32RootlessWindowPtr pRLWinPriv, return FALSE; } -#if CYGMULTIWINDOW_DEBUG +#ifdef _DEBUG /* Get a pointer to bitfields */ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER)); @@ -209,10 +208,8 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, char *res_name, *res_class, *res_role; static int s_iWindowID = 0; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame %d %d - %d %d\n", newX, newY, pFrame->width, pFrame->height); -#endif pRLWinPriv = (win32RootlessWindowPtr) malloc(sizeof(win32RootlessWindowRec)); @@ -262,9 +259,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, pszWindowID[sizeof(pszWindowID) - 1] = 0; strcat(pszClass, pszWindowID); -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - Creating class: %s\n", pszClass); -#endif /* Setup our window class */ wc.cbSize = sizeof(wc); @@ -300,9 +295,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, fResult = FALSE; } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - ShowWindow\n"); -#endif //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE); g_fNoConfigureWindow = FALSE; @@ -311,28 +304,8 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, winMWExtWMReshapeFrame(pFrame->wid, pShape); } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - (%08x) %08x\n", (int) pFrame->wid, (int) pRLWinPriv->hWnd); -#if 0 - { - WindowPtr pWin2 = NULL; - win32RootlessWindowPtr pRLWinPriv2 = NULL; - - /* Check if the Windows window property for our X window pointer is valid */ - if ((pWin2 = - (WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) { - pRLWinPriv2 = - (win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE); - } - winDebug("winMWExtWMCreateFrame2 (%08x) %08x\n", - pRLWinPriv2, pRLWinPriv2->hWnd); - if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) { - winDebug("Error param missmatch\n"); - } - } -#endif -#endif winMWExtWMSetNativeProperty(pFrame); @@ -349,29 +322,8 @@ winMWExtWMDestroyFrame(RootlessFrameID wid) int iReturn; char pszClass[CLASS_NAME_LENGTH]; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFrame (%08x) %08x\n", (int) pRLWinPriv, (int) pRLWinPriv->hWnd); -#if 0 - { - WindowPtr pWin2 = NULL; - win32RootlessWindowPtr pRLWinPriv2 = NULL; - - /* Check if the Windows window property for our X window pointer is valid */ - if ((pWin2 = - (WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) { - pRLWinPriv2 = - (win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE); - } - winDebug("winMWExtWMDestroyFrame2 (%08x) %08x\n", - pRLWinPriv2, pRLWinPriv2->hWnd); - if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) { - winDebug("Error param missmatch\n"); - *(int *) 0 = 1; //raise exseption - } - } -#endif -#endif /* Store the info we need to destroy after this window is gone */ hInstance = (HINSTANCE) GetClassLongPtr(pRLWinPriv->hWnd, GCLP_HMODULE); @@ -387,22 +339,16 @@ winMWExtWMDestroyFrame(RootlessFrameID wid) /* Only if we were able to get the name */ if (iReturn) { -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass); -#endif iReturn = UnregisterClass(pszClass, hInstance); + + winDebug ("winMWExtWMDestroyFramew - Deleting Icon\n"); } -#if CYGMULTIWINDOW_DEBUG - winDebug("winMWExtWMDestroyFramew - Deleting Icon\n"); -#endif - - winDestroyIcon(hIcon); - winDestroyIcon(hIconSm); + winDestroyIcon(hiconClass); + winDestroyIcon(hiconSmClass); -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFrame - done\n"); -#endif } void @@ -415,10 +361,8 @@ winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX, DWORD dwStyle; int iX, iY, iWidth, iHeight; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMMoveFrame (%08x) (%d %d)\n", (int) pRLWinPriv, iNewX, iNewY); -#endif /* Get the Windows window style and extended style */ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE); @@ -435,29 +379,23 @@ winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX, /* Store the origin, height, and width in a rectangle structure */ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight); -#ifdef CYGMULTIWINDOW_DEBUG winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top); -#endif /* * Calculate the required size of the Windows window rectangle, * given the size of the Windows window client area. */ AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle); -#ifdef CYGMULTIWINDOW_DEBUG winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n", rcNew.left, rcNew.top, rcNew.right, rcNew.bottom, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top); -#endif g_fNoConfigureWindow = TRUE; SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); g_fNoConfigureWindow = FALSE; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv); -#endif } void @@ -473,10 +411,8 @@ winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, DWORD dwStyle; int iX, iY; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n", (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight); -#endif pRLWinPriv->fResized = TRUE; @@ -525,9 +461,8 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) Bool fFirst = TRUE; Bool fNeedRestack = TRUE; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv); -#endif + if (pScreenPriv && pScreenPriv->fRestacking) return; @@ -542,18 +477,16 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) ShowWindow(pRLWinPriv->hWnd, SW_SHOWNOACTIVATE); if (pRLNextWinPriv == NULL) { -#if CYGMULTIWINDOW_DEBUG winDebug("Win %08x is top\n", pRLWinPriv); -#endif pScreenPriv->widTop = wid; SetWindowPos(pRLWinPriv->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } - else if (winIsInternalWMRunning(pScreenInfo)) { - /* using mulwinidow wm */ -#if CYGMULTIWINDOW_DEBUG +#ifdef XWIN_MULTIWINDOWINTWM + else if (winIsInternalWMRunning(pScreenInfo)) { + /* using mulwinidow wm */ winDebug("Win %08x is not top\n", pRLWinPriv); -#endif + for (hWnd = GetNextWindow(pRLWinPriv->hWnd, GW_HWNDPREV); fNeedRestack && hWnd != NULL; hWnd = GetNextWindow(hWnd, GW_HWNDPREV)) { @@ -564,18 +497,14 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) if (hWnd == pRLNextWinPriv->hWnd) { /* Enable interleave X window and Windows window */ if (!fFirst) { -#if CYGMULTIWINDOW_DEBUG winDebug("raise: Insert after Win %08x\n", pRLNextWinPriv); -#endif SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } else { -#if CYGMULTIWINDOW_DEBUG winDebug("No change\n"); -#endif } fNeedRestack = FALSE; break; @@ -593,9 +522,8 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) if ((dwWindowProcessID == dwCurrentProcessID) && GetProp(hWnd, WIN_WINDOW_PROP)) { if (hWnd == pRLNextWinPriv->hWnd) { -#if CYGMULTIWINDOW_DEBUG winDebug("lower: Insert after Win %08x\n", pRLNextWinPriv); -#endif + SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -605,15 +533,14 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) } } } +#endif else { /* using general wm like twm, wmaker etc. Interleave X window and Windows window will cause problem. */ SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv); -#endif pRLWinPriv->fRestackingNow = FALSE; } @@ -625,9 +552,7 @@ winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape) HRGN hRgn, hRgnWindow, hRgnClient; RECT rcWindow, rcClient; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv); -#endif hRgn = winMWExtWMCreateRgnFromRegion(pShape); @@ -654,9 +579,7 @@ winMWExtWMUnmapFrame(RootlessFrameID wid) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv); -#endif g_fNoConfigureWindow = TRUE; //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE); @@ -679,10 +602,8 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) HDC hdcNew; HBITMAP hbmpNew; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv, pRLWinPriv->fDestroyed); -#endif if (!pRLWinPriv->fDestroyed) { pScreen = pRLWinPriv->pFrame->win->drawable.pScreen; @@ -691,12 +612,11 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo; -#if CYGMULTIWINDOW_DEBUG winDebug("\tpScreenPriv %08X\n", (int) pScreenPriv); winDebug("\tpScreenInfo %08X\n", (int) pScreenInfo); winDebug("\t(%d, %d)\n", (int) pRLWinPriv->pFrame->width, (int) pRLWinPriv->pFrame->height); -#endif + if (pRLWinPriv->hdcScreen == NULL) { InitWin32RootlessEngine(pRLWinPriv); } @@ -731,15 +651,12 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) //return FALSE; } else { -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - Shadow buffer allocated\n"); -#endif } /* Get information about the bitmap that was allocated */ GetObject(hbmpNew, sizeof(dibsection), &dibsection); -#if CYGMULTIWINDOW_DEBUG /* Print information about bitmap allocated */ winDebug("winMWExtWMStartDrawing - Dibsection width: %d height: %d " "depth: %d size image: %d\n", @@ -747,14 +664,11 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) (unsigned int) dibsection.dsBmih.biHeight, (unsigned int) dibsection.dsBmih.biBitCount, (unsigned int) dibsection.dsBmih.biSizeImage); -#endif /* Select the shadow bitmap into the shadow DC */ SelectObject(hdcNew, hbmpNew); -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - Attempting a shadow blit\n"); -#endif /* Blit from the old shadow to the new shadow */ fReturn = BitBlt(hdcNew, @@ -763,9 +677,7 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) pRLWinPriv->pFrame->height, pRLWinPriv->hdcShadow, 0, 0, SRCCOPY); if (fReturn) { -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - Shadow blit success\n"); -#endif } else { ErrorF("winMWExtWMStartDrawing - Shadow blit failure\n"); @@ -784,10 +696,8 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) pRLWinPriv->dwWidthBytes = dibsection.dsBm.bmWidthBytes; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - bytesPerRow: %d\n", (unsigned int) dibsection.dsBm.bmWidthBytes); -#endif /* Free the old shadow bitmap */ DeleteObject(pRLWinPriv->hdcShadow); @@ -797,22 +707,18 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) pRLWinPriv->hbmpShadow = hbmpNew; pRLWinPriv->fResized = FALSE; -#if CYGMULTIWINDOW_DEBUG && FALSE winDebug("winMWExtWMStartDrawing - 0x%08x %d\n", (unsigned int) pRLWinPriv->pfb, (unsigned int) dibsection.dsBm.bmWidthBytes); -#endif } } else { ErrorF("winMWExtWMStartDrawing - Already window was destroyed \n"); } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n", (int) pRLWinPriv, (unsigned int) pRLWinPriv->pfb, (unsigned int) pRLWinPriv->dwWidthBytes); -#endif *pixelData = pRLWinPriv->pfb; *bytesPerRow = pRLWinPriv->dwWidthBytes; } @@ -820,31 +726,6 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) void winMWExtWMStopDrawing(RootlessFrameID wid, Bool fFlush) { -#if 0 - win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; - BLENDFUNCTION bfBlend; - SIZE szWin; - POINT ptSrc; - -#if CYGMULTIWINDOW_DEBUG || TRUE - winDebug("winMWExtWMStopDrawing (%08x)\n", pRLWinPriv); -#endif - szWin.cx = pRLWinPriv->dwWidth; - szWin.cy = pRLWinPriv->dwHeight; - ptSrc.x = 0; - ptSrc.y = 0; - bfBlend.BlendOp = AC_SRC_OVER; - bfBlend.BlendFlags = 0; - bfBlend.SourceConstantAlpha = 255; - bfBlend.AlphaFormat = AC_SRC_ALPHA; - - if (!UpdateLayeredWindow(pRLWinPriv->hWnd, - NULL, NULL, &szWin, - pRLWinPriv->hdcShadow, &ptSrc, - 0, &bfBlend, ULW_ALPHA)) { - ErrorF("winMWExtWMStopDrawing - UpdateLayeredWindow failed\n"); - } -#endif } void @@ -852,44 +733,6 @@ winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; -#if 0 - BLENDFUNCTION bfBlend; - SIZE szWin; - POINT ptSrc; -#endif -#if CYGMULTIWINDOW_DEBUG && 0 - winDebug("winMWExtWMUpdateRegion (%08x)\n", pRLWinPriv); -#endif -#if 0 - szWin.cx = pRLWinPriv->dwWidth; - szWin.cy = pRLWinPriv->dwHeight; - ptSrc.x = 0; - ptSrc.y = 0; - bfBlend.BlendOp = AC_SRC_OVER; - bfBlend.BlendFlags = 0; - bfBlend.SourceConstantAlpha = 255; - bfBlend.AlphaFormat = AC_SRC_ALPHA; - - if (!UpdateLayeredWindow(pRLWinPriv->hWnd, - NULL, NULL, &szWin, - pRLWinPriv->hdcShadow, &ptSrc, - 0, &bfBlend, ULW_ALPHA)) { - LPVOID lpMsgBuf; - - /* Display a fancy error message */ - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) & lpMsgBuf, 0, NULL); - - ErrorF("winMWExtWMUpdateRegion - UpdateLayeredWindow failed: %s\n", - (LPSTR) lpMsgBuf); - LocalFree(lpMsgBuf); - } -#endif if (!g_fNoConfigureWindow) UpdateWindow(pRLWinPriv->hWnd); } @@ -901,10 +744,8 @@ winMWExtWMDamageRects(RootlessFrameID wid, int nCount, const BoxRec * pRects, win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; const BoxRec *pEnd; -#if CYGMULTIWINDOW_DEBUG && 0 winDebug("winMWExtWMDamageRects (%08x, %d, %08x, %d, %d)\n", pRLWinPriv, nCount, pRects, shift_x, shift_y); -#endif for (pEnd = pRects + nCount; pRects < pEnd; pRects++) { RECT rcDmg; @@ -923,10 +764,8 @@ winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRootlessSwitchWindow (%08x) %08x\n", (int) pRLWinPriv, (int) pRLWinPriv->hWnd); -#endif pRLWinPriv->pFrame = pFrame; pRLWinPriv->fResized = TRUE; @@ -938,26 +777,6 @@ winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) DeleteProperty(serverClient, oldWin, AtmWindowsWmNativeHwnd()); winMWExtWMSetNativeProperty(pFrame); -#if CYGMULTIWINDOW_DEBUG -#if 0 - { - WindowPtr pWin2 = NULL; - win32RootlessWindowPtr pRLWinPriv2 = NULL; - - /* Check if the Windows window property for our X window pointer is valid */ - if ((pWin2 = - (WindowPtr) GetProp(pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL) { - pRLWinPriv2 = - (win32RootlessWindowPtr) RootlessFrameForWindow(pWin2, FALSE); - } - winDebug("winMWExtWMSwitchFrame2 (%08x) %08x\n", - pRLWinPriv2, pRLWinPriv2->hWnd); - if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd) { - winDebug("Error param missmatch\n"); - } - } -#endif -#endif } void @@ -965,9 +784,7 @@ winMWExtWMCopyBytes(unsigned int width, unsigned int height, const void *src, unsigned int srcRowBytes, void *dst, unsigned int dstRowBytes) { -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyBytes - Not implemented\n"); -#endif } void @@ -978,19 +795,15 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects, const BoxRec *pEnd; RECT rcDmg; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n", (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy); -#endif for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++) { -#if CYGMULTIWINDOW_DEBUG winDebug("BitBlt (%d, %d, %d, %d) (%d, %d)\n", pDstRects->x1, pDstRects->y1, pDstRects->x2 - pDstRects->x1, pDstRects->y2 - pDstRects->y1, pDstRects->x1 + nDx, pDstRects->y1 + nDy); -#endif if (!BitBlt(pRLWinPriv->hdcShadow, pDstRects->x1, pDstRects->y1, @@ -1008,9 +821,7 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects, InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE); } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyWindow - done\n"); -#endif } /* |