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 0b62696f3..024458063 100644 --- 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 = malloc(sizeof(win32RootlessWindowRec)); pRLWinPriv->pFrame = pFrame; @@ -261,9 +258,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); @@ -299,9 +294,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, fResult = FALSE; } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCreateFrame - ShowWindow\n"); -#endif //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE); g_fNoConfigureWindow = FALSE; @@ -310,28 +303,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); @@ -348,29 +321,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); @@ -386,22 +338,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 @@ -414,10 +360,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); @@ -434,29 +378,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 @@ -472,10 +410,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; @@ -524,9 +460,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; @@ -541,18 +476,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)) { @@ -563,18 +496,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; @@ -592,9 +521,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); @@ -604,15 +532,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; } @@ -624,9 +551,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); @@ -653,9 +578,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); @@ -678,10 +601,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; @@ -690,12 +611,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); } @@ -730,15 +650,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", @@ -746,14 +663,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, @@ -762,9 +676,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"); @@ -783,10 +695,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); @@ -796,22 +706,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; } @@ -819,31 +725,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 @@ -851,44 +732,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); } @@ -900,10 +743,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; @@ -922,10 +763,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; @@ -937,26 +776,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 @@ -964,9 +783,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 @@ -977,19 +794,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, @@ -1007,9 +820,7 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects, InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE); } -#if CYGMULTIWINDOW_DEBUG winDebug("winMWExtWMCopyWindow - done\n"); -#endif } /* |