diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-10-05 17:34:50 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-10-05 17:34:50 +0100 |
commit | fb4ad2f0df4181091a13f645665c7b1984a28944 (patch) | |
tree | 731ce5d4125b4fee0f98f01154686a2e107fa26f | |
parent | ff11a8ecde1a49bac773ead364898dfabdea4a41 (diff) | |
parent | 26f93136840099831246afa1c1517e112b5fca2f (diff) |
Merge branch 'cygwin-aiglx-for-1.11' into cygwin-release-1.11xserver-cygwin-1.11.1-1
Conflicts:
hw/xwin/InitOutput.c
hw/xwin/winwindow.h
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | dix/dispatch.c | 8 | ||||
-rw-r--r-- | dix/globals.c | 3 | ||||
-rw-r--r-- | dix/main.c | 4 | ||||
-rw-r--r-- | glx/glxcmds.c | 7 | ||||
-rw-r--r-- | glx/glxext.c | 2 | ||||
-rw-r--r-- | glx/rensize.c | 1 | ||||
-rw-r--r-- | hw/dmx/dmxinit.c | 4 | ||||
-rw-r--r-- | hw/vfb/InitOutput.c | 6 | ||||
-rw-r--r-- | hw/xnest/Init.c | 5 | ||||
-rw-r--r-- | hw/xwin/InitOutput.c | 9 | ||||
-rw-r--r-- | hw/xwin/glx/winpriv.c | 38 | ||||
-rw-r--r-- | hw/xwin/win.h | 3 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwindow.c | 278 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwndproc.c | 39 | ||||
-rw-r--r-- | hw/xwin/winwin32rootless.c | 2 | ||||
-rw-r--r-- | hw/xwin/winwindow.h | 1 | ||||
-rw-r--r-- | include/ddxhooks.h | 37 | ||||
-rw-r--r-- | include/dix-config.h.in | 4 | ||||
-rw-r--r-- | include/os.h | 4 | ||||
-rw-r--r-- | mi/miinitext.c | 11 |
21 files changed, 403 insertions, 65 deletions
diff --git a/configure.ac b/configure.ac index 4728f9f75..b30bdff67 100644 --- a/configure.ac +++ b/configure.ac @@ -1851,7 +1851,7 @@ if test "x$XWIN" = xyes; then fi AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF]) - AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ]) + AC_DEFINE(DDXMAIN, 1, [Use ddxMain]) dnl XWin with AIGLX requires OpenGL spec files in order to generate wrapper code for native GL functions if [test "x$XWIN" = xyes && test "x$AIGLX" = xyes] ; then diff --git a/dix/dispatch.c b/dix/dispatch.c index 359414e1f..c2e5b043b 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -131,6 +131,7 @@ int ProcInitialConnection(); #include "xkbsrv.h" #include "site.h" #include "client.h" +#include "ddxhooks.h" #ifdef XSERVER_DTRACE #include "registry.h" @@ -461,9 +462,10 @@ Dispatch(void) } dispatchException &= ~DE_PRIORITYCHANGE; } -#if defined(DDXBEFORERESET) - ddxBeforeReset (); -#endif + + if (ddxHooks.ddxBeforeReset) + ddxHooks.ddxBeforeReset(); + KillAllClients(); free(clientReady); dispatchException &= ~DE_RESET; diff --git a/dix/globals.c b/dix/globals.c index 0ee83c03e..91878430c 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -60,6 +60,7 @@ SOFTWARE. #include "site.h" #include "dixstruct.h" #include "os.h" +#include "ddxhooks.h" ScreenInfo screenInfo; KeybdCtrl defaultKeyboardControl = { @@ -130,3 +131,5 @@ int displayfd; char *ConnectionInfo; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; + +DdxHooks ddxHooks; diff --git a/dix/main.c b/dix/main.c index 3e944bdad..b5197d9ea 100644 --- a/dix/main.c +++ b/dix/main.c @@ -137,6 +137,10 @@ int main(int argc, char *argv[], char *envp[]) display = "0"; +#ifdef DDXMAIN + ddxMain(); +#endif + InitRegions(); CheckUserParameters(argc, argv, envp); diff --git a/glx/glxcmds.c b/glx/glxcmds.c index d5b764fd0..0d1c0050e 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -213,6 +213,13 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, return context; } +void +FlushContext(__GLXcontext *cx) +{ + CALL_Flush( GET_DISPATCH(), () ); + cx->hasUnflushedCommands = GL_FALSE; +} + /** * Create a GL context with the given properties. This routine is used * to implement \c glXCreateContext, \c glXCreateNewContext, and diff --git a/glx/glxext.c b/glx/glxext.c index 9cfc096c3..8c52fda25 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -132,6 +132,8 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid) for (c = glxAllContexts; c; c = next) { next = c->next; if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) { + FlushContext(c); + (*c->loseCurrent)(c); c->isCurrent = GL_FALSE; if (c == __glXLastContext) diff --git a/glx/rensize.c b/glx/rensize.c index 8a58e08d7..54fb5cad7 100644 --- a/glx/rensize.c +++ b/glx/rensize.c @@ -220,6 +220,7 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, case GL_422_REV_AVERAGE_EXT: case GL_DEPTH_STENCIL_NV: case GL_DEPTH_STENCIL_MESA: + case GL_YCBCR_422_APPLE: case GL_YCBCR_MESA: case GL_LUMINANCE_ALPHA: elementsPerGroup = 2; diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index bc1509b35..1e444f048 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -833,8 +833,8 @@ void AbortDDX(enum ExitCode error) } } -#ifdef DDXBEFORERESET -void ddxBeforeReset(void) +#ifdef DDXMAIN +void ddxMain(void) { } #endif diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 31ed50533..52c0d6ae2 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -223,10 +223,10 @@ OsVendorFatalError(void) { } -#if defined(DDXBEFORERESET) -void ddxBeforeReset(void) +#ifdef DDXMAIN +void +ddxMain(void) { - return; } #endif diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c index af57518ba..f6e27c5c5 100644 --- a/hw/xnest/Init.c +++ b/hw/xnest/Init.c @@ -143,9 +143,8 @@ void OsVendorFatalError(void) return; } -#if defined(DDXBEFORERESET) -void ddxBeforeReset(void) +#ifdef DDXMAIN +void ddxMain(void) { - return; } #endif diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 1695ab8eb..a88b8fb37 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -55,6 +55,7 @@ typedef WINAPI HRESULT (*SHGETFOLDERPATHPROC)( LPTSTR pszPath ); #endif +#include "ddxhooks.h" /* * References to external symbols @@ -163,13 +164,12 @@ ddxPushProviders(void) #endif } -#if defined(DDXBEFORERESET) /* * Called right before KillAllClients when the server is going to reset, * allows us to shutdown our seperate threads cleanly. */ -void +static void ddxBeforeReset (void) { winDebug ("ddxBeforeReset - Hello\n"); @@ -178,13 +178,16 @@ ddxBeforeReset (void) winClipboardShutdown (); #endif } -#endif void ddxMain(void) { int iReturn; + /* Initialize DDX-specific hooks */ + ddxHooks.ddxBeforeReset = ddxBeforeReset; + ddxHooks.ddxPushProviders = ddxPushProviders; + /* Create & acquire the termination mutex */ iReturn = pthread_mutex_init (&g_pmTerminating, NULL); if (iReturn != 0) diff --git a/hw/xwin/glx/winpriv.c b/hw/xwin/glx/winpriv.c index 460973730..72d65bc14 100644 --- a/hw/xwin/glx/winpriv.c +++ b/hw/xwin/glx/winpriv.c @@ -13,6 +13,40 @@ void winCreateWindowsWindow (WindowPtr pWin); + +static +void +winCreateWindowsWindowHierarchy(WindowPtr pWin) +{ + winWindowPriv(pWin); + + winDebug("winCreateWindowsWindowHierarchy - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id); + + /* recursively ensure parent window exists if it's not the root window */ + if (pWin->parent) + { + if (pWin->parent != pWin->drawable.pScreen->root) + winCreateWindowsWindowHierarchy(pWin->parent); + } + + /* ensure this window exists */ + if (pWinPriv->hWnd == NULL) + { + winCreateWindowsWindow(pWin); + + /* ... and if it's already been mapped, make sure it's visible */ + if (pWin->mapped) + { + /* Display the window without activating it */ + if (pWin->drawable.class != InputOnly) + ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE); + + /* Send first paint message */ + UpdateWindow (pWinPriv->hWnd); + } + } +} + /** * Return size and handles of a window. * If pWin is NULL, then the information for the root window is requested. @@ -53,8 +87,8 @@ HWND winGetWindowInfo(WindowPtr pWin) if (pWinPriv->hWnd == NULL) { - winCreateWindowsWindow(pWin); - ErrorF("winGetWindowInfo: forcing window to exist...\n"); + ErrorF("winGetWindowInfo: forcing window to exist\n"); + winCreateWindowsWindowHierarchy(pWin); } if (pWinPriv->hWnd != NULL) diff --git a/hw/xwin/win.h b/hw/xwin/win.h index b0ce366b5..3522ee4f8 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -1319,6 +1319,9 @@ winAdjustXWindow (WindowPtr pWin, HWND hwnd); LRESULT CALLBACK winTopLevelWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK +winChildWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam); #endif diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 2329d163e..3635931b2 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -55,10 +55,27 @@ winUpdateWindowsWindow (WindowPtr pWin); static void winFindWindow (pointer value, XID id, pointer cdata); +static Bool +isToplevelWindow(WindowPtr pWin) +{ + assert(pWin->parent); /* root window isn't expected here */ + + /* If the immediate parent is the root window, this is a top-level window */ + if ((pWin->parent) && (pWin->parent->parent == NULL)) + { + assert(pWin->parent == pWin->drawable.pScreen->root); + return TRUE; + } + + /* otherwise, a child window */ + return FALSE; +} + static void winInitMultiWindowClass(void) { static wATOM atomXWinClass=0; + static wATOM atomXWinChildClass = 0; WNDCLASSEX wcx; if (atomXWinClass==0) @@ -78,11 +95,34 @@ void winInitMultiWindowClass(void) wcx.hIconSm = g_hSmallIconX; #if CYGMULTIWINDOW_DEBUG - ErrorF ("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X); + ErrorF ("winInitMultiWindowClass - Creating class: %s\n", WINDOW_CLASS_X); #endif atomXWinClass = RegisterClassEx (&wcx); } + + if (atomXWinChildClass==0) + { + /* Setup our window class */ + wcx.cbSize=sizeof(WNDCLASSEX); + wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0); + wcx.lpfnWndProc = winChildWindowProc; + wcx.cbClsExtra = 0; + wcx.cbWndExtra = 0; + wcx.hInstance = g_hInstance; + wcx.hIcon = g_hIconX; + wcx.hCursor = 0; + wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); + wcx.lpszMenuName = NULL; + wcx.lpszClassName = WINDOW_CLASS_X_CHILD; + wcx.hIconSm = g_hSmallIconX; + +#if CYGMULTIWINDOW_DEBUG + ErrorF ("winInitMultiWindowClass - Creating class: %s\n", WINDOW_CLASS_X_CHILD); +#endif + + atomXWinChildClass = RegisterClassEx (&wcx); + } } /* @@ -197,6 +237,30 @@ winPositionWindowMultiWindow (WindowPtr pWin, int x, int y) return fResult; } + if (!isToplevelWindow(pWin)) + { + POINT parentOrigin; + + /* Get the X and Y location of the X window */ + iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN); + iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN); + + /* Get the height and width of the X window */ + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + /* Convert screen coordinates into client area co-ordinates of the parent */ + parentOrigin.x = 0; + parentOrigin.y = 0; + ClientToScreen(GetParent(hWnd), &parentOrigin); + + MoveWindow (hWnd, + iX - parentOrigin.x, iY - parentOrigin.y, iWidth, iHeight, + TRUE); + + return fResult; + } + /* Get the Windows window style and extended style */ dwExStyle = GetWindowLongPtr (hWnd, GWL_EXSTYLE); dwStyle = GetWindowLongPtr (hWnd, GWL_STYLE); @@ -476,13 +540,8 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib) #endif } - -/* - * winCreateWindowsWindow - Create a Windows window associated with an X window - */ - -void -winCreateWindowsWindow (WindowPtr pWin) +static void +winCreateWindowsTopLevelWindow (WindowPtr pWin) { int iX, iY; int iWidth; @@ -519,7 +578,7 @@ winCreateWindowsWindow (WindowPtr pWin) iY = CW_USEDEFAULT; } - winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); + winDebug("winCreateWindowsTopLevelWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); if (winMultiWindowGetTransientFor (pWin, &pDaddy)) { @@ -542,7 +601,10 @@ winCreateWindowsWindow (WindowPtr pWin) } } - /* Make it WS_OVERLAPPED in create call since WS_POPUP doesn't support */ + winDebug("winCreateWindowsTopLevelWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); + + /* Create the window */ + /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */ /* CW_USEDEFAULT, change back to popup after creation */ dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; dwExStyle = WS_EX_TOOLWINDOW; @@ -578,11 +640,13 @@ winCreateWindowsWindow (WindowPtr pWin) pWin); /* ScreenPrivates */ if (hWnd == NULL) { - ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n", + ErrorF ("winCreateWindowsTopLevelWindow - CreateWindowExA () failed: %d\n", (int) GetLastError ()); } pWinPriv->hWnd = hWnd; + winDebug("winCreateWindowsTopLevelWindow - hwnd 0x%08x\n", hWnd); + /* Set application or .XWinrc defined Icons */ winSelectIcons(pWin, &hIcon, &hIconSmall); if (hIcon) SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon); @@ -611,6 +675,104 @@ winCreateWindowsWindow (WindowPtr pWin) (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin); } +static void +winCreateWindowsChildWindow(WindowPtr pWin) +{ + int iX, iY, iWidth, iHeight; + HWND hWnd; + WindowPtr pParent = pWin->parent; + DWORD dwStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED; + DWORD dwExStyle = WS_EX_TRANSPARENT; + /* + WS_DISABLED means child window never gains the input focus, so only the + top-level window needs deal with passing input to the X server + + WS_EX_TRANSPARENT ensures that the contents of the top-level + Windows window (which will contain all non-OpenGL drawing for the hierarchy) + can be seen through any intermediate child windows which have nothing + drawn to them + */ + winPrivWinPtr pParentPriv, pWinPriv; + + winDebug("winCreateWindowsChildWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id); + + winInitMultiWindowClass(); + + assert(pParent); + + pParentPriv = winGetWindowPriv(pParent); + pWinPriv = winGetWindowPriv(pWin); + + iX = pWin->drawable.x - pParent->drawable.x; + iY = pWin->drawable.y - pParent->drawable.y; + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + winDebug("winCreateWindowsChildWindow - parent pWin:%08x XID:0x%08x hWnd:0x%08x\n", pParent, pParent->drawable.id, pParentPriv->hWnd); + winDebug("winCreateWindowsChildWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); + + /* Create the window */ + hWnd = CreateWindowExA (dwExStyle, /* Extended styles */ + WINDOW_CLASS_X_CHILD, /* Class name */ + WINDOW_TITLE_X, /* Window name */ + dwStyle, /* Styles */ + iX, /* Horizontal position */ + iY, /* Vertical position */ + iWidth, /* Right edge */ + iHeight, /* Bottom edge */ + pParentPriv->hWnd, /* parent window */ + (HMENU) NULL, /* No menu */ + GetModuleHandle(NULL),/* Instance handle */ + pWin); /* ScreenPrivates */ + if (hWnd == NULL) + { + ErrorF ("winCreateWindowsChildWindow - CreateWindowExA () failed: %d\n", + (int) GetLastError ()); + } + winDebug("winCreateWindowsChildWindow - hwnd 0x%08x\n", hWnd); + pWinPriv->hWnd = hWnd; + + SetProp(hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin)); +} + +/* + * winCreateWindowsWindow - Create a Windows window associated with an X window + */ + +void +winCreateWindowsWindow (WindowPtr pWin) +{ + winDebug("winCreateWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id); + + if (isToplevelWindow(pWin)) + { + winCreateWindowsTopLevelWindow(pWin); + } + else + { + winCreateWindowsChildWindow(pWin); + } +} + +static int +winDestroyChildWindowsWindow(WindowPtr pWin, pointer data) +{ + winWindowPriv(pWin); + + winDebug("winDestroyChildWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id); + + SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL); + + /* Null our handle to the Window so referencing it will cause an error */ + pWinPriv->hWnd = NULL; + +#ifdef XWIN_GLX_WINDOWS + /* No longer note WGL used on this window */ + pWinPriv->fWglUsed = FALSE; +#endif + + return WT_WALKCHILDREN; /* continue enumeration */ +} Bool winInDestroyWindowsWindow = FALSE; /* @@ -625,6 +787,7 @@ winDestroyWindowsWindow (WindowPtr pWin) BOOL oldstate = winInDestroyWindowsWindow; HICON hIcon; HICON hIconSm; + HWND hWnd; winDebug("winDestroyWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id); @@ -638,23 +801,20 @@ winDestroyWindowsWindow (WindowPtr pWin) hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0); hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0); - SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL); + hWnd = pWinPriv->hWnd; - /* Destroy the Windows window */ - DestroyWindow (pWinPriv->hWnd); + /* DestroyWindow() implicitly destroys all child windows, + so first walk over the child tree of this window, clearing + any hWnds */ + TraverseTree(pWin, winDestroyChildWindowsWindow, 0); - /* Null our handle to the Window so referencing it will cause an error */ - pWinPriv->hWnd = NULL; + /* Destroy the Windows window */ + DestroyWindow (hWnd); /* Destroy any icons we created for this window */ winDestroyIcon(hIcon); winDestroyIcon(hIconSm); -#ifdef XWIN_GLX_WINDOWS - /* No longer note WGL used on this window */ - pWinPriv->fWglUsed = FALSE; -#endif - /* Process all messages on our queue */ while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { @@ -679,36 +839,64 @@ static void winUpdateWindowsWindow (WindowPtr pWin) { winWindowPriv(pWin); - HWND hWnd = pWinPriv->hWnd; #if CYGMULTIWINDOW_DEBUG ErrorF ("winUpdateWindowsWindow\n"); #endif - /* Check if the Windows window's parents have been destroyed */ - if (pWin->parent != NULL - && pWin->parent->parent == NULL - && pWin->mapped) - { - /* Create the Windows window if it has been destroyed */ - if (hWnd == NULL) - { - winCreateWindowsWindow (pWin); - assert (pWinPriv->hWnd != NULL); - } - /* Display the window without activating it */ - if (pWin->drawable.class != InputOnly) - ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE); + /* Ignore the root window */ + if (pWin->parent == NULL) + return; - /* Send first paint message */ - UpdateWindow (pWinPriv->hWnd); + /* If it's mapped */ + if (pWin->mapped) + { + /* If it's a top-level window */ + if (isToplevelWindow(pWin)) + { + /* Create the Windows window if needed */ + if (pWinPriv->hWnd == NULL) + { + winCreateWindowsWindow (pWin); + assert (pWinPriv->hWnd != NULL); + } + + /* Display the window without activating it */ + if (pWin->drawable.class != InputOnly) + ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE); + + } + /* It's not a top-level window, but we created a window for GLX */ + else if (pWinPriv->hWnd) + { + winPrivWinPtr pParentPriv = winGetWindowPriv(pWin->parent); + + /* XXX: This really belongs in winReparentWindow ??? */ + /* XXX: this assumes parent window has been made to exist */ + assert(pParentPriv->hWnd); + + /* Ensure we have the correct parent and position if reparented */ + SetParent(pWinPriv->hWnd, pParentPriv->hWnd); + SetWindowPos(pWinPriv->hWnd, NULL, pWin->drawable.x - pWin->parent->drawable.x, pWin->drawable.y - pWin->parent->drawable.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); + } + + /* If it's top level, or a GLX window which has already been created getting mapped, show it */ + if (pWinPriv->hWnd != NULL) + { + /* Display the window without activating it */ + if (pWin->drawable.class != InputOnly) + ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE); + + /* Send first paint message */ + UpdateWindow (pWinPriv->hWnd); + } } - else if (hWnd != NULL) + else if (pWinPriv->hWnd != NULL) { - /* Destroy the Windows window if its parents are destroyed */ + /* If it's been reparented to an unmapped window when previously mapped, destroy the Windows window */ winDestroyWindowsWindow (pWin); - assert (pWinPriv->hWnd == NULL); + assert(pWinPriv->hWnd == NULL); } #if CYGMULTIWINDOW_DEBUG @@ -956,6 +1144,14 @@ winAdjustXWindow (WindowPtr pWin, HWND hwnd) ErrorF ("winAdjustXWindow\n"); #endif + if (!isToplevelWindow(pWin)) + { +#if 1 + ErrorF ("winAdjustXWindow - immediately return because not a top-level window\n"); +#endif + return 0; + } + if (IsIconic (hwnd)) { #if CYGWINDOWING_DEBUG diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 454dd5fa9..22346a44b 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -1151,3 +1151,42 @@ winTopLevelWindowProc (HWND hwnd, UINT message, winReorderWindowsMultiWindow(); return ret; } + +/* + * winChildWindowProc - Window procedure for all top-level Windows windows. + */ + +LRESULT CALLBACK +winChildWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ +#if CYGDEBUG + winDebugWin32Message("winChildWindowProc", hwnd, message, wParam, lParam); +#endif + + switch (message) + { + case WM_ERASEBKGND: + return TRUE; + + case WM_PAINT: + /* + We don't have the bits to draw into the window, they went straight into the OpenGL + surface + + XXX: For now, just leave it alone, but ideally we want to send an expose event to + the window so it really redraws the affected region... + */ + { + PAINTSTRUCT ps; + HDC hdcUpdate; + hdcUpdate = BeginPaint(hwnd, &ps); + ValidateRect(hwnd, &(ps.rcPaint)); + EndPaint(hwnd, &ps); + return 0; + } + /* XXX: this is exactly what DefWindowProc does? */ + } + + return DefWindowProc (hwnd, message, wParam, lParam); +} diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c index 8f9917a7b..9a88306c8 100644 --- a/hw/xwin/winwin32rootless.c +++ b/hw/xwin/winwin32rootless.c @@ -283,7 +283,7 @@ winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen, strcat (pszClass, pszWindowID); #if CYGMULTIWINDOW_DEBUG - winDebug ("winCreateWindowsWindow - Creating class: %s\n", pszClass); + winDebug ("winMWExtWMCreateFrame - Creating class: %s\n", pszClass); #endif /* Setup our window class */ diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index edab40773..b8bd02fe2 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -50,6 +50,7 @@ #define WIN_SCR_PROP "cyg_screen_prop rl" #define WINDOW_CLASS_X "cygwin/x X rl" #define WINDOW_CLASS_X_MSG "cygwin/x X msg" +#define WINDOW_CLASS_X_CHILD "cygwin/x X child" #define WINDOW_TITLE_X PROJECT_NAME " X" #define WIN_WINDOW_PROP "cyg_window_prop_rl" #ifdef HAS_DEVWINDOWS diff --git a/include/ddxhooks.h b/include/ddxhooks.h new file mode 100644 index 000000000..c67f9e05b --- /dev/null +++ b/include/ddxhooks.h @@ -0,0 +1,37 @@ +/* + Copyright © 2009 Jon TURNEY + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef DDXHOOKS_H +#define DDXHOOKS_H + +struct _DdxHooks +{ + void (*ddxBeforeReset)(void); + void (*ddxPushProviders)(void); +}; + +typedef struct _DdxHooks DdxHooks; + +extern DdxHooks ddxHooks; + +#endif /* DDXHOOKS_H */ diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 4710ef881..351b1fe8a 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -33,8 +33,8 @@ /* Use OsVendorVErrorF */ #undef DDXOSVERRORF -/* Use ddxBeforeReset */ -#undef DDXBEFORERESET +/* Use ddxMain */ +#undef DDXMAIN /* Build DPMS extension */ #undef DPMSExtension diff --git a/include/os.h b/include/os.h index 6b2e2baad..8aa11ff8a 100644 --- a/include/os.h +++ b/include/os.h @@ -84,9 +84,7 @@ typedef struct _NewClientRec *NewClientPtr; #include <stdio.h> #include <stdarg.h> -#ifdef DDXBEFORERESET -extern void ddxBeforeReset (void); -#endif +extern void ddxMain(void); #ifdef DDXOSVERRORF extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args); diff --git a/mi/miinitext.c b/mi/miinitext.c index 4499f377c..2605e00d4 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -93,6 +93,7 @@ SOFTWARE. #include "extension.h" #include "micmap.h" #include "globals.h" +#include "ddxhooks.h" extern Bool noTestExtensions; @@ -467,7 +468,15 @@ InitExtensions(int argc, char *argv[]) #ifdef GLXEXT if (serverGeneration == 1) - GlxPushProvider(&__glXDRISWRastProvider); + { + GlxPushProvider(&__glXDRISWRastProvider); + + if (ddxHooks.ddxPushProviders) + { + /* a chance for DDX to install providers better than swrast... */ + ddxHooks.ddxPushProviders(); + } + } if (!noGlxExtension) GlxExtensionInit(); #endif } |