From 97aaa22fb796662afd3ad4052d4f7d1c5945bb70 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 20 Sep 2010 09:22:54 +0000 Subject: opengl window was not always created/moved to the correct place --- xorg-server/hw/xwin/winmultiwindowwindow.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'xorg-server/hw/xwin/winmultiwindowwindow.c') diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 44fdd8ac3..5e8c51c30 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -636,17 +636,37 @@ winUpdateWindowsWindow (WindowPtr pWin) } else if (hWnd != NULL) { - if (pWinPriv->OpenGlWindow) + if (pWinPriv->GlCtxWnd) { + /* 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(pWin->parent); - ErrorF("Window handle = %x\n",pWinPriv->hWnd); + winWindowPriv(pParent); hParentWnd=pWinPriv->hWnd; + if (hParentWnd) + break; + pParent=pParent->parent; + } + + 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,0,0,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW); + SetWindowPos(pWinPriv->hWnd,NULL,pWin->drawable.x-offsetx,pWin->drawable.y-offsety,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW); } else { -- cgit v1.2.3