diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/hw/xwin/wincreatewnd.c | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2 vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/Xext/shm.c
xorg-server/Xext/syncsrv.h
xorg-server/Xext/xvmain.c
xorg-server/Xi/exevents.c
xorg-server/Xi/opendev.c
xorg-server/composite/compalloc.c
xorg-server/composite/compoverlay.c
xorg-server/dix/colormap.c
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/gc.c
xorg-server/dix/getevents.c
xorg-server/dix/main.c
xorg-server/dix/privates.c
xorg-server/dix/registry.c
xorg-server/dix/resource.c
xorg-server/exa/exa_accel.c
xorg-server/exa/exa_migration_classic.c
xorg-server/exa/exa_unaccel.c
xorg-server/fb/fb.h
xorg-server/fb/fbcopy.c
xorg-server/fb/fbpixmap.c
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.h
xorg-server/glx/glapi_gentable.c
xorg-server/glx/glapitable.h
xorg-server/glx/glprocs.h
xorg-server/glx/glxcmds.c
xorg-server/glx/glxcmdsswap.c
xorg-server/glx/glxdricommon.c
xorg-server/glx/glxdriswrast.c
xorg-server/glx/glxext.c
xorg-server/glx/indirect_dispatch.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_dispatch_swap.c
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/glx/indirect_util.c
xorg-server/glx/rensize.c
xorg-server/glx/single2swap.c
xorg-server/glx/singlepix.c
xorg-server/glx/singlepixswap.c
xorg-server/glx/singlesize.c
xorg-server/hw/dmx/dmxinit.c
xorg-server/hw/kdrive/ephyr/ephyr.c
xorg-server/hw/kdrive/ephyr/hostx.c
xorg-server/hw/kdrive/ephyr/hostx.h
xorg-server/hw/kdrive/src/kinput.c
xorg-server/hw/xfree86/common/compiler.h
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glwrap.c
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/glx/wgl_ext_api.h
xorg-server/hw/xwin/glx/winpriv.c
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winallpriv.c
xorg-server/hw/xwin/winauth.c
xorg-server/hw/xwin/winclipboard.h
xorg-server/hw/xwin/winclipboardinit.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardunicode.c
xorg-server/hw/xwin/winclipboardwndproc.c
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/wincmap.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/wingetsp.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winkeybd.h
xorg-server/hw/xwin/winlayouts.h
xorg-server/hw/xwin/winmisc.c
xorg-server/hw/xwin/winmonitors.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winmsg.h
xorg-server/hw/xwin/winmultiwindowclass.c
xorg-server/hw/xwin/winmultiwindowicons.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winnativegdi.c
xorg-server/hw/xwin/winpfbdd.c
xorg-server/hw/xwin/winpixmap.c
xorg-server/hw/xwin/winpolyline.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winregistry.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winshaddd.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwin32rootlesswindow.c
xorg-server/hw/xwin/winwin32rootlesswndproc.c
xorg-server/hw/xwin/winwindow.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/include/callback.h
xorg-server/include/dixstruct.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/scrnintstr.h
xorg-server/mi/micmap.c
xorg-server/mi/miinitext.c
xorg-server/mi/mioverlay.c
xorg-server/mi/misprite.c
xorg-server/mi/mivaltree.c
xorg-server/mi/miwindow.c
xorg-server/miext/damage/damage.c
xorg-server/miext/rootless/rootlessGC.c
xorg-server/miext/rootless/rootlessWindow.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/osinit.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/os/xprintf.c
xorg-server/os/xstrans.c
xorg-server/render/mipict.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/hw/xwin/wincreatewnd.c')
-rw-r--r-- | xorg-server/hw/xwin/wincreatewnd.c | 850 |
1 files changed, 408 insertions, 442 deletions
diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c index 9b5b2f78f..0580421ae 100644 --- a/xorg-server/hw/xwin/wincreatewnd.c +++ b/xorg-server/hw/xwin/wincreatewnd.c @@ -39,481 +39,455 @@ */ static Bool -winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo); + winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo); static Bool -winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo); - + winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo); /* * Create a full screen window */ Bool -winCreateBoundingWindowFullScreen (ScreenPtr pScreen) +winCreateBoundingWindowFullScreen(ScreenPtr pScreen) { - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - int iX = pScreenInfo->dwInitialX; - int iY = pScreenInfo->dwInitialY; - int iWidth = pScreenInfo->dwWidth; - int iHeight = pScreenInfo->dwHeight; - HWND *phwnd = &pScreenPriv->hwndScreen; - WNDCLASSEX wc; - char szTitle[256]; + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int iX = pScreenInfo->dwInitialX; + int iY = pScreenInfo->dwInitialY; + int iWidth = pScreenInfo->dwWidth; + int iHeight = pScreenInfo->dwHeight; + HWND *phwnd = &pScreenPriv->hwndScreen; + WNDCLASSEX wc; + char szTitle[256]; char HostName[256]; gethostname(HostName,256); - winDebug ("winCreateBoundingWindowFullScreen\n"); - - /* Setup our window class */ - wc.cbSize=sizeof(WNDCLASSEX); - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = winWindowProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = g_hInstance; - wc.hIcon = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); - wc.hCursor = 0; - wc.hbrBackground = 0; - wc.lpszMenuName = NULL; - wc.lpszClassName = WINDOW_CLASS; - wc.hIconSm = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); - RegisterClassEx (&wc); - - /* Set display and screen-specific tooltip text */ - if (g_pszQueryHost != NULL) - snprintf (szTitle, - sizeof (szTitle), - WINDOW_TITLE_XDMCP, - g_pszQueryHost, - HostName, - display, - (int) pScreenInfo->dwScreen); - else + winDebug("winCreateBoundingWindowFullScreen\n"); + + /* Setup our window class */ + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = g_hInstance; + wc.hIcon = + (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXICON), + GetSystemMetrics(SM_CYICON), 0); + wc.hCursor = 0; + wc.hbrBackground = 0; + wc.lpszMenuName = NULL; + wc.lpszClassName = WINDOW_CLASS; + wc.hIconSm = + (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); + RegisterClassEx(&wc); + + /* Set display and screen-specific tooltip text */ + if (g_pszQueryHost != NULL) + snprintf(szTitle, + sizeof(szTitle), + WINDOW_TITLE_XDMCP, + g_pszQueryHost, HostName, display, (int) pScreenInfo->dwScreen); + else { - snprintf (szTitle, - sizeof (szTitle), - WINDOW_TITLE, - HostName, - display, - (int) pScreenInfo->dwScreen); + snprintf(szTitle, + sizeof(szTitle), + WINDOW_TITLE, HostName, display, (int) pScreenInfo->dwScreen); } - /* Create the window */ - *phwnd = CreateWindowExA (0, /* Extended styles */ - WINDOW_CLASS, /* Class name */ - szTitle, /* Window name */ - WS_POPUP, - iX, /* Horizontal position */ - iY, /* Vertical position */ - iWidth, /* Right edge */ - iHeight, /* Bottom edge */ - (HWND) NULL, /* No parent or owner window */ - (HMENU) NULL, /* No menu */ - GetModuleHandle (NULL),/* Instance handle */ - pScreenPriv); /* ScreenPrivates */ - - /* Branch on the server engine */ - switch (pScreenInfo->dwEngine) - { + /* Create the window */ + *phwnd = CreateWindowExA(0, /* Extended styles */ + WINDOW_CLASS, /* Class name */ + szTitle, /* Window name */ + WS_POPUP, iX, /* Horizontal position */ + iY, /* Vertical position */ + iWidth, /* Right edge */ + iHeight, /* Bottom edge */ + (HWND) NULL, /* No parent or owner window */ + (HMENU) NULL, /* No menu */ + GetModuleHandle(NULL), /* Instance handle */ + pScreenPriv); /* ScreenPrivates */ + + /* Branch on the server engine */ + switch (pScreenInfo->dwEngine) { #ifdef XWIN_NATIVEGDI case WIN_SERVER_SHADOW_GDI: - /* Show the window */ - ShowWindow (*phwnd, SW_SHOWMAXIMIZED); - break; + /* Show the window */ + ShowWindow(*phwnd, SW_SHOWMAXIMIZED); + break; #endif default: - /* Hide the window */ - ShowWindow (*phwnd, SW_SHOWNORMAL); - break; + /* Hide the window */ + ShowWindow(*phwnd, SW_SHOWNORMAL); + break; } - /* Send first paint message */ - UpdateWindow (*phwnd); + /* Send first paint message */ + UpdateWindow(*phwnd); - /* Attempt to bring our window to the top of the display */ - BringWindowToTop (*phwnd); + /* Attempt to bring our window to the top of the display */ + BringWindowToTop(*phwnd); - return TRUE; + return TRUE; } - /* * Create our primary Windows display window */ Bool -winCreateBoundingWindowWindowed (ScreenPtr pScreen) +winCreateBoundingWindowWindowed(ScreenPtr pScreen) { - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - int iWidth = pScreenInfo->dwUserWidth; - int iHeight = pScreenInfo->dwUserHeight; - int iPosX; - int iPosY; - HWND *phwnd = &pScreenPriv->hwndScreen; - WNDCLASSEX wc; - RECT rcClient, rcWorkArea; - DWORD dwWindowStyle; - BOOL fForceShowWindow = FALSE; - char szTitle[256]; + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int iWidth = pScreenInfo->dwUserWidth; + int iHeight = pScreenInfo->dwUserHeight; + int iPosX; + int iPosY; + HWND *phwnd = &pScreenPriv->hwndScreen; + WNDCLASSEX wc; + RECT rcClient, rcWorkArea; + DWORD dwWindowStyle; + BOOL fForceShowWindow = FALSE; + char szTitle[256]; char HostName[256]; gethostname(HostName,256); - - winDebug ("winCreateBoundingWindowWindowed - User w: %d h: %d\n", - (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight); - winDebug ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n", - (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight); - /* Set the common window style flags */ - dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; - - /* Decorated or undecorated window */ - if (pScreenInfo->fDecoration + winDebug("winCreateBoundingWindowWindowed - User w: %d h: %d\n", + (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight); + winDebug("winCreateBoundingWindowWindowed - Current w: %d h: %d\n", + (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight); + + /* Set the common window style flags */ + dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; + + /* Decorated or undecorated window */ + if (pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM - && !pScreenInfo->fMWExtWM + && !pScreenInfo->fMWExtWM #endif - && !pScreenInfo->fRootless + && !pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOW - && !pScreenInfo->fMultiWindow + && !pScreenInfo->fMultiWindow #endif - ) - { + ) { /* Try to handle startup via run.exe. run.exe instructs Windows to * hide all created windows. Detect this case and make sure the * window is shown nevertheless */ - STARTUPINFO startupInfo; + STARTUPINFO startupInfo; + GetStartupInfo(&startupInfo); - if (startupInfo.dwFlags & STARTF_USESHOWWINDOW && - startupInfo.wShowWindow == SW_HIDE) - { - fForceShowWindow = TRUE; - } + if (startupInfo.dwFlags & STARTF_USESHOWWINDOW && + startupInfo.wShowWindow == SW_HIDE) { + fForceShowWindow = TRUE; + } dwWindowStyle |= WS_CAPTION; if (pScreenInfo->iResizeMode != notAllowed) dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX; } - else - dwWindowStyle |= WS_POPUP; - - /* Setup our window class */ - wc.cbSize=sizeof(WNDCLASSEX); - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = winWindowProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = g_hInstance; - wc.hIcon = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); - wc.hCursor = 0; - wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); - wc.lpszMenuName = NULL; - wc.lpszClassName = WINDOW_CLASS; - wc.hIconSm = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); - RegisterClassEx (&wc); - - /* Get size of work area */ - winGetWorkArea (&rcWorkArea, pScreenInfo); - - /* Adjust for auto-hide taskbars */ - winAdjustForAutoHide (&rcWorkArea, pScreenInfo); - - /* Did the user specify a position? */ - if (pScreenInfo->fUserGavePosition) - { - iPosX = pScreenInfo->dwInitialX; - iPosY = pScreenInfo->dwInitialY; + else + dwWindowStyle |= WS_POPUP; + + /* Setup our window class */ + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = g_hInstance; + wc.hIcon = + (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXICON), + GetSystemMetrics(SM_CYICON), 0); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = WINDOW_CLASS; + wc.hIconSm = + (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); + RegisterClassEx(&wc); + + /* Get size of work area */ + winGetWorkArea(&rcWorkArea, pScreenInfo); + + /* Adjust for auto-hide taskbars */ + winAdjustForAutoHide (&rcWorkArea, pScreenInfo); + + /* Did the user specify a position? */ + if (pScreenInfo->fUserGavePosition) { + iPosX = pScreenInfo->dwInitialX; + iPosY = pScreenInfo->dwInitialY; } - else - { - iPosX = rcWorkArea.left; - iPosY = rcWorkArea.top; + else { + iPosX = rcWorkArea.left; + iPosY = rcWorkArea.top; } - /* Clean up the scrollbars flag, if necessary */ - if ((!pScreenInfo->fDecoration + /* Clean up the scrollbars flag, if necessary */ + if ((!pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM - || pScreenInfo->fMWExtWM + || pScreenInfo->fMWExtWM #endif - || pScreenInfo->fRootless + || pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOW - || pScreenInfo->fMultiWindow + || pScreenInfo->fMultiWindow #endif - ) - && (pScreenInfo->iResizeMode == resizeWithScrollbars)) - { - /* We cannot have scrollbars if we do not have a window border */ - pScreenInfo->iResizeMode = notAllowed; + ) + && (pScreenInfo->iResizeMode == resizeWithScrollbars)) { + /* We cannot have scrollbars if we do not have a window border */ + pScreenInfo->iResizeMode = notAllowed; } - /* Did the user specify a height and width? */ - if (pScreenInfo->fUserGaveHeightAndWidth) - { - /* User gave a desired height and width, try to accomodate */ - winDebug ("winCreateBoundingWindowWindowed - User gave height " - "and width\n"); - - /* Adjust the window width and height for borders and title bar */ - if (pScreenInfo->fDecoration + /* Did the user specify a height and width? */ + if (pScreenInfo->fUserGaveHeightAndWidth) { + /* User gave a desired height and width, try to accomodate */ + winDebug("winCreateBoundingWindowWindowed - User gave height " + "and width\n"); + + /* Adjust the window width and height for borders and title bar */ + if (pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM - && !pScreenInfo->fMWExtWM + && !pScreenInfo->fMWExtWM #endif - && !pScreenInfo->fRootless + && !pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOW - && !pScreenInfo->fMultiWindow + && !pScreenInfo->fMultiWindow #endif - ) - { - winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n"); - - /* Are we resizable */ - if (pScreenInfo->iResizeMode != notAllowed) - { - winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n"); - - iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME); - iHeight += 2 * GetSystemMetrics (SM_CYSIZEFRAME) - + GetSystemMetrics (SM_CYCAPTION); - } - else - { - winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n"); - - iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME); - iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME) - + GetSystemMetrics (SM_CYCAPTION); - } - } + ) { + winDebug + ("winCreateBoundingWindowWindowed - Window has decoration\n"); + + /* Are we resizable */ + if (pScreenInfo->iResizeMode != notAllowed) { + winDebug + ("winCreateBoundingWindowWindowed - Window is resizable\n"); + + iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME); + iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME) + + GetSystemMetrics(SM_CYCAPTION); + } + else { + winDebug + ("winCreateBoundingWindowWindowed - Window is not resizable\n"); + + iWidth += 2 * GetSystemMetrics(SM_CXFIXEDFRAME); + iHeight += 2 * GetSystemMetrics(SM_CYFIXEDFRAME) + + GetSystemMetrics(SM_CYCAPTION); + } + } } - else - { - /* By default, we are creating a window that is as large as possible */ - winDebug ("winCreateBoundingWindowWindowed - User did not give " - "height and width\n"); - /* Defaults are wrong if we have multiple monitors */ - if (pScreenInfo->fMultipleMonitors) - { - iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); - iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); - } + else { + /* By default, we are creating a window that is as large as possible */ + winDebug("winCreateBoundingWindowWindowed - User did not give " + "height and width\n"); + /* Defaults are wrong if we have multiple monitors */ + if (pScreenInfo->fMultipleMonitors) { + iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); + iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); + } } - /* Make sure window is no bigger than work area */ - if (TRUE + /* Make sure window is no bigger than work area */ + if (TRUE #ifdef XWIN_MULTIWINDOWEXTWM - && !pScreenInfo->fMWExtWM + && !pScreenInfo->fMWExtWM #endif #ifdef XWIN_MULTIWINDOW - && !pScreenInfo->fMultiWindow + && !pScreenInfo->fMultiWindow #endif - ) - { - /* Trim window width to fit work area */ - if (iWidth > (rcWorkArea.right - rcWorkArea.left)) - iWidth = rcWorkArea.right - rcWorkArea.left; - - /* Trim window height to fit work area */ - if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) - iHeight = rcWorkArea.bottom - rcWorkArea.top; - - winDebug ("winCreateBoundingWindowWindowed - Adjusted width: %d "\ - "height: %d\n", - iWidth, iHeight); + ) { + /* Trim window width to fit work area */ + if (iWidth > (rcWorkArea.right - rcWorkArea.left)) + iWidth = rcWorkArea.right - rcWorkArea.left; + + /* Trim window height to fit work area */ + if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) + iHeight = rcWorkArea.bottom - rcWorkArea.top; + + winDebug("winCreateBoundingWindowWindowed - Adjusted width: %d " + "height: %d\n", iWidth, iHeight); } - /* Set display and screen-specific tooltip text */ - if (g_pszQueryHost != NULL) - snprintf (szTitle, - sizeof (szTitle), - WINDOW_TITLE_XDMCP, - g_pszQueryHost, - HostName, - display, - (int) pScreenInfo->dwScreen); - else + /* Set display and screen-specific tooltip text */ + if (g_pszQueryHost != NULL) + snprintf(szTitle, + sizeof(szTitle), + WINDOW_TITLE_XDMCP, + g_pszQueryHost, HostName, display, (int) pScreenInfo->dwScreen); + else { - snprintf (szTitle, - sizeof (szTitle), - WINDOW_TITLE, - HostName, - display, - (int) pScreenInfo->dwScreen); + snprintf(szTitle, + sizeof(szTitle), + WINDOW_TITLE, HostName, display, (int) pScreenInfo->dwScreen); } - /* Create the window */ - *phwnd = CreateWindowExA (0, /* Extended styles */ - WINDOW_CLASS, /* Class name */ - szTitle, /* Window name */ - dwWindowStyle, - iPosX, /* Horizontal position */ - iPosY, /* Vertical position */ - iWidth, /* Right edge */ - iHeight, /* Bottom edge */ - (HWND) NULL, /* No parent or owner window */ - (HMENU) NULL, /* No menu */ - GetModuleHandle (NULL),/* Instance handle */ - pScreenPriv); /* ScreenPrivates */ - if (*phwnd == NULL) - { - ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n"); - return FALSE; + /* Create the window */ + *phwnd = CreateWindowExA(0, /* Extended styles */ + WINDOW_CLASS, /* Class name */ + szTitle, /* Window name */ + dwWindowStyle, iPosX, /* Horizontal position */ + iPosY, /* Vertical position */ + iWidth, /* Right edge */ + iHeight, /* Bottom edge */ + (HWND) NULL, /* No parent or owner window */ + (HMENU) NULL, /* No menu */ + GetModuleHandle(NULL), /* Instance handle */ + pScreenPriv); /* ScreenPrivates */ + if (*phwnd == NULL) { + ErrorF("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n"); + return FALSE; } - winDebug ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n"); + winDebug("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n"); - if (fForceShowWindow) - { - ErrorF("winCreateBoundingWindowWindowed - Setting normal windowstyle\n"); - ShowWindow(*phwnd, SW_SHOW); - } + if (fForceShowWindow) { + ErrorF + ("winCreateBoundingWindowWindowed - Setting normal windowstyle\n"); + ShowWindow(*phwnd, SW_SHOW); + } - /* Get the client area coordinates */ - if (!GetClientRect (*phwnd, &rcClient)) - { - ErrorF ("winCreateBoundingWindowWindowed - GetClientRect () " - "failed\n"); - return FALSE; + /* Get the client area coordinates */ + if (!GetClientRect(*phwnd, &rcClient)) { + ErrorF("winCreateBoundingWindowWindowed - GetClientRect () " + "failed\n"); + return FALSE; } - winDebug ("winCreateBoundingWindowWindowed - WindowClient " - "w %ld h %ld r %ld l %ld b %ld t %ld\n", - rcClient.right - rcClient.left, - rcClient.bottom - rcClient.top, - rcClient.right, rcClient.left, - rcClient.bottom, rcClient.top); - - /* We adjust the visual size if the user did not specify it */ - if (!((pScreenInfo->iResizeMode == resizeWithScrollbars) && pScreenInfo->fUserGaveHeightAndWidth)) - { - /* - * User did not give a height and width with scrollbars enabled, - * so we will resize the underlying visual to be as large as - * the initial view port (page size). This way scrollbars will - * not appear until the user shrinks the window, if they ever do. - * - * NOTE: We have to store the viewport size here because - * the user may have an autohide taskbar, which would - * cause the viewport size to be one less in one dimension - * than the viewport size that we calculated by subtracting - * the size of the borders and caption. - */ - pScreenInfo->dwWidth = rcClient.right - rcClient.left; - pScreenInfo->dwHeight = rcClient.bottom - rcClient.top; + winDebug("winCreateBoundingWindowWindowed - WindowClient " + "w %ld h %ld r %ld l %ld b %ld t %ld\n", + rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top, + rcClient.right, rcClient.left, rcClient.bottom, rcClient.top); + + /* We adjust the visual size if the user did not specify it */ + if (! + ((pScreenInfo->iResizeMode == resizeWithScrollbars) && + pScreenInfo->fUserGaveHeightAndWidth)) { + /* + * User did not give a height and width with scrollbars enabled, + * so we will resize the underlying visual to be as large as + * the initial view port (page size). This way scrollbars will + * not appear until the user shrinks the window, if they ever do. + * + * NOTE: We have to store the viewport size here because + * the user may have an autohide taskbar, which would + * cause the viewport size to be one less in one dimension + * than the viewport size that we calculated by subtracting + * the size of the borders and caption. + */ + pScreenInfo->dwWidth = rcClient.right - rcClient.left; + pScreenInfo->dwHeight = rcClient.bottom - rcClient.top; } #if 0 - /* - * NOTE: For the uninitiated, the page size is the number of pixels - * that we can display in the x or y direction at a time and the - * range is the total number of pixels in the x or y direction that we - * have available to display. In other words, the page size is the - * size of the window area minus the space the caption, borders, and - * scrollbars (if any) occupy, and the range is the size of the - * underlying X visual. Notice that, contrary to what some of the - * MSDN Library arcticles lead you to believe, the windows - * ``client area'' size does not include the scrollbars. In other words, - * the whole client area size that is reported to you is drawable by - * you; you do not have to subtract the size of the scrollbars from - * the client area size, and if you did it would result in the size - * of the scrollbars being double counted. - */ - - /* Setup scrollbar page and range, if scrollbars are enabled */ - if (pScreenInfo->fScrollbars) - { - SCROLLINFO si; - - /* Initialize the scrollbar info structure */ - si.cbSize = sizeof (si); - si.fMask = SIF_RANGE | SIF_PAGE; - si.nMin = 0; - - /* Setup the width range and page size */ - si.nMax = pScreenInfo->dwWidth - 1; - si.nPage = rcClient.right - rcClient.left; - winDebug ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n", - si.nMax, si.nPage); - SetScrollInfo (*phwnd, SB_HORZ, &si, TRUE); - - /* Setup the height range and page size */ - si.nMax = pScreenInfo->dwHeight - 1; - si.nPage = rcClient.bottom - rcClient.top; - winDebug ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n", - si.nMax, si.nPage); - SetScrollInfo (*phwnd, SB_VERT, &si, TRUE); + /* + * NOTE: For the uninitiated, the page size is the number of pixels + * that we can display in the x or y direction at a time and the + * range is the total number of pixels in the x or y direction that we + * have available to display. In other words, the page size is the + * size of the window area minus the space the caption, borders, and + * scrollbars (if any) occupy, and the range is the size of the + * underlying X visual. Notice that, contrary to what some of the + * MSDN Library arcticles lead you to believe, the windows + * ``client area'' size does not include the scrollbars. In other words, + * the whole client area size that is reported to you is drawable by + * you; you do not have to subtract the size of the scrollbars from + * the client area size, and if you did it would result in the size + * of the scrollbars being double counted. + */ + + /* Setup scrollbar page and range, if scrollbars are enabled */ + if (pScreenInfo->fScrollbars) { + SCROLLINFO si; + + /* Initialize the scrollbar info structure */ + si.cbSize = sizeof(si); + si.fMask = SIF_RANGE | SIF_PAGE; + si.nMin = 0; + + /* Setup the width range and page size */ + si.nMax = pScreenInfo->dwWidth - 1; + si.nPage = rcClient.right - rcClient.left; + winDebug("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n", + si.nMax, si.nPage); + SetScrollInfo(*phwnd, SB_HORZ, &si, TRUE); + + /* Setup the height range and page size */ + si.nMax = pScreenInfo->dwHeight - 1; + si.nPage = rcClient.bottom - rcClient.top; + winDebug("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n", + si.nMax, si.nPage); + SetScrollInfo(*phwnd, SB_VERT, &si, TRUE); } #endif - /* Show the window */ - if (FALSE + /* Show the window */ + if (FALSE #ifdef XWIN_MULTIWINDOWEXTWM - || pScreenInfo->fMWExtWM + || pScreenInfo->fMWExtWM #endif #ifdef XWIN_MULTIWINDOW - || pScreenInfo->fMultiWindow + || pScreenInfo->fMultiWindow #endif - ) - { + ) { #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - pScreenPriv->fRootWindowShown = FALSE; + pScreenPriv->fRootWindowShown = FALSE; #endif - ShowWindow (*phwnd, SW_HIDE); + ShowWindow(*phwnd, SW_HIDE); } - else - ShowWindow (*phwnd, SW_SHOWNORMAL); - if (!UpdateWindow (*phwnd)) - { - ErrorF ("winCreateBoundingWindowWindowed - UpdateWindow () failed\n"); - return FALSE; + else + ShowWindow(*phwnd, SW_SHOWNORMAL); + if (!UpdateWindow(*phwnd)) { + ErrorF("winCreateBoundingWindowWindowed - UpdateWindow () failed\n"); + return FALSE; } - - /* Attempt to bring our window to the top of the display */ - if (TRUE + + /* Attempt to bring our window to the top of the display */ + if (TRUE #ifdef XWIN_MULTIWINDOWEXTWM - && !pScreenInfo->fMWExtWM + && !pScreenInfo->fMWExtWM #endif - && !pScreenInfo->fRootless + && !pScreenInfo->fRootless #ifdef XWIN_MULTIWINDOW - && !pScreenInfo->fMultiWindow + && !pScreenInfo->fMultiWindow #endif - ) - { - if (!BringWindowToTop (*phwnd)) - { - ErrorF ("winCreateBoundingWindowWindowed - BringWindowToTop () " - "failed\n"); - return FALSE; - } + ) { + if (!BringWindowToTop(*phwnd)) { + ErrorF("winCreateBoundingWindowWindowed - BringWindowToTop () " + "failed\n"); + return FALSE; + } } #ifdef XWIN_NATIVEGDI - /* Paint window background blue */ - if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI) - winPaintBackground (*phwnd, RGB (0x00, 0x00, 0xFF)); + /* Paint window background blue */ + if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI) + winPaintBackground(*phwnd, RGB(0x00, 0x00, 0xFF)); #endif - winDebug ("winCreateBoundingWindowWindowed - Returning\n"); + winDebug("winCreateBoundingWindowWindowed - Returning\n"); - return TRUE; + return TRUE; } - /* * Find the work area of all attached monitors */ static Bool -winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo) +winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo) { - int iPrimaryWidth, iPrimaryHeight; - int iWidth, iHeight; - int iLeft, iTop; - int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight; + int iPrimaryWidth, iPrimaryHeight; + int iWidth, iHeight; + int iLeft, iTop; + int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight; /* Use GetMonitorInfo to get work area for monitor */ if (!pScreenInfo->fMultipleMonitors) @@ -534,62 +508,59 @@ winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo) ErrorF ("winGetWorkArea - GetMonitorInfo() failed for monitor %d\n", pScreenInfo->iMonitor); } - /* Bail out here if we aren't using multiple monitors */ - return TRUE; + /* Bail out here if we aren't using multiple monitors */ + return TRUE; } /* SPI_GETWORKAREA only gets the work area of the primary screen. */ SystemParametersInfo (SPI_GETWORKAREA, 0, prcWorkArea, 0); winDebug ("winGetWorkArea - Primary Monitor WorkArea: %d %d %d %d\n", - (int) prcWorkArea->top, (int) prcWorkArea->left, - (int) prcWorkArea->bottom, (int) prcWorkArea->right); + (int) prcWorkArea->top, (int) prcWorkArea->left, + (int) prcWorkArea->bottom, (int) prcWorkArea->right); - /* Get size of full virtual screen */ - iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); - iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + /* Get size of full virtual screen */ + iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); + iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); - winDebug ("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight); + winDebug("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight); - /* Get origin of full virtual screen */ - iLeft = GetSystemMetrics (SM_XVIRTUALSCREEN); - iTop = GetSystemMetrics (SM_YVIRTUALSCREEN); + /* Get origin of full virtual screen */ + iLeft = GetSystemMetrics(SM_XVIRTUALSCREEN); + iTop = GetSystemMetrics(SM_YVIRTUALSCREEN); - winDebug ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop); - - /* Get size of primary screen */ - iPrimaryWidth = GetSystemMetrics (SM_CXSCREEN); - iPrimaryHeight = GetSystemMetrics (SM_CYSCREEN); + winDebug("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop); - winDebug ("winGetWorkArea - Primary screen is %d x %d\n", - iPrimaryWidth, iPrimaryHeight); - - /* Work out how much of the primary screen we aren't using */ - iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right - - prcWorkArea->left); - iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom - - prcWorkArea->top); - - /* Update the rectangle to include all monitors */ - if (iLeft < 0) - { - prcWorkArea->left = iLeft; + /* Get size of primary screen */ + iPrimaryWidth = GetSystemMetrics(SM_CXSCREEN); + iPrimaryHeight = GetSystemMetrics(SM_CYSCREEN); + + winDebug("winGetWorkArea - Primary screen is %d x %d\n", + iPrimaryWidth, iPrimaryHeight); + + /* Work out how much of the primary screen we aren't using */ + iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right - + prcWorkArea->left); + iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom + - prcWorkArea->top); + + /* Update the rectangle to include all monitors */ + if (iLeft < 0) { + prcWorkArea->left = iLeft; } - if (iTop < 0) - { - prcWorkArea->top = iTop; + if (iTop < 0) { + prcWorkArea->top = iTop; } - prcWorkArea->right = prcWorkArea->left + iWidth - - iPrimaryNonWorkAreaWidth; - prcWorkArea->bottom = prcWorkArea->top + iHeight - - iPrimaryNonWorkAreaHeight; - - winDebug ("winGetWorkArea - Adjusted WorkArea for multiple " - "monitors: %d %d %d %d\n", - (int) prcWorkArea->top, (int) prcWorkArea->left, - (int) prcWorkArea->bottom, (int) prcWorkArea->right); - - return TRUE; + prcWorkArea->right = prcWorkArea->left + iWidth - iPrimaryNonWorkAreaWidth; + prcWorkArea->bottom = prcWorkArea->top + iHeight - + iPrimaryNonWorkAreaHeight; + + winDebug("winGetWorkArea - Adjusted WorkArea for multiple " + "monitors: %d %d %d %d\n", + (int) prcWorkArea->top, (int) prcWorkArea->left, + (int) prcWorkArea->bottom, (int) prcWorkArea->right); + + return TRUE; } static Bool @@ -614,7 +585,6 @@ winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo *pScreenInfo) } return FALSE; } - /* * Adjust the client area so that any auto-hide toolbars * will work correctly. @@ -623,54 +593,50 @@ winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo *pScreenInfo) static Bool winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo) { - APPBARDATA abd; + APPBARDATA abd; - winDebug ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n", - (int) prcWorkArea->top, (int) prcWorkArea->left, - (int) prcWorkArea->bottom, (int) prcWorkArea->right); + winDebug("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n", + (int) prcWorkArea->top, (int) prcWorkArea->left, + (int) prcWorkArea->bottom, (int) prcWorkArea->right); - /* Find out if the Windows taskbar is set to auto-hide */ - ZeroMemory (&abd, sizeof (abd)); - abd.cbSize = sizeof (abd); - if (SHAppBarMessage (ABM_GETSTATE, &abd) & ABS_AUTOHIDE) - winDebug ("winAdjustForAutoHide - Taskbar is auto hide\n"); + /* Find out if the Windows taskbar is set to auto-hide */ + ZeroMemory(&abd, sizeof(abd)); + abd.cbSize = sizeof(abd); + if (SHAppBarMessage(ABM_GETSTATE, &abd) & ABS_AUTOHIDE) + winDebug("winAdjustForAutoHide - Taskbar is auto hide\n"); /* Despite the forgoing, we are checking for any AppBar hiding along a monitor edge, not just the Windows TaskBar. */ - /* Look for a TOP auto-hide taskbar */ - if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo)) - { - winDebug ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n"); - prcWorkArea->top += 1; + /* Look for a TOP auto-hide taskbar */ + if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo)) { + winDebug("winAdjustForAutoHide - Found TOP auto-hide taskbar\n"); + prcWorkArea->top += 1; } - /* Look for a LEFT auto-hide taskbar */ - if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo)) - { - winDebug ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n"); - prcWorkArea->left += 1; + /* Look for a LEFT auto-hide taskbar */ + if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo)) { + winDebug("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n"); + prcWorkArea->left += 1; } - /* Look for a BOTTOM auto-hide taskbar */ - if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo)) - { - winDebug ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n"); - prcWorkArea->bottom -= 1; + /* Look for a BOTTOM auto-hide taskbar */ + if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo)) { + winDebug("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n"); + prcWorkArea->bottom -= 1; } - /* Look for a RIGHT auto-hide taskbar */ - if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo)) - { - winDebug ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n"); - prcWorkArea->right -= 1; + /* Look for a RIGHT auto-hide taskbar */ + if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo)) { + winDebug("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n"); + prcWorkArea->right -= 1; } - winDebug ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n", - (int) prcWorkArea->top, (int) prcWorkArea->left, - (int) prcWorkArea->bottom, (int) prcWorkArea->right); + winDebug("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n", + (int) prcWorkArea->top, (int) prcWorkArea->left, + (int) prcWorkArea->bottom, (int) prcWorkArea->right); - return TRUE; + return TRUE; } |