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