diff options
Diffstat (limited to 'xorg-server/hw/xwin/winwin32rootless.c')
-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 660a78f2d..aeec0eee2 100644 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -82,8 +82,7 @@ winMWExtWMQueryDIBFormat(win32RootlessWindowPtr pRLWinPriv, BITMAPINFOHEADER * pbmih) { HBITMAP hbmp; - -#if CYGMULTIWINDOW_DEBUG +#ifdef _DEBUG LPDWORD pdw = NULL; #endif @@ -106,7 +105,7 @@ winMWExtWMQueryDIBFormat(win32RootlessWindowPtr pRLWinPriv, return FALSE; } -#if CYGMULTIWINDOW_DEBUG +#ifdef _DEBUG /* Get a pointer to bitfields */ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER)); @@ -208,10 +207,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 = malloc(sizeof(win32RootlessWindowRec)); pRLWinPriv->pFrame = pFrame; @@ -260,9 +257,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); @@ -298,9 +293,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, fResult = FALSE; } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - ShowWindow\n"); -#endif //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE); g_fNoConfigureWindow = FALSE; @@ -309,28 +302,8 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, winMWExtWMReshapeFrame(pFrame->wid, pShape); } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - (%p) %p\n", pFrame->wid, 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); @@ -347,29 +320,8 @@ winMWExtWMDestroyFrame(RootlessFrameID wid) int iReturn; char pszClass[CLASS_NAME_LENGTH]; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMDestroyFrame (%p) %p\n", pRLWinPriv, 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); @@ -385,22 +337,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 @@ -413,10 +359,8 @@ winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX, DWORD dwStyle; int iX, iY, iWidth, iHeight; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMMoveFrame (%p) (%d %d)\n", pRLWinPriv, iNewX, iNewY); -#endif /* Get the Windows window style and extended style */ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE); @@ -433,29 +377,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 (%p) done\n", pRLWinPriv); -#endif } void @@ -471,10 +409,8 @@ winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, DWORD dwStyle; int iX, iY; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMResizeFrame (%p) (%d %d)-(%d %d)\n", pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight); -#endif pRLWinPriv->fResized = TRUE; @@ -523,9 +459,8 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) Bool fFirst = TRUE; Bool fNeedRestack = TRUE; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRestackFrame (%p)\n", pRLWinPriv); -#endif + if (pScreenPriv && pScreenPriv->fRestacking) return; @@ -540,18 +475,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)) { @@ -562,18 +495,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; @@ -591,9 +520,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); @@ -603,15 +531,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 (%p)\n", pRLWinPriv); -#endif pRLWinPriv->fRestackingNow = FALSE; } @@ -623,9 +550,7 @@ winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape) HRGN hRgn, hRgnWindow, hRgnClient; RECT rcWindow, rcClient; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMReshapeFrame (%p)\n", pRLWinPriv); -#endif hRgn = winMWExtWMCreateRgnFromRegion(pShape); @@ -652,9 +577,7 @@ winMWExtWMUnmapFrame(RootlessFrameID wid) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMUnmapFrame (%p)\n", pRLWinPriv); -#endif g_fNoConfigureWindow = TRUE; //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE); @@ -677,10 +600,8 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) HDC hdcNew; HBITMAP hbmpNew; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMStartDrawing (%p) %08x\n", pRLWinPriv, pRLWinPriv->fDestroyed); -#endif if (!pRLWinPriv->fDestroyed) { pScreen = pRLWinPriv->pFrame->win->drawable.pScreen; @@ -689,12 +610,11 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo; -#if CYGMULTIWINDOW_DEBUG winDebug("\tpScreenPriv %p\n", pScreenPriv); winDebug("\tpScreenInfo %p\n", pScreenInfo); winDebug("\t(%d, %d)\n", (int) pRLWinPriv->pFrame->width, (int) pRLWinPriv->pFrame->height); -#endif + if (pRLWinPriv->hdcScreen == NULL) { InitWin32RootlessEngine(pRLWinPriv); } @@ -729,15 +649,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", @@ -745,14 +662,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, @@ -761,9 +675,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"); @@ -782,10 +694,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); @@ -795,22 +705,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 (%p) %p %d\n", pRLWinPriv, pRLWinPriv->pfb, (unsigned int) pRLWinPriv->dwWidthBytes); -#endif *pixelData = pRLWinPriv->pfb; *bytesPerRow = pRLWinPriv->dwWidthBytes; } @@ -818,31 +724,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 @@ -850,44 +731,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); } @@ -899,10 +742,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; @@ -921,10 +762,8 @@ winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMRootlessSwitchWindow (%p) %p\n", pRLWinPriv, pRLWinPriv->hWnd); -#endif pRLWinPriv->pFrame = pFrame; pRLWinPriv->fResized = TRUE; @@ -936,26 +775,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 @@ -963,9 +782,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 @@ -976,19 +793,15 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects, const BoxRec *pEnd; RECT rcDmg; -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyWindow (%p, %d, %p, %d, %d)\n", pRLWinPriv, nDstRects, 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, @@ -1006,9 +819,7 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects, InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE); } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyWindow - done\n"); -#endif } /* |