diff options
Diffstat (limited to 'xorg-server/hw/xwin/winwin32rootless.c')
-rw-r--r-- | xorg-server/hw/xwin/winwin32rootless.c | 223 |
1 files changed, 18 insertions, 205 deletions
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c index 8f9917a7b..d630f1d90 100644 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -83,7 +83,7 @@ Bool winMWExtWMQueryDIBFormat (win32RootlessWindowPtr pRLWinPriv, BITMAPINFOHEADER *pbmih) { HBITMAP hbmp; -#if CYGMULTIWINDOW_DEBUG +#ifdef _DEBUG LPDWORD pdw = NULL; #endif @@ -112,7 +112,7 @@ winMWExtWMQueryDIBFormat (win32RootlessWindowPtr pRLWinPriv, BITMAPINFOHEADER *p return FALSE; } -#if CYGMULTIWINDOW_DEBUG +#ifdef _DEBUG /* Get a pointer to bitfields */ pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); @@ -228,10 +228,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)); pRLWinPriv->pFrame = pFrame; @@ -282,9 +280,7 @@ winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen, pszWindowID[sizeof(pszWindowID)-1] = 0; strcat (pszClass, pszWindowID); -#if CYGMULTIWINDOW_DEBUG winDebug ("winCreateWindowsWindow - Creating class: %s\n", pszClass); -#endif /* Setup our window class */ wc.cbSize = sizeof(wc); @@ -322,9 +318,7 @@ winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen, fResult = FALSE; } -#if CYGMULTIWINDOW_DEBUG winDebug ("winMWExtWMCreateFrame - ShowWindow\n"); -#endif //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE); g_fNoConfigureWindow = FALSE; @@ -334,28 +328,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); @@ -372,29 +346,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); @@ -411,22 +364,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 @@ -438,9 +385,7 @@ winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int iNewX, int iNew 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); @@ -457,29 +402,23 @@ winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int iNewX, int iNew /* 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 @@ -495,10 +434,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; @@ -547,9 +484,9 @@ winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid) HWND hWnd; Bool fFirst = TRUE; Bool fNeedRestack = TRUE; -#if CYGMULTIWINDOW_DEBUG + winDebug ("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv); -#endif + if (pScreenPriv->fRestacking) return; @@ -563,19 +500,17 @@ winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid) 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); } +#ifdef XWIN_MULTIWINDOWINTWM else if (winIsInternalWMRunning(pScreenInfo)) { /* using mulwinidow wm */ -#if CYGMULTIWINDOW_DEBUG winDebug ("Win %08x is not top\n", pRLWinPriv); -#endif + for (hWnd = GetNextWindow (pRLWinPriv->hWnd, GW_HWNDPREV); fNeedRestack && hWnd != NULL; hWnd = GetNextWindow (hWnd, GW_HWNDPREV)) @@ -590,18 +525,15 @@ winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid) /* 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; @@ -621,9 +553,8 @@ winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid) { 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); @@ -633,19 +564,16 @@ winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid) } } } - else +#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 0 -#endif } -#if CYGMULTIWINDOW_DEBUG winDebug ("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv); -#endif pRLWinPriv->fRestackingNow = FALSE; } @@ -656,9 +584,8 @@ winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape) win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; HRGN hRgn, hRgnWindow, hRgnClient; RECT rcWindow, rcClient; -#if CYGMULTIWINDOW_DEBUG + winDebug ("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv); -#endif hRgn = winMWExtWMCreateRgnFromRegion (pShape); @@ -685,9 +612,8 @@ void 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); @@ -709,9 +635,8 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow) Bool fReturn = TRUE; HDC hdcNew; HBITMAP hbmpNew; -#if CYGMULTIWINDOW_DEBUG + winDebug ("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv, pRLWinPriv->fDestroyed); -#endif if (!pRLWinPriv->fDestroyed) { @@ -719,12 +644,11 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow) if (pScreen) pScreenPriv = winGetScreenPriv(pScreen); 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); @@ -764,15 +688,12 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow) } 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", @@ -780,14 +701,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, @@ -798,9 +716,7 @@ winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow) SRCCOPY); if (fReturn) { -#if CYGMULTIWINDOW_DEBUG winDebug ("winMWExtWMStartDrawing - Shadow blit success\n"); -#endif } else { @@ -821,10 +737,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); @@ -834,22 +748,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; } @@ -857,77 +767,12 @@ 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 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); } @@ -937,10 +782,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; @@ -957,10 +800,8 @@ void 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; @@ -973,26 +814,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 @@ -1000,9 +821,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 @@ -1012,21 +831,17 @@ winMWExtWMCopyWindow (RootlessFrameID wid, int nDstRects, const BoxRec *pDstRect win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; 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, @@ -1046,9 +861,7 @@ winMWExtWMCopyWindow (RootlessFrameID wid, int nDstRects, const BoxRec *pDstRect InvalidateRect (pRLWinPriv->hWnd, &rcDmg, FALSE); } -#if CYGMULTIWINDOW_DEBUG winDebug ("winMWExtWMCopyWindow - done\n"); -#endif } |