Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

display.cpp

Go to the documentation of this file.
00001 /* $Id: display.cpp,v 1.12 2001/06/23 07:27:08 achimha Exp $ */
00002 /*
00003  * Display/Monitor Win32 apis
00004  *
00005  * Based on Wine code (991031)
00006  *
00007  * Copyright 1993 Robert J. Amstadt
00008  *           1996 Alex Korobka
00009  * Copyright 1998 Turchanov Sergey
00010  *
00011  * Copyright 1999 Christoph Bratschi
00012  *
00013  * Project Odin Software License can be found in LICENSE.TXT
00014  *
00015  */
00016 #include <os2win.h>
00017 #include <misc.h>
00018 #include <string.h>
00019 #include <heapstring.h>
00020 #include "pmwindow.h"
00021 #include "monitor.h"
00022 #include "windef.h"
00023 
00024 #define DBG_LOCALLOG    DBG_display
00025 #include "dbglocal.h"
00026 
00027 #define NRMODES 5
00028 #define NRDEPTHS 4
00029 struct {
00030         int w,h;
00031 } modes[NRMODES]={{512,384},{640,400},{640,480},{800,600},{1024,768}};
00032 int depths[4] = {8,16,24,32};
00033 
00034 
00035 /**********************************************************************/
00036 
00037 #define xPRIMARY_MONITOR ((HMONITOR)0x12340042)
00038 
00039 MONITOR MONITOR_PrimaryMonitor;
00040 
00041 /* PM Monitor */
00042 
00043 /***********************************************************************
00044  *              PMDRV_MONITOR_Initialize
00045  */
00046 void PMDRV_MONITOR_Initialize(MONITOR *pMonitor)
00047 {
00048   dprintf(("MONITOR: PMDRV_Initialize"));
00049 
00050   pMonitor->pDriverData = NULL;
00051 }
00052 
00053 /***********************************************************************
00054  *              PMDRV_MONITOR_Finalize
00055  */
00056 void PMDRV_MONITOR_Finalize(MONITOR *pMonitor)
00057 {
00058   dprintf(("MONITOR: PMDRV_Finalize"));
00059 }
00060 
00061 /***********************************************************************
00062  *              PMDRV_MONITOR_IsSingleWindow
00063  */
00064 BOOL PMDRV_MONITOR_IsSingleWindow(MONITOR *pMonitor)
00065 {
00066   dprintf(("MONITOR: PMDRV_IsSingleWindow"));
00067 
00068   return TRUE; //CB: right???
00069 }
00070 
00071 /***********************************************************************
00072  *              PMDRV_MONITOR_GetWidth
00073  *
00074  * Return the width of the monitor
00075  */
00076 int PMDRV_MONITOR_GetWidth(MONITOR *pMonitor)
00077 {
00078   dprintf(("MONITOR: PMDRV_GetWidth"));
00079 
00080   return GetSystemMetrics(SM_CXSCREEN);
00081 }
00082 
00083 /***********************************************************************
00084  *              PMDRV_MONITOR_GetHeight
00085  *
00086  * Return the height of the monitor
00087  */
00088 int PMDRV_MONITOR_GetHeight(MONITOR *pMonitor)
00089 {
00090   dprintf(("MONITOR: PMDRV_GetHeight"));
00091 
00092   return GetSystemMetrics(SM_CYSCREEN);
00093 }
00094 
00095 /***********************************************************************
00096  *              PMDRV_MONITOR_GetDepth
00097  *
00098  * Return the depth of the monitor
00099  */
00100 int PMDRV_MONITOR_GetDepth(MONITOR *pMonitor)
00101 {
00102   dprintf(("MONITOR: PMDRV_GetDepth"));
00103 
00104   return 24; //CB: change, right???
00105 }
00106 
00107 /***********************************************************************
00108  *              PMDRV_MONITOR_GetScreenSaveActive
00109  *
00110  * Returns the active status of the screen saver
00111  */
00112 BOOL PMDRV_MONITOR_GetScreenSaveActive(MONITOR *pMonitor)
00113 {
00114   dprintf(("MONITOR: PMDRV_GetScreenSaveActive"));
00115 
00116   return FALSE;
00117 }
00118 
00119 /***********************************************************************
00120  *              PMDRV_MONITOR_SetScreenSaveActive
00121  *
00122  * Activate/Deactivate the screen saver
00123  */
00124 void PMDRV_MONITOR_SetScreenSaveActive(MONITOR *pMonitor, BOOL bActivate)
00125 {
00126   dprintf(("MONITOR: PMDRV_SetScreenSaveActive"));
00127 }
00128 
00129 /***********************************************************************
00130  *              PMDRV_MONITOR_GetScreenSaveTimeout
00131  *
00132  * Return the screen saver timeout
00133  */
00134 int PMDRV_MONITOR_GetScreenSaveTimeout(MONITOR *pMonitor)
00135 {
00136   dprintf(("MONITOR: PMDRV_GetScreenSaveTimeout"));
00137 
00138   return 60*1000; //CB: stub
00139 }
00140 
00141 /***********************************************************************
00142  *              PMDRV_MONITOR_SetScreenSaveTimeout
00143  *
00144  * Set the screen saver timeout
00145  */
00146 void PMDRV_MONITOR_SetScreenSaveTimeout(
00147   MONITOR *pMonitor, int nTimeout)
00148 {
00149   dprintf(("MONITOR: PMDRV_SetScreenSaveTimeout"));
00150 }
00151 
00152 MONITOR_DRIVER PM_MONITOR_Driver =
00153 {
00154   PMDRV_MONITOR_Initialize,
00155   PMDRV_MONITOR_Finalize,
00156   PMDRV_MONITOR_IsSingleWindow,
00157   PMDRV_MONITOR_GetWidth,
00158   PMDRV_MONITOR_GetHeight,
00159   PMDRV_MONITOR_GetDepth,
00160   PMDRV_MONITOR_GetScreenSaveActive,
00161   PMDRV_MONITOR_SetScreenSaveActive,
00162   PMDRV_MONITOR_GetScreenSaveTimeout,
00163   PMDRV_MONITOR_SetScreenSaveTimeout
00164 };
00165 
00166 MONITOR_DRIVER *MONITOR_Driver = &PM_MONITOR_Driver;
00167 
00168 /***********************************************************************
00169  *              MONITOR_GetMonitor
00170  */
00171 static MONITOR *MONITOR_GetMonitor(HMONITOR hMonitor)
00172 {
00173   if(hMonitor == xPRIMARY_MONITOR)
00174     {
00175       return &MONITOR_PrimaryMonitor;
00176     }
00177   else
00178     {
00179       return NULL;
00180     }
00181 }
00182 
00183 /***********************************************************************
00184  *              MONITOR_Initialize
00185  */
00186 void MONITOR_Initialize(MONITOR *pMonitor)
00187 {
00188   MONITOR_Driver->pInitialize(pMonitor);
00189 }
00190 
00191 /***********************************************************************
00192  *              MONITOR_Finalize
00193  */
00194 void MONITOR_Finalize(MONITOR *pMonitor)
00195 {
00196   MONITOR_Driver->pFinalize(pMonitor);
00197 }
00198 
00199 /***********************************************************************
00200  *              MONITOR_IsSingleWindow
00201  */
00202 BOOL MONITOR_IsSingleWindow(MONITOR *pMonitor)
00203 {
00204   return MONITOR_Driver->pIsSingleWindow(pMonitor);
00205 }
00206 
00207 /***********************************************************************
00208  *              MONITOR_GetWidth
00209  */
00210 int MONITOR_GetWidth(MONITOR *pMonitor)
00211 {
00212   return MONITOR_Driver->pGetWidth(pMonitor);
00213 }
00214 
00215 /***********************************************************************
00216  *              MONITOR_GetHeight
00217  */
00218 int MONITOR_GetHeight(MONITOR *pMonitor)
00219 {
00220   return MONITOR_Driver->pGetHeight(pMonitor);
00221 }
00222 
00223 /***********************************************************************
00224  *              MONITOR_GetDepth
00225  */
00226 int MONITOR_GetDepth(MONITOR *pMonitor)
00227 {
00228   return MONITOR_Driver->pGetDepth(pMonitor);
00229 }
00230 
00231 /***********************************************************************
00232  *              MONITOR_GetScreenSaveActive
00233  */
00234 BOOL MONITOR_GetScreenSaveActive(MONITOR *pMonitor)
00235 {
00236   return MONITOR_Driver->pGetScreenSaveActive(pMonitor);
00237 }
00238 
00239 /***********************************************************************
00240  *              MONITOR_SetScreenSaveActive
00241  */
00242 void MONITOR_SetScreenSaveActive(MONITOR *pMonitor, BOOL bActivate)
00243 {
00244   MONITOR_Driver->pSetScreenSaveActive(pMonitor, bActivate);
00245 }
00246 
00247 /***********************************************************************
00248  *              MONITOR_GetScreenSaveTimeout
00249  */
00250 int MONITOR_GetScreenSaveTimeout(MONITOR *pMonitor)
00251 {
00252   return MONITOR_Driver->pGetScreenSaveTimeout(pMonitor);
00253 }
00254 
00255 /***********************************************************************
00256  *              MONITOR_SetScreenSaveTimeout
00257  */
00258 void MONITOR_SetScreenSaveTimeout(MONITOR *pMonitor, int nTimeout)
00259 {
00260   MONITOR_Driver->pSetScreenSaveTimeout(pMonitor, nTimeout);
00261 }
00262 
00263 /*****************************************************************************
00264  * Name      : BOOL WIN32API EnumDisplaySettingsA
00265  * Purpose   : The EnumDisplaySettings function obtains information about one
00266  *             of a display device's graphics modes. You can obtain information
00267  *             for all of a display device's graphics modes by making a series
00268  *             of calls to this function.
00269  * Parameters: LPCTSTR   lpszDeviceName specifies the display device
00270  *             DWORD     iModeNum       specifies the graphics mode
00271  *             LPDEVMODE lpDevMode      points to structure to receive settings
00272  * Variables :
00273  * Result    : If the function succeeds, the return value is TRUE.
00274  *             If the function fails, the return value is FALSE.
00275  * Remark    : Wine Port (991031)
00276  * Status    :
00277  *
00278  * Author    :
00279  *****************************************************************************/
00280 BOOL WIN32API EnumDisplaySettingsA(
00281         LPCSTR name,            /* [in] huh? */
00282         DWORD n,                /* [in] nth entry in display settings list*/
00283         LPDEVMODEA devmode)     /* [out] devmode for that setting */
00284 {
00285         dprintf(("USER32: EnumDisplaySettingsA %s %d %x", name, n, devmode));
00286         if(devmode == NULL) {
00287                 SetLastError(ERROR_INVALID_PARAMETER);
00288                 return FALSE;
00289         }
00290         //SvL: VMWare calls this with -1; valid in NT4, SP6
00291         //     Other negative numbers too. Don't know what they mean.
00292         if(n == 0xFFFFFFFF) {
00293                 n = 0;
00294         }
00295         memset(devmode, 0, sizeof(*devmode));
00296         devmode->dmSize = sizeof(*devmode);
00297         devmode->dmDisplayFrequency = 70; //todo: get real refresh rate
00298         if(n==0) {
00299                 devmode->dmBitsPerPel = ScreenBitsPerPel;
00300                 devmode->dmPelsHeight = ScreenHeight;
00301                 devmode->dmPelsWidth = ScreenWidth;
00302                 return TRUE;
00303         }
00304         if ((n-1)<NRMODES*NRDEPTHS) {
00305                 devmode->dmBitsPerPel   = depths[(n-1)/NRMODES];
00306                 devmode->dmPelsHeight   = modes[(n-1)%NRMODES].h;
00307                 devmode->dmPelsWidth    = modes[(n-1)%NRMODES].w;
00308                 return TRUE;
00309         }
00310         SetLastError(ERROR_INVALID_PARAMETER);
00311         return FALSE;
00312 }
00313 
00314 /*****************************************************************************
00315  * Name      : BOOL WIN32API EnumDisplaySettingsW
00316  * Purpose   : The EnumDisplaySettings function obtains information about one
00317  *             of a display device's graphics modes. You can obtain information
00318  *             for all of a display device's graphics modes by making a series
00319  *             of calls to this function.
00320  * Parameters: LPCTSTR   lpszDeviceName specifies the display device
00321  *             DWORD     iModeNum       specifies the graphics mode
00322  *             LPDEVMODE lpDevMode      points to structure to receive settings
00323  * Variables :
00324  * Result    : If the function succeeds, the return value is TRUE.
00325  *             If the function fails, the return value is FALSE.
00326  * Remark    : Wine Port (991031)
00327  * Status    :
00328  *
00329  * Author    :
00330  *****************************************************************************/
00331 BOOL WIN32API EnumDisplaySettingsW(LPCWSTR name,DWORD n,LPDEVMODEW devmode)
00332 {
00333  LPSTR    nameA = NULL;
00334  DEVMODEA devmodeA;
00335  BOOL     ret;
00336 
00337         if(name) {
00338                 nameA = HEAP_strdupWtoA(GetProcessHeap(),0,name);
00339         }
00340         ret = EnumDisplaySettingsA(nameA,n,&devmodeA);
00341 
00342         if (ret) {
00343                 devmode->dmBitsPerPel   = devmodeA.dmBitsPerPel;
00344                 devmode->dmPelsHeight   = devmodeA.dmPelsHeight;
00345                 devmode->dmPelsWidth    = devmodeA.dmPelsWidth;
00346                 /* FIXME: convert rest too, if they are ever returned */
00347         }
00348         if(name)
00349                 HeapFree(GetProcessHeap(),0,nameA);
00350         return ret;
00351 }
00352 //******************************************************************************
00353 //******************************************************************************
00354 LONG WIN32API ChangeDisplaySettingsA(LPDEVMODEA  lpDevMode, DWORD dwFlags)
00355 {
00356     // lpDevMode might be NULL when change to default desktop mode
00357     // is being requested, this was the cause of trap
00358     if ( !lpDevMode )
00359     {
00360         return(DISP_CHANGE_SUCCESSFUL);
00361     }
00362     if(lpDevMode) {
00363         dprintf(("USER32:  ChangeDisplaySettingsA FAKED %X\n", dwFlags));
00364         dprintf(("USER32:  ChangeDisplaySettingsA lpDevMode->dmBitsPerPel %d\n", lpDevMode->dmBitsPerPel));
00365         dprintf(("USER32:  ChangeDisplaySettingsA lpDevMode->dmPelsWidth  %d\n", lpDevMode->dmPelsWidth));
00366         dprintf(("USER32:  ChangeDisplaySettingsA lpDevMode->dmPelsHeight %d\n", lpDevMode->dmPelsHeight));
00367     }
00368     return(DISP_CHANGE_SUCCESSFUL);
00369 }
00370 /*****************************************************************************
00371  * Name      : LONG WIN32API ChangeDisplaySettingsW
00372  * Purpose   : The ChangeDisplaySettings function changes the display settings
00373  *             to the specified graphics mode.
00374  * Parameters: LPDEVMODEW lpDevModeW
00375  *             DWORD      dwFlags
00376  * Variables :
00377  * Result    : DISP_CHANGE_SUCCESSFUL The settings change was successful.
00378  *             DISP_CHANGE_RESTART    The computer must be restarted in order for the graphics mode to work.
00379  *             DISP_CHANGE_BADFLAGS   An invalid set of flags was passed in.
00380  *             DISP_CHANGE_FAILED     The display driver failed the specified graphics mode.
00381  *             DISP_CHANGE_BADMODE    The graphics mode is not supported.
00382  *             DISP_CHANGE_NOTUPDATED Unable to write settings to the registry.
00383  * Remark    :
00384  * Status    : UNTESTED STUB
00385  *
00386  * Author    : Patrick Haller [Wed, 1998/06/16 11:55]
00387  *****************************************************************************/
00388 LONG WIN32API ChangeDisplaySettingsW(LPDEVMODEW lpDevMode,
00389                                         DWORD      dwFlags)
00390 {
00391   dprintf(("USER32:ChangeDisplaySettingsW(%08xh,%08x) not implemented.\n",
00392          lpDevMode,
00393          dwFlags));
00394 
00395   return (ChangeDisplaySettingsA((LPDEVMODEA)lpDevMode,
00396                                   dwFlags));
00397 }
00398 //******************************************************************************
00399 //******************************************************************************
00400 LONG WIN32API ChangeDisplaySettingsExA(LPCSTR devname, LPDEVMODEA lpDevMode,
00401                                        HWND hwnd, DWORD dwFlags, LPARAM lparam)
00402 {
00403     // lpDevMode might be NULL when change to default desktop mode
00404     // is being requested, this was the cause of trap
00405     if ( !lpDevMode )
00406     {
00407         return(DISP_CHANGE_SUCCESSFUL);
00408     }
00409     if(lpDevMode) {
00410         dprintf(("USER32:  ChangeDisplaySettingsExA FAKED %X\n", dwFlags));
00411         dprintf(("USER32:  ChangeDisplaySettingsExA lpDevMode->dmBitsPerPel %d\n", lpDevMode->dmBitsPerPel));
00412         dprintf(("USER32:  ChangeDisplaySettingsExA lpDevMode->dmPelsWidth  %d\n", lpDevMode->dmPelsWidth));
00413         dprintf(("USER32:  ChangeDisplaySettingsExA lpDevMode->dmPelsHeight %d\n", lpDevMode->dmPelsHeight));
00414     }
00415     return(DISP_CHANGE_SUCCESSFUL);
00416 }
00417 //******************************************************************************
00418 //******************************************************************************
00419 LONG WIN32API ChangeDisplaySettingsExW(LPCWSTR devname, LPDEVMODEW lpDevMode,
00420                                        HWND hwnd, DWORD dwFlags, LPARAM lparam)
00421 {
00422   dprintf(("USER32:ChangeDisplaySettingsExW(%08xh,%08x) NOT implemented.\n",
00423          lpDevMode,
00424          dwFlags));
00425 
00426   //TODO: Need unicode translation
00427   return (ChangeDisplaySettingsExA((LPCSTR)devname, (LPDEVMODEA)lpDevMode,
00428                                    hwnd, dwFlags, lparam));
00429 }
00430 //******************************************************************************
00431 //******************************************************************************
00432 BOOL WIN32API GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
00433 {
00434     RECT rcWork;
00435 
00436     dprintf(("USER32: GetMonitorInfoA %x %x", hMonitor, lpMonitorInfo));
00437 
00438     if ((hMonitor == xPRIMARY_MONITOR) &&
00439         lpMonitorInfo &&
00440         (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) &&
00441         SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0))
00442     {
00443         lpMonitorInfo->rcMonitor.left = 0;
00444         lpMonitorInfo->rcMonitor.top  = 0;
00445         lpMonitorInfo->rcMonitor.right  = GetSystemMetrics(SM_CXSCREEN);
00446         lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
00447         lpMonitorInfo->rcWork = rcWork;
00448         lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
00449 
00450         if (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEXA))
00451             lstrcpyA(((MONITORINFOEXA*)lpMonitorInfo)->szDevice, "DISPLAY");
00452 
00453         return TRUE;
00454     }
00455     dprintf(("returning failure\n"));
00456     return FALSE;
00457 }
00458 //******************************************************************************
00459 //******************************************************************************
00460 BOOL WIN32API GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
00461 {
00462     RECT rcWork;
00463 
00464     dprintf(("USER32: GetMonitorInfoW %x %x", hMonitor, lpMonitorInfo));
00465 
00466     if ((hMonitor == xPRIMARY_MONITOR) &&
00467         lpMonitorInfo &&
00468         (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) &&
00469         SystemParametersInfoW(SPI_GETWORKAREA, 0, &rcWork, 0))
00470     {
00471         lpMonitorInfo->rcMonitor.left = 0;
00472         lpMonitorInfo->rcMonitor.top  = 0;
00473         lpMonitorInfo->rcMonitor.right  = GetSystemMetrics(SM_CXSCREEN);
00474         lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
00475         lpMonitorInfo->rcWork = rcWork;
00476         lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
00477 
00478         if (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEXW))
00479             lstrcpyW(((MONITORINFOEXW*)lpMonitorInfo)->szDevice, (LPCWSTR)"D\0I\0S\0P\0L\0A\0Y\0\0");
00480 
00481         return TRUE;
00482     }
00483     dprintf(("returning failure\n"));
00484     return FALSE;
00485 }
00486 //******************************************************************************
00487 //******************************************************************************
00488 HMONITOR WIN32API MonitorFromWindow(HWND hWnd, DWORD dwFlags)
00489 {
00490    WINDOWPLACEMENT wp;
00491 
00492     dprintf(("USER32: MonitorFromWindow %x %x", hWnd, dwFlags));
00493 
00494     if (dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST))
00495         return xPRIMARY_MONITOR;
00496 
00497     if (IsIconic(hWnd) ?
00498             GetWindowPlacement(hWnd, &wp) :
00499             GetWindowRect(hWnd, &wp.rcNormalPosition)) {
00500 
00501         return MonitorFromRect(&wp.rcNormalPosition, dwFlags);
00502     }
00503 
00504     dprintf(("USER32: MonitorFromWindow failed"));
00505     return NULL;
00506 }
00507 //******************************************************************************
00508 //******************************************************************************
00509 HMONITOR WIN32API MonitorFromRect(LPRECT lprcScreenCoords, DWORD dwFlags)
00510 {
00511     dprintf(("USER32: MonitorFromRect (%d,%d)(%d,%d) %x", lprcScreenCoords->left, lprcScreenCoords->top, lprcScreenCoords->right, lprcScreenCoords->bottom, dwFlags));
00512 
00513       if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) ||
00514         ((lprcScreenCoords->right > 0) &&
00515         (lprcScreenCoords->bottom > 0) &&
00516         (lprcScreenCoords->left < GetSystemMetrics(SM_CXSCREEN)) &&
00517         (lprcScreenCoords->top < GetSystemMetrics(SM_CYSCREEN))))
00518     {
00519         return xPRIMARY_MONITOR;
00520     }
00521     dprintf(("USER32: MonitorFromRect failed"));
00522     return NULL;
00523 }
00524 //******************************************************************************
00525 //******************************************************************************
00526 HMONITOR WIN32API MonitorFromPoint(POINT ptScreenCoords, DWORD dwFlags)
00527 {
00528   dprintf(("USER32: MonitorFromPoint (%d,%d) %x", ptScreenCoords.x, ptScreenCoords.y, dwFlags));
00529 
00530   if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) ||
00531       ((ptScreenCoords.x >= 0) &&
00532       (ptScreenCoords.x < GetSystemMetrics(SM_CXSCREEN)) &&
00533       (ptScreenCoords.y >= 0) &&
00534       (ptScreenCoords.y < GetSystemMetrics(SM_CYSCREEN))))
00535   {
00536     return xPRIMARY_MONITOR;
00537   }
00538 
00539   dprintf(("USER32: MonitorFromPoint failed"));
00540   return NULL;
00541 }
00542 //******************************************************************************
00543 //******************************************************************************
00544 BOOL WIN32API EnumDisplayMonitors(
00545         HDC             hdcOptionalForPainting,
00546         LPRECT         lprcEnumMonitorsThatIntersect,
00547         MONITORENUMPROC lpfnEnumProc,
00548         LPARAM          dwData)
00549 {
00550     RECT rcLimit;
00551 
00552     dprintf(("USER32: EnumDisplayMonitors %x %x %x %x", hdcOptionalForPainting, lprcEnumMonitorsThatIntersect, lpfnEnumProc, dwData));
00553 
00554     if (!lpfnEnumProc)
00555         return FALSE;
00556 
00557     rcLimit.left   = 0;
00558     rcLimit.top    = 0;
00559     rcLimit.right  = GetSystemMetrics(SM_CXSCREEN);
00560     rcLimit.bottom = GetSystemMetrics(SM_CYSCREEN);
00561 
00562     if (hdcOptionalForPainting)
00563     {
00564         RECT    rcClip;
00565         POINT   ptOrg;
00566 
00567         switch (GetClipBox(hdcOptionalForPainting, &rcClip))
00568         {
00569         default:
00570             if (!GetDCOrgEx(hdcOptionalForPainting, &ptOrg))
00571                 return FALSE;
00572 
00573             OffsetRect(&rcLimit, -ptOrg.x, -ptOrg.y);
00574             if (IntersectRect(&rcLimit, &rcLimit, &rcClip) &&
00575                 (!lprcEnumMonitorsThatIntersect ||
00576                      IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect))) {
00577 
00578                 break;
00579             }
00580             /*fall thru */
00581         case NULLREGION:
00582              return TRUE;
00583         case ERROR:
00584              return FALSE;
00585         }
00586     } else {
00587         if (    lprcEnumMonitorsThatIntersect &&
00588                 !IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect)) {
00589 
00590             return TRUE;
00591         }
00592     }
00593 
00594     return lpfnEnumProc(
00595             xPRIMARY_MONITOR,
00596             hdcOptionalForPainting,
00597             &rcLimit,
00598             dwData);
00599 }
00600 /***********************************************************************
00601  *           EnumDisplayDevicesA   (USER32.184)
00602  */
00603 BOOL WINAPI EnumDisplayDevicesA(
00604         LPVOID unused,DWORD i,LPDISPLAY_DEVICEA lpDisplayDevice,DWORD dwFlags) 
00605 {
00606         dprintf(("EnumDisplayDevicesA: %x %d %x %x", unused, i, lpDisplayDevice, dwFlags));
00607         if (i)
00608                 return FALSE;
00609         
00610         strcpy((char *)lpDisplayDevice->DeviceName,"OS/2-PM");
00611         strcpy((char *)lpDisplayDevice->DeviceString,"OS/2 Presentation Manager Display");
00612         lpDisplayDevice->StateFlags =
00613                         DISPLAY_DEVICE_ATTACHED_TO_DESKTOP      |
00614                         DISPLAY_DEVICE_PRIMARY_DEVICE           |
00615                         DISPLAY_DEVICE_VGA_COMPATIBLE;
00616         return TRUE;
00617 }
00618 
00619 /***********************************************************************
00620  *           EnumDisplayDevicesW   (USER32.185)
00621  */
00622 BOOL WINAPI EnumDisplayDevicesW(
00623         LPVOID unused,DWORD i,LPDISPLAY_DEVICEW lpDisplayDevice,DWORD dwFlags) 
00624 {
00625         dprintf(("EnumDisplayDevicesW: %x %d %x %x", unused, i, lpDisplayDevice, dwFlags));
00626         if (i)
00627                 return FALSE;
00628 
00629         lstrcpyAtoW(lpDisplayDevice->DeviceName,"OS/2-PM");
00630         lstrcpyAtoW(lpDisplayDevice->DeviceString,"OS/2 Presentation Manager Display");
00631         lpDisplayDevice->StateFlags =
00632                         DISPLAY_DEVICE_ATTACHED_TO_DESKTOP      |
00633                         DISPLAY_DEVICE_PRIMARY_DEVICE           |
00634                         DISPLAY_DEVICE_VGA_COMPATIBLE;
00635         return TRUE;
00636 }
00637 //******************************************************************************
00638 //******************************************************************************

Generated on Wed Jan 23 23:17:29 2002 for ODIN-user32 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001