diff options
Diffstat (limited to 'hw/xwin/wincreatewnd.c')
-rw-r--r-- | hw/xwin/wincreatewnd.c | 146 |
1 files changed, 94 insertions, 52 deletions
diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index 10d2273cd..7a1c6f352 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -1,5 +1,5 @@ /* - *Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. + *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -15,23 +15,25 @@ *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 XFREE86 PROJECT BE LIABLE FOR + *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II 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. * - *Except as contained in this notice, the name of the XFree86 Project + *Except as contained in this notice, the name of Harold L Hunt II *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization - *from the XFree86 Project. + *from Harold L Hunt II. * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wincreatewnd.c,v 1.4 2002/10/17 08:18:22 alanh Exp $ */ #include "win.h" #include "shellapi.h" +#ifndef ABS_AUTOHIDE +#define ABS_AUTOHIDE 1 +#endif /* * Local function prototypes @@ -60,7 +62,7 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) char szTitle[256]; #if CYGDEBUG - ErrorF ("winCreateBoundingWindowFullScreen\n"); + winDebug ("winCreateBoundingWindowFullScreen\n"); #endif /* Setup our window class */ @@ -90,7 +92,7 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) (int) pScreenInfo->dwScreen); /* Create the window */ - *phwnd = CreateWindowExA (WS_EX_TOPMOST, /* Extended styles */ + *phwnd = CreateWindowExA (0, /* Extended styles */ WINDOW_CLASS, /* Class name */ szTitle, /* Window name */ WS_POPUP, @@ -106,10 +108,12 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) /* Branch on the server engine */ switch (pScreenInfo->dwEngine) { +#ifdef XWIN_NATIVEGDI case WIN_SERVER_SHADOW_GDI: /* Show the window */ ShowWindow (*phwnd, SW_SHOWMAXIMIZED); break; +#endif default: /* Hide the window */ @@ -144,18 +148,24 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) DWORD dwWindowStyle; char szTitle[256]; - ErrorF ("winCreateBoundingWindowWindowed - User w: %d h: %d\n", - pScreenInfo->dwUserWidth, pScreenInfo->dwUserHeight); - ErrorF ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n", - pScreenInfo->dwWidth, pScreenInfo->dwHeight); - + 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 +#endif && !pScreenInfo->fRootless - && !pScreenInfo->fMultiWindow) +#ifdef XWIN_MULTIWINDOW + && !pScreenInfo->fMultiWindow +#endif + ) { dwWindowStyle |= WS_CAPTION; if (pScreenInfo->fScrollbars) @@ -188,23 +198,29 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) { /* User gave a desired height and width, try to accomodate */ #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed - User gave height " + winDebug ("winCreateBoundingWindowWindowed - User gave height " "and width\n"); #endif /* Adjust the window width and height for borders and title bar */ if (pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM + && !pScreenInfo->fMWExtWM +#endif && !pScreenInfo->fRootless - && !pScreenInfo->fMultiWindow) +#ifdef XWIN_MULTIWINDOW + && !pScreenInfo->fMultiWindow +#endif + ) { #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed - Window has decoration\n"); + winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n"); #endif /* Are we using scrollbars? */ if (pScreenInfo->fScrollbars) { #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed - Window has " + winDebug ("winCreateBoundingWindowWindowed - Window has " "scrollbars\n"); #endif @@ -215,7 +231,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) else { #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed - Window does not have " + winDebug ("winCreateBoundingWindowWindowed - Window does not have " "scrollbars\n"); #endif @@ -247,7 +263,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) { /* By default, we are creating a window that is as large as possible */ #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed - User did not give " + winDebug ("winCreateBoundingWindowWindowed - User did not give " "height and width\n"); #endif /* Defaults are wrong if we have multiple monitors */ @@ -260,8 +276,14 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Clean up the scrollbars flag, if necessary */ if ((!pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fMWExtWM +#endif || pScreenInfo->fRootless - || pScreenInfo->fMultiWindow) +#ifdef XWIN_MULTIWINDOW + || pScreenInfo->fMultiWindow +#endif + ) && pScreenInfo->fScrollbars) { /* We cannot have scrollbars if we do not have a window border */ @@ -277,7 +299,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) iHeight = rcWorkArea.bottom - rcWorkArea.top; #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed - Adjusted width: %d "\ + winDebug ("winCreateBoundingWindowWindowed - Adjusted width: %d "\ "height: %d\n", iWidth, iHeight); #endif @@ -315,7 +337,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) } #if CYGDEBUG - ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n"); + winDebug ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n"); #endif /* Get the client area coordinates */ @@ -326,7 +348,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) return FALSE; } - ErrorF ("winCreateBoundingWindowWindowed - WindowClient " + winDebug ("winCreateBoundingWindowWindowed - WindowClient " "w %ld h %ld r %ld l %ld b %ld t %ld\n", rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, @@ -382,21 +404,28 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Setup the width range and page size */ si.nMax = pScreenInfo->dwWidth - 1; si.nPage = rcClient.right - rcClient.left; - ErrorF ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n", + 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; - ErrorF ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n", + winDebug ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n", si.nMax, si.nPage); SetScrollInfo (*phwnd, SB_VERT, &si, TRUE); } #endif /* Show the window */ - if (pScreenInfo->fMultiWindow) + if (FALSE +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fMWExtWM +#endif +#ifdef XWIN_MULTIWINDOW + || pScreenInfo->fMultiWindow +#endif + ) { pScreenPriv->fRootWindowShown = FALSE; ShowWindow (*phwnd, SW_HIDE); @@ -410,18 +439,31 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) } /* Attempt to bring our window to the top of the display */ - if (!BringWindowToTop (*phwnd)) + if (TRUE +#ifdef XWIN_MULTIWINDOWEXTWM + && !pScreenInfo->fMWExtWM +#endif + && !pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + && !pScreenInfo->fMultiWindow +#endif + ) { - 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)); +#endif - ErrorF ("winCreateBoundingWindowWindowed - Returning\n"); + winDebug ("winCreateBoundingWindowWindowed - Returning\n"); return TRUE; } @@ -446,27 +488,27 @@ winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo) if (!pScreenInfo->fMultipleMonitors) return TRUE; - ErrorF ("winGetWorkArea - Original WorkArea: %d %d %d %d\n", - prcWorkArea->top, prcWorkArea->left, - prcWorkArea->bottom, prcWorkArea->right); + winDebug ("winGetWorkArea - Original WorkArea: %d %d %d %d\n", + (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); - ErrorF ("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); - ErrorF ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop); + winDebug ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop); /* Get size of primary screen */ iPrimaryWidth = GetSystemMetrics (SM_CXSCREEN); iPrimaryHeight = GetSystemMetrics (SM_CYSCREEN); - ErrorF ("winGetWorkArea - Primary screen is %d x %d\n", + winDebug ("winGetWorkArea - Primary screen is %d x %d\n", iPrimaryWidth, iPrimaryHeight); /* Work out how much of the primary screen we aren't using */ @@ -489,10 +531,10 @@ winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo) prcWorkArea->bottom = prcWorkArea->top + iHeight - iPrimaryNonWorkAreaHeight; - ErrorF ("winGetWorkArea - Adjusted WorkArea for multiple " + winDebug ("winGetWorkArea - Adjusted WorkArea for multiple " "monitors: %d %d %d %d\n", - prcWorkArea->top, prcWorkArea->left, - prcWorkArea->bottom, prcWorkArea->right); + (int) prcWorkArea->top, (int) prcWorkArea->left, + (int) prcWorkArea->bottom, (int) prcWorkArea->right); return TRUE; } @@ -509,22 +551,22 @@ winAdjustForAutoHide (RECT *prcWorkArea) APPBARDATA abd; HWND hwndAutoHide; - ErrorF ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n", - prcWorkArea->top, prcWorkArea->left, - prcWorkArea->bottom, 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) - ErrorF ("winAdjustForAutoHide - Taskbar is auto hide\n"); + winDebug ("winAdjustForAutoHide - Taskbar is auto hide\n"); /* Look for a TOP auto-hide taskbar */ abd.uEdge = ABE_TOP; hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); if (hwndAutoHide != NULL) { - ErrorF ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n"); + winDebug ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n"); prcWorkArea->top += 1; } @@ -533,7 +575,7 @@ winAdjustForAutoHide (RECT *prcWorkArea) hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); if (hwndAutoHide != NULL) { - ErrorF ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n"); + winDebug ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n"); prcWorkArea->left += 1; } @@ -542,7 +584,7 @@ winAdjustForAutoHide (RECT *prcWorkArea) hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); if (hwndAutoHide != NULL) { - ErrorF ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n"); + winDebug ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n"); prcWorkArea->bottom -= 1; } @@ -551,19 +593,19 @@ winAdjustForAutoHide (RECT *prcWorkArea) hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd); if (hwndAutoHide != NULL) { - ErrorF ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n"); + winDebug ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n"); prcWorkArea->right -= 1; } - ErrorF ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n", - prcWorkArea->top, prcWorkArea->left, - prcWorkArea->bottom, prcWorkArea->right); + winDebug ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n", + (int) prcWorkArea->top, (int) prcWorkArea->left, + (int) prcWorkArea->bottom, (int) prcWorkArea->right); #if 0 /* Obtain the task bar window dimensions */ abd.hWnd = hwndAutoHide; hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETTASKBARPOS, &abd); - ErrorF ("hwndAutoHide %08x abd.hWnd %08x %d %d %d %d\n", + winDebug ("hwndAutoHide %08x abd.hWnd %08x %d %d %d %d\n", hwndAutoHide, abd.hWnd, abd.rc.top, abd.rc.left, abd.rc.bottom, abd.rc.right); #endif |