Module: wine Branch: master Commit: d8a0da9d8f28cb5aad99c35aa7398b77b1e9dd04 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d8a0da9d8f28cb5aad99c35aa7...
Author: Ken Thomases ken@codeweavers.com Date: Thu Dec 20 19:02:32 2012 -0600
winemac.drv: Implement GetMonitorInfo.
---
dlls/winemac.drv/display.c | 51 +++++++++++++++++++++++++++++++++++++ dlls/winemac.drv/winemac.drv.spec | 1 + 2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 1b791e4..a1bea38 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -105,3 +105,54 @@ BOOL CDECL macdrv_EnumDisplayMonitors(HDC hdc, LPRECT rect, MONITORENUMPROC proc
return ret; } + + +/*********************************************************************** + * GetMonitorInfo (MACDRV.@) + */ +BOOL CDECL macdrv_GetMonitorInfo(HMONITOR monitor, LPMONITORINFO info) +{ + static const WCHAR adapter_name[] = { '\','\','.','\','D','I','S','P','L','A','Y','1',0 }; + struct macdrv_display *displays; + int num_displays; + CGDirectDisplayID display_id; + int i; + + TRACE("%p, %p\n", monitor, info); + + if (macdrv_get_displays(&displays, &num_displays)) + { + ERR("couldn't get display list\n"); + SetLastError(ERROR_GEN_FAILURE); + return FALSE; + } + + display_id = monitor_to_display_id(monitor); + for (i = 0; i < num_displays; i++) + { + if (displays[i].displayID == display_id) + break; + } + + if (i < num_displays) + { + info->rcMonitor = rect_from_cgrect(displays[i].frame); + info->rcWork = rect_from_cgrect(displays[i].work_frame); + + info->dwFlags = (i == 0) ? MONITORINFOF_PRIMARY : 0; + + if (info->cbSize >= sizeof(MONITORINFOEXW)) + lstrcpyW(((MONITORINFOEXW*)info)->szDevice, adapter_name); + + TRACE(" -> rcMonitor %s rcWork %s dwFlags %08x\n", wine_dbgstr_rect(&info->rcMonitor), + wine_dbgstr_rect(&info->rcWork), info->dwFlags); + } + else + { + ERR("invalid monitor handle\n"); + SetLastError(ERROR_INVALID_HANDLE); + } + + macdrv_free_displays(displays); + return (i < num_displays); +} diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 25b43e0..03fa490 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -5,3 +5,4 @@ # USER driver
@ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors +@ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo