diff options
Diffstat (limited to 'xorg-server/hw/xwin/winmultiwindowwindow.c')
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwindow.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 21b818b89..2d9a46e40 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -493,6 +493,8 @@ winCreateWindowsWindow (WindowPtr pWin) winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv; WinXSizeHints hints; WindowPtr pDaddy; + DWORD dwStyle, dwExStyle; + RECT rc; winInitMultiWindowClass(); @@ -517,6 +519,8 @@ winCreateWindowsWindow (WindowPtr pWin) iY = CW_USEDEFAULT; } + winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); + if (winMultiWindowGetTransientFor (pWin, &pDaddy)) { if (pDaddy) @@ -538,16 +542,35 @@ winCreateWindowsWindow (WindowPtr pWin) } } - /* Create the window */ - /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */ + /* Make it WS_OVERLAPPED in create call since WS_POPUP doesn't support */ /* CW_USEDEFAULT, change back to popup after creation */ - hWnd = CreateWindowExA (WS_EX_TOOLWINDOW, /* Extended styles */ + dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + dwExStyle = WS_EX_TOOLWINDOW; + + /* + Calculate the window coordinates containing the requested client area, + being careful to preseve CW_USEDEFAULT + */ + rc.top = (iY != CW_USEDEFAULT) ? iY : 0; + rc.left = (iX != CW_USEDEFAULT) ? iX : 0; + rc.bottom = rc.top + iHeight; + rc.right = rc.left + iWidth; + AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle); + if (iY != CW_USEDEFAULT) iY = rc.top; + if (iX != CW_USEDEFAULT) iX = rc.left; + iHeight = rc.bottom - rc.top; + iWidth = rc.right - rc.left; + + winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY); + + /* Create the window */ + hWnd = CreateWindowExA (dwExStyle, /* Extended styles */ WINDOW_CLASS_X, /* Class name */ WINDOW_TITLE_X, /* Window name */ - WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, + dwStyle, /* Styles */ iX, /* Horizontal position */ iY, /* Vertical position */ - iWidth, /* Right edge */ + iWidth, /* Right edge */ iHeight, /* Bottom edge */ hFore, /* Null or Parent window if transient*/ (HMENU) NULL, /* No menu */ @@ -569,6 +592,10 @@ winCreateWindowsWindow (WindowPtr pWin) SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); SetWindowPos (hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + + /* Adjust the X window to match the window placement we actually got... */ + winAdjustXWindow (pWin, hWnd); + /* Make sure it gets the proper system menu for a WS_POPUP, too */ GetSystemMenu (hWnd, TRUE); |