From 65a037ffd87e7d89999a8a3d535c7a2b598b8b6c Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 11 Feb 2011 14:53:58 +0000 Subject: Solved problem of a window being created with an Y coordinate of 0x8000000. This is the cause when only as Y coordinate CW_USEDEFAULT is choosen --- xorg-server/hw/xwin/winmultiwindowwindow.c | 40 +++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'xorg-server') diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 6c7debd15..b89073fc9 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -443,14 +443,42 @@ winCreateWindowsWindow (WindowPtr pWin) iHeight = pWin->drawable.height; /* If it's an InputOutput window, and so is going to end up being made visible, - make sure the window actually ends up somewhere where it will be visible */ + make sure the window actually ends up somewhere where it will be visible + Dont't do it by making just one of the two iX and iY CW_USEDEFAULT since + this will create a window at place CW_USEDEFAULT which is 0x80000000 */ if (pWin->drawable.class != InputOnly) { - if ((iX < GetSystemMetrics (SM_XVIRTUALSCREEN)) || (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN))) - iX = CW_USEDEFAULT; + while (1) + { + if (iX < GetSystemMetrics (SM_XVIRTUALSCREEN)) + { + iX = GetSystemMetrics (SM_XVIRTUALSCREEN); + ErrorF("Resetting iX to %d\n",iX); + } + else if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN)) + { + iX = GetSystemMetrics (SM_CXVIRTUALSCREEN)-iWidth; + ErrorF("Resetting iX to %d\n",iX); + } + else + break; + } - if ((iY < GetSystemMetrics (SM_YVIRTUALSCREEN)) || (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN))) - iY = CW_USEDEFAULT; + while (1) + { + if (iY < GetSystemMetrics (SM_YVIRTUALSCREEN)) + { + iY = GetSystemMetrics (SM_YVIRTUALSCREEN); + ErrorF("Resetting iY to %d\n",iY); + } + else if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN)) + { + iY = GetSystemMetrics (SM_CYVIRTUALSCREEN)-iHeight; + ErrorF("Resetting iY to %d\n",iY); + } + else + break; + } } winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); @@ -517,7 +545,7 @@ winCreateWindowsWindow (WindowPtr pWin) if (hIconSmall) SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); /* If we asked the native WM to place the window, synchronize the X window position */ - if ((iX == CW_USEDEFAULT) || (iY == CW_USEDEFAULT)) + if (iX == CW_USEDEFAULT) winAdjustXWindow(pWin, hWnd); /* Change style back to popup, already placed... */ -- cgit v1.2.3