This source file includes following definitions.
- GetMonitorInfoForMonitor
- GetDisplay
- IsDIPEnabled
- GetDisplayMatching
- GetHWNDFromNativeView
- GetNativeWindowFromHWND
- CreateDesktopScreen
#include "ui/views/widget/desktop_aura/desktop_screen_win.h"
#include "base/logging.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
#include "ui/gfx/display.h"
#include "ui/views/widget/desktop_aura/desktop_screen.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
namespace {
MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) {
MONITORINFO monitor_info = { 0 };
monitor_info.cbSize = sizeof(monitor_info);
GetMonitorInfo(monitor, &monitor_info);
return monitor_info;
}
gfx::Display GetDisplay(MONITORINFO& monitor_info) {
gfx::Display display(0, gfx::Rect(monitor_info.rcMonitor));
display.set_work_area(gfx::Rect(monitor_info.rcWork));
return display;
}
}
namespace views {
DesktopScreenWin::DesktopScreenWin() {
}
DesktopScreenWin::~DesktopScreenWin() {
}
bool DesktopScreenWin::IsDIPEnabled() {
return true;
}
gfx::Display DesktopScreenWin::GetDisplayMatching(
const gfx::Rect& match_rect) const {
return GetDisplayNearestPoint(match_rect.CenterPoint());
}
HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const {
aura::WindowTreeHost* host = window->GetHost();
return host ? host->GetAcceleratedWidget() : NULL;
}
gfx::NativeWindow DesktopScreenWin::GetNativeWindowFromHWND(HWND hwnd) const {
return (::IsWindow(hwnd)) ?
DesktopWindowTreeHostWin::GetContentWindowForHWND(hwnd) : NULL;
}
gfx::Screen* CreateDesktopScreen() {
return new DesktopScreenWin;
}
}