diff options
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r-- | xorg-server/hw/xwin/InitOutput.c | 1 | ||||
-rw-r--r-- | xorg-server/hw/xwin/glx/indirect.c | 317 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winclipboardwndproc.c | 14 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwindow.c | 92 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwm.c | 108 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwindow.h | 3 |
6 files changed, 262 insertions, 273 deletions
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 98dcd6909..45c8ec28a 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -54,6 +54,7 @@ typedef HRESULT (__stdcall * SHGETFOLDERPATHPROC)(HWND hwndOwner, DWORD dwFlags, LPTSTR pszPath); #endif +#include "glx_extinit.h" /* * References to external symbols */ diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c index 8ab464af7..830d00e19 100644 --- a/xorg-server/hw/xwin/glx/indirect.c +++ b/xorg-server/hw/xwin/glx/indirect.c @@ -174,18 +174,17 @@ struct __GLXWinConfig { #ifdef _DEBUG void GLWIN_DEBUG_HWND(HWND hwnd) { - if (glxWinDebugSettings.dumpHWND) - { - char buffer[1024]; - RECT Rect; - HDC hDc=GetDC(hwnd); + if (glxWinDebugSettings.dumpHWND) { + char buffer[1024]; + RECT Rect; + HDC hDc=GetDC(hwnd); - if (GetWindowText(hwnd, buffer, sizeof(buffer))==0) *buffer=0; - GetWindowRect(hwnd,&Rect); + if (GetWindowText(hwnd, buffer, sizeof(buffer))==0) *buffer=0; + GetWindowRect(hwnd,&Rect); - GLWIN_DEBUG_MSG("Got HWND %p (hdc %p) for window '%s' (%d,%d,%d,%d)", hwnd, hDc, buffer, Rect.left, Rect.top, Rect.right, Rect.bottom); - ReleaseDC(hwnd,hDc); - } + GLWIN_DEBUG_MSG("Got HWND %p (hdc %p) for window '%s' (%d,%d,%d,%d)", hwnd, hDc, buffer, Rect.left, Rect.top, Rect.right, Rect.bottom); + ReleaseDC(hwnd,hDc); + } } void GLWIN_HDC_DEBUG_MSG(const char *Message, HDC hDc, HWND hwnd) @@ -481,7 +480,7 @@ void glxWinPushNativeProvider(void) { if (g_fNativeGl) - GlxPushProvider(&__glXWGLProvider); + GlxPushProvider(&__glXWGLProvider); } /* ---------------------------------------------------------------------- */ @@ -511,12 +510,11 @@ glxWinScreenSwapInterval(__GLXdrawable * drawable, int interval) static LRESULT CALLBACK GlxWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (uMsg== WM_NCHITTEST) - { - return HTTRANSPARENT; - } - else - return DefWindowProc(hwnd, uMsg, wParam, lParam); + if (uMsg== WM_NCHITTEST) { + return HTTRANSPARENT; + } + else + return DefWindowProc(hwnd, uMsg, wParam, lParam); } /* @@ -637,11 +635,10 @@ glxWinScreenProbe(ScreenPtr pScreen) // we must set a pixel format before we can create a context, just use the first one... SetPixelFormat(hdc, 1, NULL); hglrc = wglCreateContext(hdc); - if (!wglMakeCurrent(hdc, hglrc)) - { + if (!wglMakeCurrent(hdc, hglrc)) { DWORD ErrorCode=GetLastError(); ErrorF("wglMakeCurrent error: %x dc %p ctx %p\n", ErrorCode,hdc,hglrc); - } + } // initialize wgl extension proc pointers (don't call them before here...) // (but we need to have a current context for them to be resolvable) @@ -865,9 +862,8 @@ glxWinRealizeWindow(WindowPtr pWin) pScreen->RealizeWindow = glxWinRealizeWindow; // Check if ze need to move the window\n - if (pWinPriv->fWglUsed && pWinPriv->hWnd) - { - ShowWindow(pWinPriv->hWnd,SW_SHOWNOACTIVATE); + if (pWinPriv->fWglUsed && pWinPriv->hWnd) { + ShowWindow(pWinPriv->hWnd,SW_SHOWNOACTIVATE); } return result; } @@ -901,7 +897,6 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) pScreen->CopyWindow = screenPriv->CopyWindow; pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); pScreen->CopyWindow = glxWinCopyWindow; - } static Bool @@ -918,13 +913,13 @@ glxWinPositionWindow(WindowPtr pWin, int x, int y) if (pWinPriv->fWglUsed && pWinPriv->hWnd) { - MoveWindow(pWinPriv->hWnd, - pWin->drawable.x, - pWin->drawable.y, - pWin->drawable.width, - pWin->drawable.height, - FALSE); - winDebug("Move window %x, %x, %d, %d, %d, %d\n",pWinPriv->hWnd,GetParent(pWinPriv->hWnd), pWin->drawable.x, pWin->drawable.y, pWin->drawable.width, pWin->drawable.height); + MoveWindow(pWinPriv->hWnd, + pWin->drawable.x, + pWin->drawable.y, + pWin->drawable.width, + pWin->drawable.height, + FALSE); + winDebug("Move window %x, %x, %d, %d, %d, %d\n",pWinPriv->hWnd,GetParent(pWinPriv->hWnd), pWin->drawable.x, pWin->drawable.y, pWin->drawable.width, pWin->drawable.height); } return result; } @@ -1163,24 +1158,24 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride, GLXWinConfig *winConfig = (GLXWinConfig *) config; - WindowPtr pWin; - __GLXWinDrawable *drawPriv = (__GLXWinDrawable *)gc->base.drawPriv; - pWin = (WindowPtr) drawPriv->base.pDraw; - { - winWindowPriv(pWin); - if (pWinPriv->OpenGlWindow) + WindowPtr pWin; + __GLXWinDrawable *drawPriv = (__GLXWinDrawable *)gc->base.drawPriv; + pWin = (WindowPtr) drawPriv->base.pDraw; { - ErrorF("Not Setting pixel format to %d on hdc %x for window %x (not allowed on windows)\n",winConfig->pixelFormatIndex,hdc,pWinPriv->hWnd); - return TRUE; /* Pixel format is already set on this window so it cannot be changed anymore */ + winWindowPriv(pWin); + if (pWinPriv->OpenGlWindow) + { + ErrorF("Not Setting pixel format to %d on hdc %x for window %x (not allowed on windows)\n",winConfig->pixelFormatIndex,hdc,pWinPriv->hWnd); + return TRUE; /* Pixel format is already set on this window so it cannot be changed anymore */ + } } - } - GLWIN_DEBUG_MSG("glxWinSetPixelFormat: pixelFormatIndex %d", winConfig->pixelFormatIndex); + GLWIN_DEBUG_MSG("glxWinSetPixelFormat: pixelFormatIndex %d", winConfig->pixelFormatIndex); /* Normally, we can just use the the pixelFormatIndex corresponding to the fbconfig which has been specified by the client - */ - /* + */ + /* However, in certain special cases this pixel format will be incompatible with the use we are going to put it to, so we need to re-evaluate the pixel format to use: @@ -1246,51 +1241,49 @@ glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride, fbConfigToPixelFormatIndex(hdc, gc->base.config, drawableTypeOverride, winScreen); if (pixelFormat != 0) { - GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat); + GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat); - ErrorF("Setting pixel format 3 to %d on hdc %x\n",pixelFormat,hdc); - if (!SetPixelFormat(hdc, pixelFormat, NULL)) { - ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); - return FALSE; - } - return TRUE; - } - else - { - /* There was an error choose some default for the moment */ - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd - 1, // version number - PFD_DRAW_TO_WINDOW | // support window - PFD_SUPPORT_OPENGL | // support OpenGL - PFD_DOUBLEBUFFER, // double buffered - PFD_TYPE_RGBA, // RGBA type - 24, // 24-bit color depth - 0, 0, 0, 0, 0, 0, // color bits ignored - 0, // no alpha buffer - 0, // shift bit ignored - 0, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - 32, // 32-bit z-buffer - 0, // no stencil buffer - 0, // no auxiliary buffer - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0 // layer masks ignored - }; - int iPixelFormat; + ErrorF("Setting pixel format 3 to %d on hdc %x\n",pixelFormat,hdc); + if (!SetPixelFormat(hdc, pixelFormat, NULL)) { + ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); + return FALSE; + } + return TRUE; + } + else { + /* There was an error choose some default for the moment */ + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd + 1, // version number + PFD_DRAW_TO_WINDOW | // support window + PFD_SUPPORT_OPENGL | // support OpenGL + PFD_DOUBLEBUFFER, // double buffered + PFD_TYPE_RGBA, // RGBA type + 24, // 24-bit color depth + 0, 0, 0, 0, 0, 0, // color bits ignored + 0, // no alpha buffer + 0, // shift bit ignored + 0, // no accumulation buffer + 0, 0, 0, 0, // accum bits ignored + 32, // 32-bit z-buffer + 0, // no stencil buffer + 0, // no auxiliary buffer + PFD_MAIN_PLANE, // main layer + 0, // reserved + 0, 0, 0 // layer masks ignored + }; + int iPixelFormat; - // get the best available match of pixel format for the device context - iPixelFormat = ChoosePixelFormat(hdc, &pfd); + // get the best available match of pixel format for the device context + iPixelFormat = ChoosePixelFormat(hdc, &pfd); - ErrorF("Setting pixel format 4 to %d on hdc %x\n",iPixelFormat,hdc); - // make that the pixel format of the device context - if (!SetPixelFormat(hdc, iPixelFormat, &pfd)) - { - ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); - return FALSE; - } - } + ErrorF("Setting pixel format 4 to %d on hdc %x\n",iPixelFormat,hdc); + // make that the pixel format of the device context + if (!SetPixelFormat(hdc, iPixelFormat, &pfd)) { + ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); + return FALSE; + } + } } return TRUE; } @@ -1325,52 +1318,51 @@ glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HWND *hwnd) return NULL; } - if (!gc->hDC) - { - winWindowPriv(pWin); + if (!gc->hDC) { + winWindowPriv(pWin); - hdc = GetDC(*hwnd); + hdc = GetDC(*hwnd); - if (hdc == NULL) - ErrorF("GetDC error: %s: hwnd %x, gc %p, gc->ctx %p ,gc->hwnd %p\n", glxWinErrorMessage(), *hwnd, gc, gc->ctx, gc->hwnd); + if (hdc == NULL) + ErrorF("GetDC error: %s: hwnd %x, gc %p, gc->ctx %p ,gc->hwnd %p\n", glxWinErrorMessage(), *hwnd, gc, gc->ctx, gc->hwnd); - glxWinSetPixelFormat(gc, hdc, 0, GLX_WINDOW_BIT); - pWinPriv->OpenGlWindow=TRUE; /* Identify it as an opengl window, also used to check if the pixel format is already set */ - gc->ctx = wglCreateContext(hdc); - } + glxWinSetPixelFormat(gc, hdc, 0, GLX_WINDOW_BIT); + pWinPriv->OpenGlWindow=TRUE; /* Identify it as an opengl window, also used to check if the pixel format is already set */ + gc->ctx = wglCreateContext(hdc); + } #ifdef _DEBUG - if (glxWinDebugSettings.enableTrace) - GLWIN_DEBUG_HWND(*hwnd); + if (glxWinDebugSettings.enableTrace) + GLWIN_DEBUG_HWND(*hwnd); - GLWIN_TRACE_MSG - ("for context %p (native ctx %p), hWnd changed from %p to %p", - gc, gc->ctx, gc->hwnd, *hwnd); + GLWIN_TRACE_MSG + ("for context %p (native ctx %p), hWnd changed from %p to %p", + gc, gc->ctx, gc->hwnd, *hwnd); #endif - if (gc->hwnd!=*hwnd) - ErrorF("Window changed handle from %x to %x\n", gc->hwnd, *hwnd); + if (gc->hwnd!=*hwnd) + ErrorF("Window changed handle from %x to %x\n", gc->hwnd, *hwnd); - gc->hwnd = *hwnd; + gc->hwnd = *hwnd; } break; case GLX_DRAWABLE_PBUFFER: { - hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer); + hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer); - if (hdc == NULL) + if (hdc == NULL) ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage()); - gc->ctx = wglCreateContext(hdc); + gc->ctx = wglCreateContext(hdc); } break; case GLX_DRAWABLE_PIXMAP: { - hdc = draw->dibDC; + hdc = draw->dibDC; #ifdef _DEBUG - if (glxWinDebugSettings.dumpDC) - GLWIN_DEBUG_MSG("Got PIXMAP HDC %p for window %p", hdc, *hwnd); + if (glxWinDebugSettings.dumpDC) + GLWIN_DEBUG_MSG("Got PIXMAP HDC %p for window %p", hdc, *hwnd); #endif } break; @@ -1387,7 +1379,7 @@ glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HWND *hwnd) GLWIN_HDC_DEBUG_MSG("Got HDC %p for window %p", hdc, *hwnd); #endif - return hdc; + return hdc; } static void @@ -1462,7 +1454,7 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw) case GLX_DRAWABLE_PBUFFER: { - WindowPtr pWin = (WindowPtr) draw->base.pDraw; + WindowPtr pWin = (WindowPtr) draw->base.pDraw; if (draw->hPbuffer == NULL) { __GLXscreen *screen; glxWinScreen *winScreen; @@ -1548,7 +1540,7 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw) draw->pOldBits = ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr; ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr = pBits; - ((PixmapPtr)draw->base.pDraw)->refcnt++; /* Increment reference count to be sure it is not freed before the glxdrawable is destroyed */ + ((PixmapPtr)draw->base.pDraw)->refcnt++; /* Increment reference count to be sure it is not freed before the glxdrawable is destroyed */ // Select the DIB into the DC draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB); @@ -1580,8 +1572,8 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw) gc->hDC = glxWinMakeDC(gc, draw, &hwnd); if (gc->ctx == NULL) { - glxWinReleaseDC(hwnd, gc->hDC, draw); - gc->hDC=0; + glxWinReleaseDC(hwnd, gc->hDC, draw); + gc->hDC=0; ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage()); return; @@ -1632,7 +1624,7 @@ glxWinContextMakeCurrent(__GLXcontext * base) if (gc->ctx == NULL) { ErrorF("glxWinContextMakeCurrent: Native context is NULL\n"); - drawPriv->drawContext = NULL; /* clear last active context because we return error */ + drawPriv->drawContext = NULL; /* clear last active context because we return error */ return FALSE; } @@ -1644,8 +1636,7 @@ glxWinContextMakeCurrent(__GLXcontext * base) to one DC and reading from the other */ gc->hreadDC = glxWinMakeDC(gc, (__GLXWinDrawable *)gc->base.readPriv, &gc->hreadwnd); - if (gc->hreadDC == NULL) - { + if (gc->hreadDC == NULL) { ErrorF("glxWinMakeDC failed for readDC\n"); drawPriv->drawContext = NULL; /* clear last active context because we return error */ return FALSE; @@ -1659,20 +1650,18 @@ glxWinContextMakeCurrent(__GLXcontext * base) } else { /* Otherwise, just use wglMakeCurrent */ - if (!gc->hDC) - { - /* It probably has been release by loseCurrent, so create it again */ - gc->hDC = glxWinMakeDC(gc, drawPriv, &gc->hwnd); - } - ret = wglMakeCurrent(gc->hDC, gc->ctx); - if (!ret) { - DWORD ErrorCode=GetLastError(); - ErrorF("wglMakeCurrent error: %x dc %p ctx %p\n", ErrorCode,gc->hDC,gc->ctx); - if (!ErrorCode) - { - ErrorF("Error code was 0, assuming no error.\n"); - ret=TRUE; - } + if (!gc->hDC) { + /* It probably has been release by loseCurrent, so create it again */ + gc->hDC = glxWinMakeDC(gc, drawPriv, &gc->hwnd); + } + ret = wglMakeCurrent(gc->hDC, gc->ctx); + if (!ret) { + DWORD ErrorCode=GetLastError(); + ErrorF("wglMakeCurrent error: %x dc %p ctx %p\n", ErrorCode,gc->hDC,gc->ctx); + if (!ErrorCode) { + ErrorF("Error code was 0, assuming no error.\n"); + ret=TRUE; + } } } @@ -1741,7 +1730,7 @@ glxWinContextDestroy(__GLXcontext * base) __GLXWinContext *gc = (__GLXWinContext *) base; if (gc != NULL) { - __GLXWinDrawable *drawPriv = (__GLXWinDrawable *)gc->base.drawPriv; + __GLXWinDrawable *drawPriv = (__GLXWinDrawable *)gc->base.drawPriv; GLWIN_DEBUG_MSG("GLXcontext %p destroyed (native ctx %p)", base, gc->ctx); @@ -1822,13 +1811,13 @@ glxWinCreateContext(__GLXscreen * screen, static int GetShift(int Mask) { - int Shift=0; + int Shift = 0; - while ((Mask&1)==0) { - Shift++; - Mask>>=1; - } - return Shift; + while ((Mask &1) == 0) { + Shift++; + Mask >>=1; + } + return Shift; } static int @@ -1878,14 +1867,14 @@ fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret, pfd.cAlphaShift = GetShift(mode->alphaMask); if (mode->visualType == GLX_TRUE_COLOR) { - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.dwVisibleMask = - (pfd.cRedBits << pfd.cRedShift) | (pfd.cGreenBits << pfd.cGreenShift) | - (pfd.cBlueBits << pfd.cBlueShift) | (pfd.cAlphaBits << pfd.cAlphaShift); + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.dwVisibleMask = + (pfd.cRedBits << pfd.cRedShift) | (pfd.cGreenBits << pfd.cGreenShift) | + (pfd.cBlueBits << pfd.cBlueShift) | (pfd.cAlphaBits << pfd.cAlphaShift); } else { - pfd.iPixelType = PFD_TYPE_COLORINDEX; - pfd.dwVisibleMask = mode->transparentIndex; + pfd.iPixelType = PFD_TYPE_COLORINDEX; + pfd.dwVisibleMask = mode->transparentIndex; } pfd.cAccumBits = @@ -2128,25 +2117,25 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen) /* EXT_visual_info / GLX 1.2 */ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) { c->base.visualType = GLX_STATIC_COLOR; - c->base.transparentRed = GLX_NONE; - c->base.transparentGreen = GLX_NONE; - c->base.transparentBlue = GLX_NONE; - c->base.transparentAlpha = GLX_NONE; - c->base.transparentIndex = pfd.dwVisibleMask; - c->base.transparentPixel = GLX_TRANSPARENT_INDEX; + c->base.transparentRed = GLX_NONE; + c->base.transparentGreen = GLX_NONE; + c->base.transparentBlue = GLX_NONE; + c->base.transparentAlpha = GLX_NONE; + c->base.transparentIndex = pfd.dwVisibleMask; + c->base.transparentPixel = GLX_TRANSPARENT_INDEX; } else { - c->base.visualType = GLX_TRUE_COLOR; - c->base.transparentRed = - (pfd.dwVisibleMask&c->base.redMask) >> pfd.cRedShift; - c->base.transparentGreen = - (pfd.dwVisibleMask&c->base.greenMask) >> pfd.cGreenShift; - c->base.transparentBlue = - (pfd.dwVisibleMask&c->base.blueMask) >> pfd.cBlueShift; - c->base.transparentAlpha = - (pfd.dwVisibleMask&c->base.alphaMask) >> pfd.cAlphaShift; - c->base.transparentIndex = GLX_NONE; - c->base.transparentPixel = GLX_TRANSPARENT_RGB; + c->base.visualType = GLX_TRUE_COLOR; + c->base.transparentRed = + (pfd.dwVisibleMask & c->base.redMask) >> pfd.cRedShift; + c->base.transparentGreen = + (pfd.dwVisibleMask & c->base.greenMask) >> pfd.cGreenShift; + c->base.transparentBlue = + (pfd.dwVisibleMask & c->base.blueMask) >> pfd.cBlueShift; + c->base.transparentAlpha = + (pfd.dwVisibleMask & c->base.alphaMask) >> pfd.cAlphaShift; + c->base.transparentIndex = GLX_NONE; + c->base.transparentPixel = GLX_TRANSPARENT_RGB; } /* ARB_multisample / SGIS_multisample */ @@ -2350,10 +2339,10 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen) /* fill in configs */ for (i = 0; i < numConfigs; i++) { - int sizevalues=num_attrs*sizeof(int); - int *values=(int*)_alloca(sizevalues); + int sizevalues=num_attrs*sizeof(int); + int *values=(int*)_alloca(sizevalues); - memset(values,0,sizevalues); + memset(values,0,sizevalues); c = &(result[i]); c->base.next = NULL; diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c index d932082b7..28348ac45 100644 --- a/xorg-server/hw/xwin/winclipboardwndproc.c +++ b/xorg-server/hw/xwin/winclipboardwndproc.c @@ -110,6 +110,8 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay, remainingTime = dwStopTime - GetTickCount(); tv.tv_sec = remainingTime / 1000; tv.tv_usec = (remainingTime % 1000) * 1000; + winDebug("winProcessXEventsTimeout () - %d milliseconds left\n", + remainingTime); /* Break out if no time left */ if (remainingTime <= 0) @@ -122,8 +124,8 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay, NULL, /* No exception mask */ &tv); /* Timeout */ if (iReturn < 0) { - ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d (%x). " - "Bailing.\n", iReturn, WSAGetLastError()); + ErrorF("winProcessXEventsTimeout - Call to select () failed: %d (%x). " + "Bailing.\n", iReturn, WSAGetLastError()); break; } @@ -133,11 +135,19 @@ winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay, /* Exit when we see that server is shutting down */ iReturn = winClipboardFlushXEvents(hwnd, iWindow, pDisplay, fUseUnicode, TRUE); + + winDebug + ("winProcessXEventsTimeout () - winClipboardFlushXEvents returned %d\n", + iReturn); + if (WIN_XEVENTS_NOTIFY == iReturn) { /* Bail out if notify processed */ return iReturn; } } + else { + winDebug("winProcessXEventsTimeout - Spurious wake\n"); + } } return WIN_XEVENTS_SUCCESS; diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 3100ea640..0612ca6a1 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -553,7 +553,6 @@ winCreateWindowsWindow(WindowPtr pWin) if (iX == CW_USEDEFAULT) { winAdjustXWindow(pWin, hWnd); } - /* Change style back to popup, already placed... */ SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); @@ -644,7 +643,7 @@ winUpdateWindowsWindow(WindowPtr pWin) HWND hWnd = pWinPriv->hWnd; #if CYGMULTIWINDOW_DEBUG - winDebug ("winUpdateWindowsWindow\n"); + winDebug("winUpdateWindowsWindow\n"); #endif /* Check if the Windows window's parents have been destroyed */ @@ -663,45 +662,40 @@ winUpdateWindowsWindow(WindowPtr pWin) UpdateWindow(pWinPriv->hWnd); } else if (hWnd != NULL) { - if (pWinPriv->fWglUsed) - { - /* We do not need to destroy the window but to reparent it and move it to the - correct place when it is an opengl window */ - int offsetx; - int offsety; - HWND hParentWnd; - WindowPtr pParent=pWin->parent; - - while (pParent) - { - winWindowPriv(pParent); - hParentWnd=pWinPriv->hWnd; - if (hParentWnd) - break; - pParent=pParent->parent; - } + if (pWinPriv->fWglUsed) { + /* We do not need to destroy the window but to reparent it and move it to the + correct place when it is an opengl window */ + int offsetx; + int offsety; + HWND hParentWnd; + WindowPtr pParent=pWin->parent; + + while (pParent) { + winWindowPriv(pParent); + hParentWnd=pWinPriv->hWnd; + if (hParentWnd) + break; + pParent=pParent->parent; + } - if (pParent) - { - offsetx=pParent->drawable.x; - offsety=pParent->drawable.y; + if (pParent) { + offsetx=pParent->drawable.x; + offsety=pParent->drawable.y; + } + else { + offsetx=0; + offsety=0; + } + winDebug ("-winUpdateWindowsWindow: %x changing parent to %x and moving to %d,%d\n",pWinPriv->hWnd,hParentWnd,pWin->drawable.x-offsetx,pWin->drawable.y-offsety); + SetParent(pWinPriv->hWnd,hParentWnd); + SetWindowPos(pWinPriv->hWnd,NULL,pWin->drawable.x-offsetx,pWin->drawable.y-offsety,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW); } - else - { - offsetx=0; - offsety=0; + else { + /* Destroy the Windows window if its parents are destroyed */ + /* First check if we need to release the DC when it is an opengl window */ + winDestroyWindowsWindow (pWin); + assert (pWinPriv->hWnd == NULL); } - winDebug ("-winUpdateWindowsWindow: %x changing parent to %x and moving to %d,%d\n",pWinPriv->hWnd,hParentWnd,pWin->drawable.x-offsetx,pWin->drawable.y-offsety); - SetParent(pWinPriv->hWnd,hParentWnd); - SetWindowPos(pWinPriv->hWnd,NULL,pWin->drawable.x-offsetx,pWin->drawable.y-offsety,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW); - } - else - { - /* Destroy the Windows window if its parents are destroyed */ - /* First check if we need to release the DC when it is an opengl window */ - winDestroyWindowsWindow (pWin); - assert (pWinPriv->hWnd == NULL); - } } #if CYGMULTIWINDOW_DEBUG @@ -723,7 +717,7 @@ winGetWindowID(WindowPtr pWin) FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi); #if CYGMULTIWINDOW_DEBUG - winDebug ("winGetWindowID - Window ID: %d\n", wi.id); + winDebug("winGetWindowID - Window ID: %d\n", wi.id); #endif return wi.id; @@ -758,11 +752,11 @@ winReorderWindowsMultiWindow(void) DWORD dwCurrentProcessID = GetCurrentProcessId(); DWORD dwWindowProcessID = 0; - winDebug ("winReorderWindowsMultiWindow\n"); + winDebug("winReorderWindowsMultiWindow\n"); if (fRestacking) { /* It is a recusive call so immediately exit */ - winDebug ("winReorderWindowsMultiWindow - " + winDebug("winReorderWindowsMultiWindow - " "exit because fRestacking == TRUE\n"); return; } @@ -816,7 +810,7 @@ winMinimizeWindow(Window id) winPrivScreenPtr pScreenPriv = NULL; winScreenInfo *pScreenInfo = NULL; - winDebug ("winMinimizeWindow\n"); + winDebug("winMinimizeWindow\n"); dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); @@ -859,7 +853,7 @@ winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion) winScreenPriv(pScreen); - winDebug ("CopyWindowMultiWindow\n"); + winDebug("CopyWindowMultiWindow\n"); WIN_UNWRAP(CopyWindow); (*pScreen->CopyWindow) (pWin, oldpt, oldRegion); @@ -877,7 +871,7 @@ winMoveWindowMultiWindow(WindowPtr pWin, int x, int y, winScreenPriv(pScreen); - winDebug ("MoveWindowMultiWindow to (%d, %d)\n", x, y); + winDebug("MoveWindowMultiWindow to (%d, %d)\n", x, y); WIN_UNWRAP(MoveWindow); (*pScreen->MoveWindow) (pWin, x, y, pSib, kind); @@ -895,7 +889,7 @@ winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w, winScreenPriv(pScreen); - winDebug ("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h); + winDebug("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h); WIN_UNWRAP(ResizeWindow); (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib); @@ -925,10 +919,10 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd) #define WIDTH(rc) (rc.right - rc.left) #define HEIGHT(rc) (rc.bottom - rc.top) - winDebug ("winAdjustXWindow\n"); + winDebug("winAdjustXWindow\n"); if (IsIconic(hwnd)) { - winDebug ("\timmediately return because the window is iconized\n"); + winDebug("\timmediately return because the window is iconized\n"); /* * If the Windows window is minimized, its WindowRect has * meaningless values so we don't adjust X window to it. @@ -963,7 +957,7 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd) if (EqualRect(&rcDraw, &rcWin)) { /* Bail if no adjust is needed */ - winDebug ("\treturn because already adjusted\n"); + winDebug("\treturn because already adjusted\n"); return 0; } @@ -983,7 +977,7 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd) vlist[1] = pDraw->y + dY - wBorderWidth(pWin); vlist[2] = pDraw->width + dW; vlist[3] = pDraw->height + dH; - winDebug ("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1], + winDebug("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1], vlist[2], vlist[3]); return ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin)); diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 88109ceab..662664b8a 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -676,9 +676,9 @@ winMultiWindowWMProc(void *pArg) UpdateName(pWMInfo, pNode->msg.iWindow); UpdateIcon(pWMInfo, pNode->msg.iWindow); { - HWND zstyle = HWND_NOTOPMOST; - winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle); - winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle); + HWND zstyle = HWND_NOTOPMOST; + winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle); + winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle); } break; @@ -823,7 +823,7 @@ winMultiWindowXMsgProc(void *pArg) pthread_exit(NULL); } - winDebug ("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n"); + winDebug("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n"); /* Grab the server started mutex - pause until we get it */ iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted); @@ -833,12 +833,12 @@ winMultiWindowXMsgProc(void *pArg) pthread_exit(NULL); } - winDebug ("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n"); + winDebug("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n"); /* Release the server started mutex */ pthread_mutex_unlock(pProcArg->ppmServerStarted); - winDebug ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n"); + winDebug("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n"); /* Install our error handler */ XSetErrorHandler(winMultiWindowXMsgProcErrorHandler); @@ -865,7 +865,7 @@ winMultiWindowXMsgProc(void *pArg) winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen); /* Print the display connection string */ - winDebug ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay); + winDebug("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay); /* Use our generated cookie for authentication */ winSetAuthorization(); @@ -878,8 +878,8 @@ winMultiWindowXMsgProc(void *pArg) /* Try to open the display */ pProcArg->pDisplay = XOpenDisplay(pszDisplay); if (pProcArg->pDisplay == NULL) { - winDebug ("winMultiWindowXMsgProc - Could not open display, try: %d, " - "sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY); + winDebug("winMultiWindowXMsgProc - Could not open display, try: %d, " + "sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY); ++iRetries; sleep(WIN_CONNECT_DELAY); continue; @@ -896,8 +896,8 @@ winMultiWindowXMsgProc(void *pArg) pthread_exit(NULL); } - winDebug ("winMultiWindowXMsgProc - XOpenDisplay () returned and " - "successfully opened the display.\n"); + winDebug("winMultiWindowXMsgProc - XOpenDisplay () returned and " + "successfully opened the display.\n"); /* Check if another window manager is already running */ #ifdef XWIN_MULTIWINDOWINTWM @@ -1089,7 +1089,7 @@ winMultiWindowXMsgProc(void *pArg) else if (event.type == ClientMessage && event.xclient.message_type == atmWmChange && event.xclient.data.l[0] == IconicState) { - winDebug ("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n"); + winDebug("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n"); memset(&msg, 0, sizeof(msg)); @@ -1195,7 +1195,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) pthread_exit(NULL); } - winDebug ("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n"); + winDebug("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n"); /* Grab our garbage mutex to satisfy pthread_cond_wait */ iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted); @@ -1205,12 +1205,12 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) pthread_exit(NULL); } - winDebug ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n"); + winDebug("winInitMultiWindowWM - pthread_mutex_lock () returned.\n"); /* Release the server started mutex */ pthread_mutex_unlock(pProcArg->ppmServerStarted); - winDebug ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n"); + winDebug("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n"); /* Install our error handler */ XSetErrorHandler(winMultiWindowWMErrorHandler); @@ -1237,7 +1237,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen); /* Print the display connection string */ - winDebug ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay); + winDebug("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay); /* Use our generated cookie for authentication */ winSetAuthorization(); @@ -1265,8 +1265,8 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) pthread_exit(NULL); } - winDebug ("winInitMultiWindowWM - XOpenDisplay () returned and " - "successfully opened the display.\n"); + winDebug("winInitMultiWindowWM - XOpenDisplay () returned and " + "successfully opened the display.\n"); /* Create some atoms */ pWMInfo->atmWmProtos = XInternAtom(pWMInfo->pDisplay, @@ -1297,7 +1297,7 @@ winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg) { WMMsgNodePtr pNode; - winDebug ("winSendMessageToWM ()\n"); + winDebug("winSendMessageToWM ()\n"); pNode = (WMMsgNodePtr) malloc(sizeof(WMMsgNodeRec)); if (pNode != NULL) { @@ -1323,18 +1323,18 @@ winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr) } XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg)); - ErrorF ("winMultiWindowWMErrorHandler - ERROR: %s\n" - " errorCode %d\n" - " serial %d\n" - " resourceID 0x%x\n" - " majorCode %d\n" - " minorCode %d\n" - , pszErrorMsg - , pErr->error_code - , pErr->serial - , pErr->resourceid - , pErr->request_code - , pErr->minor_code); + ErrorF("winMultiWindowWMErrorHandler - ERROR: %s\n" + " errorCode %d\n" + " serial %d\n" + " resourceID 0x%x\n" + " majorCode %d\n" + " minorCode %d\n" + , pszErrorMsg + , pErr->error_code + , pErr->serial + , pErr->resourceid + , pErr->request_code + , pErr->minor_code); return 0; } @@ -1372,18 +1372,18 @@ winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr) char pszErrorMsg[100]; XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg)); - ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n" - " errorCode %d\n" - " serial %d\n" - " resourceID 0x%x\n" - " majorCode %d\n" - " minorCode %d\n" - , pszErrorMsg - , pErr->error_code - , pErr->serial - , pErr->resourceid - , pErr->request_code - , pErr->minor_code); + ErrorF("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n" + " errorCode %d\n" + " serial %d\n" + " resourceID 0x%x\n" + " majorCode %d\n" + " minorCode %d\n" + , pszErrorMsg + , pErr->error_code + , pErr->serial + , pErr->resourceid + , pErr->request_code + , pErr->minor_code); return 0; } @@ -1415,10 +1415,10 @@ winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay) static void winMultiWindowThreadExit(void *arg) { - AbortDDX(EXIT_ERR_ABORT); + AbortDDX(EXIT_ERR_ABORT); - /* multiwindow client thread has exited, stop server as well */ - TerminateProcess(GetCurrentProcess(),1); + /* multiwindow client thread has exited, stop server as well */ + TerminateProcess(GetCurrentProcess(),1); } /* * Catch RedirectError to detect other window manager running @@ -1471,7 +1471,7 @@ CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen, void winDeinitMultiWindowWM(void) { - winDebug ("winDeinitMultiWindowWM - Noting shutdown in progress\n"); + winDebug("winDeinitMultiWindowWM - Noting shutdown in progress\n"); g_shutdown = TRUE; } @@ -1627,13 +1627,11 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) #define APPLICATION_ID_FORMAT "%s.vcxsrv.%s" #define APPLICATION_ID_UNKNOWN "unknown" - if (class_hint.res_class) - { - asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, class_hint.res_class); + if (class_hint.res_class) { + asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, class_hint.res_class); } - else - { - asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN); + else { + asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN); } winSetAppID (hWnd, application_id); @@ -1694,8 +1692,8 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) if (!IsWindow (hWnd)) { - ErrorF("Windows window 0x%x has become invalid, so returning without applying hints\n",hWnd); - return; + ErrorF("Windows window 0x%x has become invalid, so returning without applying hints\n",hWnd); + return; } if (winMultiWindowGetWMNormalHints(pWin, &SizeHints)) diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index ffb744e66..8757f15e2 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -162,9 +162,6 @@ winTaskbarDestroy (void); void winSetAppID (HWND hWnd, const char* AppID); -/* - * winmultiwindowicons.c - */ #endif /* XWIN_MULTIWINDOW */ #endif |