PlatformScreenWin.cpp [plain text]
#include "config.h"
#include "PlatformScreen.h"
#include "FloatRect.h"
#include "Frame.h"
#include "FrameView.h"
#include "HostWindow.h"
#include "IntRect.h"
#include "NotImplemented.h"
#include "Page.h"
#include <windows.h>
namespace WebCore {
static MONITORINFOEX monitorInfoForWidget(Widget* widget)
{
HWND window = widget ? widget->root()->hostWindow()->platformPageClient() : 0;
HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY);
MONITORINFOEX monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(monitor, &monitorInfo);
return monitorInfo;
}
static DEVMODE deviceInfoForWidget(Widget* widget)
{
DEVMODE deviceInfo;
deviceInfo.dmSize = sizeof(DEVMODE);
deviceInfo.dmDriverExtra = 0;
MONITORINFOEX monitorInfo = monitorInfoForWidget(widget);
EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &deviceInfo);
return deviceInfo;
}
int screenDepth(Widget* widget)
{
DEVMODE deviceInfo = deviceInfoForWidget(widget);
if (deviceInfo.dmBitsPerPel == 32) {
return 24;
}
return deviceInfo.dmBitsPerPel;
}
int screenDepthPerComponent(Widget* widget)
{
return screenDepth(widget) / 3;
}
bool screenIsMonochrome(Widget* widget)
{
DEVMODE deviceInfo = deviceInfoForWidget(widget);
return deviceInfo.dmColor == DMCOLOR_MONOCHROME;
}
bool screenHasInvertedColors()
{
return false;
}
FloatRect screenRect(Widget* widget)
{
MONITORINFOEX monitorInfo = monitorInfoForWidget(widget);
return monitorInfo.rcMonitor;
}
FloatRect screenAvailableRect(Widget* widget)
{
MONITORINFOEX monitorInfo = monitorInfoForWidget(widget);
return monitorInfo.rcWork;
}
}