wincreatewnd.c revision 1b5d61b8
1/*
2 *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
3 *
4 *Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 *"Software"), to deal in the Software without restriction, including
7 *without limitation the rights to use, copy, modify, merge, publish,
8 *distribute, sublicense, and/or sell copies of the Software, and to
9 *permit persons to whom the Software is furnished to do so, subject to
10 *the following conditions:
11 *
12 *The above copyright notice and this permission notice shall be
13 *included in all copies or substantial portions of the Software.
14 *
15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
19 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 *Except as contained in this notice, the name of Harold L Hunt II
24 *shall not be used in advertising or otherwise to promote the sale, use
25 *or other dealings in this Software without prior written authorization
26 *from Harold L Hunt II.
27 *
28 * Authors:	Harold L Hunt II
29 */
30
31#ifdef HAVE_XWIN_CONFIG_H
32#include <xwin-config.h>
33#endif
34#include "win.h"
35#include "shellapi.h"
36
37/*
38 * Local function prototypes
39 */
40
41static Bool
42 winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo);
43
44static Bool
45 winAdjustForAutoHide(RECT * prcWorkArea, winScreenInfo * pScreenInfo);
46
47/*
48 * Create a full screen window
49 */
50
51Bool
52winCreateBoundingWindowFullScreen(ScreenPtr pScreen)
53{
54    winScreenPriv(pScreen);
55    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
56    int iX = pScreenInfo->dwInitialX;
57    int iY = pScreenInfo->dwInitialY;
58    int iWidth = pScreenInfo->dwWidth;
59    int iHeight = pScreenInfo->dwHeight;
60    HWND *phwnd = &pScreenPriv->hwndScreen;
61    WNDCLASSEX wc;
62    char szTitle[256];
63
64#if CYGDEBUG
65    winDebug("winCreateBoundingWindowFullScreen\n");
66#endif
67
68    /* Setup our window class */
69    wc.cbSize = sizeof(WNDCLASSEX);
70    wc.style = CS_HREDRAW | CS_VREDRAW;
71    wc.lpfnWndProc = winWindowProc;
72    wc.cbClsExtra = 0;
73    wc.cbWndExtra = 0;
74    wc.hInstance = g_hInstance;
75    wc.hIcon =
76        (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
77                          GetSystemMetrics(SM_CXICON),
78                          GetSystemMetrics(SM_CYICON), 0);
79    wc.hCursor = 0;
80    wc.hbrBackground = 0;
81    wc.lpszMenuName = NULL;
82    wc.lpszClassName = WINDOW_CLASS;
83    wc.hIconSm =
84        (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
85                          GetSystemMetrics(SM_CXSMICON),
86                          GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
87    RegisterClassEx(&wc);
88
89    /* Set display and screen-specific tooltip text */
90    if (g_pszQueryHost != NULL)
91        snprintf(szTitle,
92                 sizeof(szTitle),
93                 WINDOW_TITLE_XDMCP,
94                 g_pszQueryHost, display, (int) pScreenInfo->dwScreen);
95    else
96        snprintf(szTitle,
97                 sizeof(szTitle),
98                 WINDOW_TITLE, display, (int) pScreenInfo->dwScreen);
99
100    /* Create the window */
101    *phwnd = CreateWindowExA(0, /* Extended styles */
102                             WINDOW_CLASS,      /* Class name */
103                             szTitle,   /* Window name */
104                             WS_POPUP, iX,      /* Horizontal position */
105                             iY,        /* Vertical position */
106                             iWidth,    /* Right edge */
107                             iHeight,   /* Bottom edge */
108                             (HWND) NULL,       /* No parent or owner window */
109                             (HMENU) NULL,      /* No menu */
110                             GetModuleHandle(NULL),     /* Instance handle */
111                             pScreenPriv);      /* ScreenPrivates */
112
113    /* Hide the window */
114    ShowWindow(*phwnd, SW_SHOWNORMAL);
115
116    /* Send first paint message */
117    UpdateWindow(*phwnd);
118
119    /* Attempt to bring our window to the top of the display */
120    BringWindowToTop(*phwnd);
121
122    return TRUE;
123}
124
125/*
126 * Create our primary Windows display window
127 */
128
129Bool
130winCreateBoundingWindowWindowed(ScreenPtr pScreen)
131{
132    winScreenPriv(pScreen);
133    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
134    int iWidth = pScreenInfo->dwUserWidth;
135    int iHeight = pScreenInfo->dwUserHeight;
136    int iPosX;
137    int iPosY;
138    HWND *phwnd = &pScreenPriv->hwndScreen;
139    WNDCLASSEX wc;
140    RECT rcClient, rcWorkArea;
141    DWORD dwWindowStyle;
142    BOOL fForceShowWindow = FALSE;
143    char szTitle[256];
144
145    winDebug("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
146             (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
147    winDebug("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
148             (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
149
150    /* Set the common window style flags */
151    dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
152
153    /* Decorated or undecorated window */
154    if (pScreenInfo->fDecoration
155#ifdef XWIN_MULTIWINDOWEXTWM
156        && !pScreenInfo->fMWExtWM
157#endif
158        && !pScreenInfo->fRootless
159        && !pScreenInfo->fMultiWindow
160        ) {
161        /* Try to handle startup via run.exe. run.exe instructs Windows to
162         * hide all created windows. Detect this case and make sure the
163         * window is shown nevertheless */
164        STARTUPINFO startupInfo;
165
166        GetStartupInfo(&startupInfo);
167        if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&
168            startupInfo.wShowWindow == SW_HIDE) {
169            fForceShowWindow = TRUE;
170        }
171        dwWindowStyle |= WS_CAPTION;
172        if (pScreenInfo->iResizeMode != resizeNotAllowed)
173            dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
174    }
175    else
176        dwWindowStyle |= WS_POPUP;
177
178    /* Setup our window class */
179    wc.cbSize = sizeof(WNDCLASSEX);
180    wc.style = CS_HREDRAW | CS_VREDRAW;
181    wc.lpfnWndProc = winWindowProc;
182    wc.cbClsExtra = 0;
183    wc.cbWndExtra = 0;
184    wc.hInstance = g_hInstance;
185    wc.hIcon =
186        (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
187                          GetSystemMetrics(SM_CXICON),
188                          GetSystemMetrics(SM_CYICON), 0);
189    wc.hCursor = 0;
190    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
191    wc.lpszMenuName = NULL;
192    wc.lpszClassName = WINDOW_CLASS;
193    wc.hIconSm =
194        (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
195                          GetSystemMetrics(SM_CXSMICON),
196                          GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
197    RegisterClassEx(&wc);
198
199    /* Get size of work area */
200    winGetWorkArea(&rcWorkArea, pScreenInfo);
201
202    /* Adjust for auto-hide taskbars */
203    winAdjustForAutoHide(&rcWorkArea, pScreenInfo);
204
205    /* Did the user specify a position? */
206    if (pScreenInfo->fUserGavePosition) {
207        iPosX = pScreenInfo->dwInitialX;
208        iPosY = pScreenInfo->dwInitialY;
209    }
210    else {
211        iPosX = rcWorkArea.left;
212        iPosY = rcWorkArea.top;
213    }
214
215    /* Clean up the scrollbars flag, if necessary */
216    if ((!pScreenInfo->fDecoration
217#ifdef XWIN_MULTIWINDOWEXTWM
218         || pScreenInfo->fMWExtWM
219#endif
220         || pScreenInfo->fRootless
221         || pScreenInfo->fMultiWindow
222        )
223        && (pScreenInfo->iResizeMode == resizeWithScrollbars)) {
224        /* We cannot have scrollbars if we do not have a window border */
225        pScreenInfo->iResizeMode = resizeNotAllowed;
226    }
227
228    /* Did the user specify a height and width? */
229    if (pScreenInfo->fUserGaveHeightAndWidth) {
230        /* User gave a desired height and width, try to accomodate */
231#if CYGDEBUG
232        winDebug("winCreateBoundingWindowWindowed - User gave height "
233                 "and width\n");
234#endif
235
236        /* Adjust the window width and height for borders and title bar */
237        if (pScreenInfo->fDecoration
238#ifdef XWIN_MULTIWINDOWEXTWM
239            && !pScreenInfo->fMWExtWM
240#endif
241            && !pScreenInfo->fRootless
242            && !pScreenInfo->fMultiWindow
243            ) {
244#if CYGDEBUG
245            winDebug
246                ("winCreateBoundingWindowWindowed - Window has decoration\n");
247#endif
248
249            /* Are we resizable */
250            if (pScreenInfo->iResizeMode != resizeNotAllowed) {
251#if CYGDEBUG
252                winDebug
253                    ("winCreateBoundingWindowWindowed - Window is resizable\n");
254#endif
255
256                iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
257                iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME)
258                    + GetSystemMetrics(SM_CYCAPTION);
259            }
260            else {
261#if CYGDEBUG
262                winDebug
263                    ("winCreateBoundingWindowWindowed - Window is not resizable\n");
264#endif
265
266                iWidth += 2 * GetSystemMetrics(SM_CXFIXEDFRAME);
267                iHeight += 2 * GetSystemMetrics(SM_CYFIXEDFRAME)
268                    + GetSystemMetrics(SM_CYCAPTION);
269            }
270        }
271    }
272    else {
273        /* By default, we are creating a window that is as large as possible */
274#if CYGDEBUG
275        winDebug("winCreateBoundingWindowWindowed - User did not give "
276                 "height and width\n");
277#endif
278        /* Defaults are wrong if we have multiple monitors */
279        if (pScreenInfo->fMultipleMonitors) {
280            iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
281            iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
282        }
283    }
284
285    /* Make sure window is no bigger than work area */
286    if (TRUE
287#ifdef XWIN_MULTIWINDOWEXTWM
288        && !pScreenInfo->fMWExtWM
289#endif
290        && !pScreenInfo->fMultiWindow
291        ) {
292        /* Trim window width to fit work area */
293        if (iWidth > (rcWorkArea.right - rcWorkArea.left))
294            iWidth = rcWorkArea.right - rcWorkArea.left;
295
296        /* Trim window height to fit work area */
297        if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top))
298            iHeight = rcWorkArea.bottom - rcWorkArea.top;
299
300#if CYGDEBUG
301        winDebug("winCreateBoundingWindowWindowed - Adjusted width: %d "
302                 "height: %d\n", iWidth, iHeight);
303#endif
304    }
305
306    /* Set display and screen-specific tooltip text */
307    if (g_pszQueryHost != NULL)
308        snprintf(szTitle,
309                 sizeof(szTitle),
310                 WINDOW_TITLE_XDMCP,
311                 g_pszQueryHost, display, (int) pScreenInfo->dwScreen);
312    else
313        snprintf(szTitle,
314                 sizeof(szTitle),
315                 WINDOW_TITLE, display, (int) pScreenInfo->dwScreen);
316
317    /* Create the window */
318    *phwnd = CreateWindowExA(0, /* Extended styles */
319                             WINDOW_CLASS,      /* Class name */
320                             szTitle,   /* Window name */
321                             dwWindowStyle, iPosX,      /* Horizontal position */
322                             iPosY,     /* Vertical position */
323                             iWidth,    /* Right edge */
324                             iHeight,   /* Bottom edge */
325                             (HWND) NULL,       /* No parent or owner window */
326                             (HMENU) NULL,      /* No menu */
327                             GetModuleHandle(NULL),     /* Instance handle */
328                             pScreenPriv);      /* ScreenPrivates */
329    if (*phwnd == NULL) {
330        ErrorF("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n");
331        return FALSE;
332    }
333
334#if CYGDEBUG
335    winDebug("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
336#endif
337
338    if (fForceShowWindow) {
339        ErrorF
340            ("winCreateBoundingWindowWindowed - Setting normal windowstyle\n");
341        ShowWindow(*phwnd, SW_SHOW);
342    }
343
344    /* Get the client area coordinates */
345    if (!GetClientRect(*phwnd, &rcClient)) {
346        ErrorF("winCreateBoundingWindowWindowed - GetClientRect () "
347               "failed\n");
348        return FALSE;
349    }
350
351    winDebug("winCreateBoundingWindowWindowed - WindowClient "
352             "w %d  h %d r %d l %d b %d t %d\n",
353             (int)(rcClient.right - rcClient.left),
354             (int)(rcClient.bottom - rcClient.top),
355             (int)rcClient.right, (int)rcClient.left,
356             (int)rcClient.bottom, (int)rcClient.top);
357
358    /* We adjust the visual size if the user did not specify it */
359    if (!
360        ((pScreenInfo->iResizeMode == resizeWithScrollbars) &&
361         pScreenInfo->fUserGaveHeightAndWidth)) {
362        /*
363         * User did not give a height and width with scrollbars enabled,
364         * so we will resize the underlying visual to be as large as
365         * the initial view port (page size).  This way scrollbars will
366         * not appear until the user shrinks the window, if they ever do.
367         *
368         * NOTE: We have to store the viewport size here because
369         * the user may have an autohide taskbar, which would
370         * cause the viewport size to be one less in one dimension
371         * than the viewport size that we calculated by subtracting
372         * the size of the borders and caption.
373         */
374        pScreenInfo->dwWidth = rcClient.right - rcClient.left;
375        pScreenInfo->dwHeight = rcClient.bottom - rcClient.top;
376    }
377
378#if 0
379    /*
380     * NOTE: For the uninitiated, the page size is the number of pixels
381     * that we can display in the x or y direction at a time and the
382     * range is the total number of pixels in the x or y direction that we
383     * have available to display.  In other words, the page size is the
384     * size of the window area minus the space the caption, borders, and
385     * scrollbars (if any) occupy, and the range is the size of the
386     * underlying X visual.  Notice that, contrary to what some of the
387     * MSDN Library arcticles lead you to believe, the windows
388     * ``client area'' size does not include the scrollbars.  In other words,
389     * the whole client area size that is reported to you is drawable by
390     * you; you do not have to subtract the size of the scrollbars from
391     * the client area size, and if you did it would result in the size
392     * of the scrollbars being double counted.
393     */
394
395    /* Setup scrollbar page and range, if scrollbars are enabled */
396    if (pScreenInfo->fScrollbars) {
397        SCROLLINFO si;
398
399        /* Initialize the scrollbar info structure */
400        si.cbSize = sizeof(si);
401        si.fMask = SIF_RANGE | SIF_PAGE;
402        si.nMin = 0;
403
404        /* Setup the width range and page size */
405        si.nMax = pScreenInfo->dwWidth - 1;
406        si.nPage = rcClient.right - rcClient.left;
407        winDebug("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
408                 si.nMax, si.nPage);
409        SetScrollInfo(*phwnd, SB_HORZ, &si, TRUE);
410
411        /* Setup the height range and page size */
412        si.nMax = pScreenInfo->dwHeight - 1;
413        si.nPage = rcClient.bottom - rcClient.top;
414        winDebug("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
415                 si.nMax, si.nPage);
416        SetScrollInfo(*phwnd, SB_VERT, &si, TRUE);
417    }
418#endif
419
420    /* Show the window */
421    if (FALSE
422#ifdef XWIN_MULTIWINDOWEXTWM
423        || pScreenInfo->fMWExtWM
424#endif
425        || pScreenInfo->fMultiWindow
426        ) {
427        pScreenPriv->fRootWindowShown = FALSE;
428        ShowWindow(*phwnd, SW_HIDE);
429    }
430    else
431        ShowWindow(*phwnd, SW_SHOWNORMAL);
432    if (!UpdateWindow(*phwnd)) {
433        ErrorF("winCreateBoundingWindowWindowed - UpdateWindow () failed\n");
434        return FALSE;
435    }
436
437    /* Attempt to bring our window to the top of the display */
438    if (TRUE
439#ifdef XWIN_MULTIWINDOWEXTWM
440        && !pScreenInfo->fMWExtWM
441#endif
442        && !pScreenInfo->fRootless
443        && !pScreenInfo->fMultiWindow
444        ) {
445        if (!BringWindowToTop(*phwnd)) {
446            ErrorF("winCreateBoundingWindowWindowed - BringWindowToTop () "
447                   "failed\n");
448            return FALSE;
449        }
450    }
451
452    winDebug("winCreateBoundingWindowWindowed -  Returning\n");
453
454    return TRUE;
455}
456
457/*
458 * Find the work area of all attached monitors
459 */
460
461static Bool
462winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
463{
464    int iPrimaryWidth, iPrimaryHeight;
465    int iWidth, iHeight;
466    int iLeft, iTop;
467    int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
468
469    /* Use GetMonitorInfo to get work area for monitor */
470    if (!pScreenInfo->fMultipleMonitors) {
471        MONITORINFO mi;
472
473        mi.cbSize = sizeof(MONITORINFO);
474        if (GetMonitorInfo(pScreenInfo->hMonitor, &mi)) {
475            *prcWorkArea = mi.rcWork;
476
477            winDebug("winGetWorkArea - Monitor %d WorkArea: %d %d %d %d\n",
478                     pScreenInfo->iMonitor,
479                     (int) prcWorkArea->top, (int) prcWorkArea->left,
480                     (int) prcWorkArea->bottom, (int) prcWorkArea->right);
481        }
482        else {
483            ErrorF("winGetWorkArea - GetMonitorInfo() failed for monitor %d\n",
484                   pScreenInfo->iMonitor);
485        }
486
487        /* Bail out here if we aren't using multiple monitors */
488        return TRUE;
489    }
490
491    /* SPI_GETWORKAREA only gets the work area of the primary screen. */
492    SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0);
493
494    winDebug("winGetWorkArea - Primary Monitor WorkArea: %d %d %d %d\n",
495             (int) prcWorkArea->top, (int) prcWorkArea->left,
496             (int) prcWorkArea->bottom, (int) prcWorkArea->right);
497
498    /* Get size of full virtual screen */
499    iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
500    iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
501
502    winDebug("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
503
504    /* Get origin of full virtual screen */
505    iLeft = GetSystemMetrics(SM_XVIRTUALSCREEN);
506    iTop = GetSystemMetrics(SM_YVIRTUALSCREEN);
507
508    winDebug("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
509
510    /* Get size of primary screen */
511    iPrimaryWidth = GetSystemMetrics(SM_CXSCREEN);
512    iPrimaryHeight = GetSystemMetrics(SM_CYSCREEN);
513
514    winDebug("winGetWorkArea - Primary screen is %d x %d\n",
515             iPrimaryWidth, iPrimaryHeight);
516
517    /* Work out how much of the primary screen we aren't using */
518    iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right -
519                                                prcWorkArea->left);
520    iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom
521                                                  - prcWorkArea->top);
522
523    /* Update the rectangle to include all monitors */
524    if (iLeft < 0) {
525        prcWorkArea->left = iLeft;
526    }
527    if (iTop < 0) {
528        prcWorkArea->top = iTop;
529    }
530    prcWorkArea->right = prcWorkArea->left + iWidth - iPrimaryNonWorkAreaWidth;
531    prcWorkArea->bottom = prcWorkArea->top + iHeight -
532        iPrimaryNonWorkAreaHeight;
533
534    winDebug("winGetWorkArea - Adjusted WorkArea for multiple "
535             "monitors: %d %d %d %d\n",
536             (int) prcWorkArea->top, (int) prcWorkArea->left,
537             (int) prcWorkArea->bottom, (int) prcWorkArea->right);
538
539    return TRUE;
540}
541
542static Bool
543winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo * pScreenInfo)
544{
545    APPBARDATA abd;
546    HWND hwndAutoHide;
547
548    ZeroMemory(&abd, sizeof(abd));
549    abd.cbSize = sizeof(abd);
550    abd.uEdge = uEdge;
551
552    hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
553    if (hwndAutoHide != NULL) {
554        /*
555           Found an autohide taskbar on that edge, but is it on the
556           same monitor as the screen window?
557         */
558        if (pScreenInfo->fMultipleMonitors ||
559            (MonitorFromWindow(hwndAutoHide, MONITOR_DEFAULTTONULL) ==
560             pScreenInfo->hMonitor))
561            return TRUE;
562    }
563    return FALSE;
564}
565
566/*
567 * Adjust the client area so that any auto-hide toolbars
568 * will work correctly.
569 */
570
571static Bool
572winAdjustForAutoHide(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
573{
574    APPBARDATA abd;
575
576    winDebug("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
577             (int) prcWorkArea->top, (int) prcWorkArea->left,
578             (int) prcWorkArea->bottom, (int) prcWorkArea->right);
579
580    /* Find out if the Windows taskbar is set to auto-hide */
581    ZeroMemory(&abd, sizeof(abd));
582    abd.cbSize = sizeof(abd);
583    if (SHAppBarMessage(ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
584        winDebug("winAdjustForAutoHide - Taskbar is auto hide\n");
585
586    /*
587       Despite the forgoing, we are checking for any AppBar
588       hiding along a monitor edge, not just the Windows TaskBar.
589     */
590
591    /* Look for a TOP auto-hide taskbar */
592    if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo)) {
593        winDebug("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
594        prcWorkArea->top += 1;
595    }
596
597    /* Look for a LEFT auto-hide taskbar */
598    if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo)) {
599        winDebug("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
600        prcWorkArea->left += 1;
601    }
602
603    /* Look for a BOTTOM auto-hide taskbar */
604    if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo)) {
605        winDebug("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
606        prcWorkArea->bottom -= 1;
607    }
608
609    /* Look for a RIGHT auto-hide taskbar */
610    if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo)) {
611        winDebug("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
612        prcWorkArea->right -= 1;
613    }
614
615    winDebug("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
616             (int) prcWorkArea->top, (int) prcWorkArea->left,
617             (int) prcWorkArea->bottom, (int) prcWorkArea->right);
618
619    return TRUE;
620}
621