diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 17:26:19 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 17:26:19 +0000 |
commit | f1ddc1da13daa47d4513ead413cd167faadd4c71 (patch) | |
tree | 15b5e919b8b43a92f38adbf6ba2bdd296327a3ef | |
parent | 7e2d6e1cdbc0f6c05c5db1262f9d2a8d2eec1edb (diff) | |
download | chromium_src-f1ddc1da13daa47d4513ead413cd167faadd4c71.zip chromium_src-f1ddc1da13daa47d4513ead413cd167faadd4c71.tar.gz chromium_src-f1ddc1da13daa47d4513ead413cd167faadd4c71.tar.bz2 |
Cleanup:
- added GetRootWindowForDisplay
- Hookup GetDisplayMatching to DisplayManager
- Fixed comments
- Moved the display code from Shell to MultiDisplayManager
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10697071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145690 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/display/display_controller.cc | 4 | ||||
-rw-r--r-- | ash/display/display_controller.h | 3 | ||||
-rw-r--r-- | ash/display/multi_display_manager.cc | 68 | ||||
-rw-r--r-- | ash/display/multi_display_manager.h | 5 | ||||
-rw-r--r-- | ash/screen_ash.cc | 4 | ||||
-rw-r--r-- | ash/screen_ash.h | 2 | ||||
-rw-r--r-- | ash/shell.cc | 41 | ||||
-rw-r--r-- | ui/aura/desktop/desktop_screen_win.cc | 5 | ||||
-rw-r--r-- | ui/aura/desktop/desktop_screen_win.h | 2 | ||||
-rw-r--r-- | ui/aura/desktop/desktop_screen_x11.cc | 8 | ||||
-rw-r--r-- | ui/aura/display_manager.h | 7 | ||||
-rw-r--r-- | ui/aura/single_display_manager.cc | 5 | ||||
-rw-r--r-- | ui/aura/single_display_manager.h | 2 | ||||
-rw-r--r-- | ui/aura/test/test_screen.cc | 4 | ||||
-rw-r--r-- | ui/aura/test/test_screen.h | 2 | ||||
-rw-r--r-- | ui/gfx/screen.h | 6 | ||||
-rw-r--r-- | ui/gfx/screen_aura.cc | 11 | ||||
-rw-r--r-- | ui/gfx/screen_gtk.cc | 12 | ||||
-rw-r--r-- | ui/gfx/screen_impl.h | 6 | ||||
-rw-r--r-- | ui/gfx/screen_mac.mm | 12 | ||||
-rw-r--r-- | ui/gfx/screen_win.cc | 16 |
21 files changed, 138 insertions, 87 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index 5fb110e..f37903e 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -72,6 +72,10 @@ aura::RootWindow* DisplayController::GetPrimaryRootWindow() { return root_windows_[0]; } +aura::RootWindow* DisplayController::GetRootWindowForDisplayId(int id) { + return root_windows_[id]; +} + void DisplayController::CloseChildWindows() { for (std::map<int, aura::RootWindow*>::const_iterator it = root_windows_.begin(); it != root_windows_.end(); ++it) { diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h index 458b8ce..5497955 100644 --- a/ash/display/display_controller.h +++ b/ash/display/display_controller.h @@ -51,6 +51,9 @@ class ASH_EXPORT DisplayController : public aura::DisplayObserver { // Returns the root window for primary display. aura::RootWindow* GetPrimaryRootWindow(); + // Returns the root window for |display_id|. + aura::RootWindow* GetRootWindowForDisplayId(int id); + // Closes all child windows in the all root windows. void CloseChildWindows(); diff --git a/ash/display/multi_display_manager.cc b/ash/display/multi_display_manager.cc index 4a2de52..1060748 100644 --- a/ash/display/multi_display_manager.cc +++ b/ash/display/multi_display_manager.cc @@ -7,6 +7,7 @@ #include <string> #include <vector> +#include "ash/display/display_controller.h" #include "base/command_line.h" #include "base/stl_util.h" #include "base/string_split.h" @@ -58,12 +59,22 @@ void MultiDisplayManager::CycleDisplay() { manager->CycleDisplayImpl(); } - void MultiDisplayManager::ToggleDisplayScale() { +void MultiDisplayManager::ToggleDisplayScale() { MultiDisplayManager* manager = static_cast<MultiDisplayManager*>( aura::Env::GetInstance()->display_manager()); manager->ScaleDisplayImpl(); } +bool MultiDisplayManager::UpdateWorkAreaOfDisplayNearestWindow( + const aura::Window* window, + const gfx::Insets& insets) { + const RootWindow* root = window->GetRootWindow(); + gfx::Display& display = FindDisplayForRootWindow(root); + gfx::Rect old_work_area = display.work_area(); + display.UpdateWorkAreaFromInsets(insets); + return old_work_area != display.work_area(); +} + void MultiDisplayManager::OnNativeDisplaysChanged( const std::vector<gfx::Display>& new_displays) { size_t min = std::min(displays_.size(), new_displays.size()); @@ -134,10 +145,8 @@ size_t MultiDisplayManager::GetNumDisplays() const { const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( const Window* window) const { - if (!window) { - MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); - return *manager->GetDisplayAt(0); - } + if (!window) + return displays_[0]; const RootWindow* root = window->GetRootWindow(); MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay(); @@ -145,10 +154,41 @@ const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( const gfx::Point& point) const { - // TODO(oshima): For m19, mouse is constrained within - // the primary window. - MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); - return *manager->GetDisplayAt(0); + if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) + return displays_[0]; + + for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); + iter != displays_.end(); ++iter) { + const gfx::Display& display = *iter; + if (display.bounds().Contains(point)) + return display; + } + // Fallback to the primary display if there is no root display containing + // the |point|. + return displays_[0]; +} + +const gfx::Display& MultiDisplayManager::GetDisplayMatching( + const gfx::Rect& rect) const { + if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) + return displays_[0]; + if (rect.IsEmpty()) + return GetDisplayNearestPoint(rect.origin()); + + int max = 0; + const gfx::Display* matching = 0; + for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); + iter != displays_.end(); ++iter) { + const gfx::Display& display = *iter; + gfx::Rect intersect = display.bounds().Intersect(rect); + int area = intersect.width() * intersect.height(); + if (area > max) { + max = area; + matching = &(*iter); + } + } + // Fallback to the primary display if there is no matching display. + return matching ? *matching : displays_[0]; } void MultiDisplayManager::OnRootWindowResized(const aura::RootWindow* root, @@ -160,16 +200,6 @@ void MultiDisplayManager::OnRootWindowResized(const aura::RootWindow* root, } } -bool MultiDisplayManager::UpdateWorkAreaOfDisplayNearestWindow( - const aura::Window* window, - const gfx::Insets& insets) { - const RootWindow* root = window->GetRootWindow(); - gfx::Display& display = FindDisplayForRootWindow(root); - gfx::Rect old_work_area = display.work_area(); - display.UpdateWorkAreaFromInsets(insets); - return old_work_area != display.work_area(); -} - void MultiDisplayManager::Init() { // TODO(oshima): Move this logic to DisplayChangeObserver. const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( diff --git a/ash/display/multi_display_manager.h b/ash/display/multi_display_manager.h index 69f14ae..5c4bb12 100644 --- a/ash/display/multi_display_manager.h +++ b/ash/display/multi_display_manager.h @@ -16,8 +16,9 @@ #include "ui/aura/window.h" namespace gfx { -class Insets; class Display; +class Insets; +class Rect; } namespace ash { @@ -56,6 +57,8 @@ class ASH_EXPORT MultiDisplayManager : public aura::DisplayManager, const gfx::Point& point) const OVERRIDE; virtual const gfx::Display& GetDisplayNearestWindow( const aura::Window* window) const OVERRIDE; + virtual const gfx::Display& GetDisplayMatching( + const gfx::Rect& match_rect)const OVERRIDE; // RootWindowObserver overrides: virtual void OnRootWindowResized(const aura::RootWindow* root, diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc index 054b01f..ccfb97e 100644 --- a/ash/screen_ash.cc +++ b/ash/screen_ash.cc @@ -66,6 +66,10 @@ gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { return GetDisplayManager()->GetDisplayNearestPoint(point); } +gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const { + return GetDisplayManager()->GetDisplayMatching(match_rect); +} + gfx::Display ScreenAsh::GetPrimaryDisplay() const { return *GetDisplayManager()->GetDisplayAt(0); } diff --git a/ash/screen_ash.h b/ash/screen_ash.h index bd987d3..0ac4dcb 100644 --- a/ash/screen_ash.h +++ b/ash/screen_ash.h @@ -37,6 +37,8 @@ class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl { gfx::NativeView view) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: diff --git a/ash/shell.cc b/ash/shell.cc index 236a1ec..bf0d151 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -322,45 +322,16 @@ aura::RootWindow* Shell::GetActiveRootWindow() { // static aura::RootWindow* Shell::GetRootWindowAt(const gfx::Point& point) { - if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) - return GetPrimaryRootWindow(); - RootWindowList root_windows = GetAllRootWindows(); - for (RootWindowList::const_iterator iter = root_windows.begin(); - iter != root_windows.end(); ++iter) { - aura::RootWindow* root_window = *iter; - const gfx::Display& display = - gfx::Screen::GetDisplayNearestWindow(root_window); - if (display.bounds().Contains(point)) - return root_window; - } - // Fallback to the primary window if there is no root window containing - // the |point|. - return GetPrimaryRootWindow(); + const gfx::Display& display = gfx::Screen::GetDisplayNearestPoint(point); + return Shell::GetInstance()->display_controller()-> + GetRootWindowForDisplayId(display.id()); } // static aura::RootWindow* Shell::GetRootWindowMatching(const gfx::Rect& rect) { - if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) - return GetPrimaryRootWindow(); - if (rect.IsEmpty()) - return GetRootWindowAt(rect.origin()); - RootWindowList root_windows = GetAllRootWindows(); - int max = 0; - aura::RootWindow* matching = NULL; - for (RootWindowList::const_iterator iter = root_windows.begin(); - iter != root_windows.end(); ++iter) { - aura::RootWindow* root_window = *iter; - const gfx::Display& display = - gfx::Screen::GetDisplayNearestWindow(root_window); - gfx::Rect intersect = display.bounds().Intersect(rect); - int area = intersect.width() * intersect.height(); - if (area > max) { - max = area; - matching = root_window; - } - } - // Fallback to the primary window if there is no matching root window. - return matching ? matching : GetPrimaryRootWindow(); + const gfx::Display& display = gfx::Screen::GetDisplayMatching(rect); + return Shell::GetInstance()->display_controller()-> + GetRootWindowForDisplayId(display.id()); } // static diff --git a/ui/aura/desktop/desktop_screen_win.cc b/ui/aura/desktop/desktop_screen_win.cc index 5738d9b..593f4f2 100644 --- a/ui/aura/desktop/desktop_screen_win.cc +++ b/ui/aura/desktop/desktop_screen_win.cc @@ -85,6 +85,11 @@ gfx::Display DesktopScreenWin::GetDisplayNearestPoint( return gfx::Display(); } +gfx::Display DesktopScreenWin::GetDisplayMatching( + const gfx::Rect& match_rect) const { + return GetDisplayNearestPoint(match_rect.CenterPoint()); +} + gfx::Display DesktopScreenWin::GetPrimaryDisplay() const { MONITORINFO mi = GetMonitorInfoForMonitor( MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); diff --git a/ui/aura/desktop/desktop_screen_win.h b/ui/aura/desktop/desktop_screen_win.h index 97eddb0..51c4f81 100644 --- a/ui/aura/desktop/desktop_screen_win.h +++ b/ui/aura/desktop/desktop_screen_win.h @@ -24,6 +24,8 @@ public: gfx::NativeView window) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: diff --git a/ui/aura/desktop/desktop_screen_x11.cc b/ui/aura/desktop/desktop_screen_x11.cc index e8f2e66..9577037 100644 --- a/ui/aura/desktop/desktop_screen_x11.cc +++ b/ui/aura/desktop/desktop_screen_x11.cc @@ -43,6 +43,8 @@ class DesktopScreenX11 : public gfx::ScreenImpl { gfx::NativeView window) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: @@ -104,6 +106,12 @@ gfx::Display DesktopScreenX11::GetDisplayNearestPoint( return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); } +gfx::Display DesktopScreenX11::GetDisplayMatching( + const gfx::Rect& match_rect) const { + // TODO(erg): Do the right thing once we know what that is. + return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); +} + gfx::Display DesktopScreenX11::GetPrimaryDisplay() const { // TODO(erg): Do the right thing once we know what that is. return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); diff --git a/ui/aura/display_manager.h b/ui/aura/display_manager.h index 49f65c0..023d76b 100644 --- a/ui/aura/display_manager.h +++ b/ui/aura/display_manager.h @@ -16,6 +16,7 @@ namespace gfx { class Display; class Point; +class Rect; class Size; } @@ -76,10 +77,14 @@ class AURA_EXPORT DisplayManager { virtual const gfx::Display& GetDisplayNearestWindow( const Window* window) const = 0; - // Returns the display object nearest given |pint|. + // Returns the display object nearest given |point|. virtual const gfx::Display& GetDisplayNearestPoint( const gfx::Point& point) const = 0; + // Returns the display that most closely intersects |match_rect|. + virtual const gfx::Display& GetDisplayMatching( + const gfx::Rect& match_rect) const = 0; + protected: // Calls observers' OnDisplayBoundsChanged methods. void NotifyBoundsChanged(const gfx::Display& display); diff --git a/ui/aura/single_display_manager.cc b/ui/aura/single_display_manager.cc index 64b8d07..384c3c3 100644 --- a/ui/aura/single_display_manager.cc +++ b/ui/aura/single_display_manager.cc @@ -72,6 +72,11 @@ const gfx::Display& SingleDisplayManager::GetDisplayNearestPoint( return display_; } +const gfx::Display& SingleDisplayManager::GetDisplayMatching( + const gfx::Rect& match_rect) const { + return display_; +} + void SingleDisplayManager::OnWindowBoundsChanged( Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { if (!use_fullscreen_host_window()) { diff --git a/ui/aura/single_display_manager.h b/ui/aura/single_display_manager.h index dca839a..82bfc35 100644 --- a/ui/aura/single_display_manager.h +++ b/ui/aura/single_display_manager.h @@ -38,6 +38,8 @@ class AURA_EXPORT SingleDisplayManager : public DisplayManager, const Window* window) const OVERRIDE; virtual const gfx::Display& GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual const gfx::Display& GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; // WindowObserver overrides: virtual void OnWindowBoundsChanged(Window* window, diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc index 95019a4..5d0a497 100644 --- a/ui/aura/test/test_screen.cc +++ b/ui/aura/test/test_screen.cc @@ -41,6 +41,10 @@ gfx::Display TestScreen::GetDisplayNearestPoint(const gfx::Point& point) const { return GetMonitor(); } +gfx::Display TestScreen::GetDisplayMatching(const gfx::Rect& match_rect) const { + return GetMonitor(); +} + gfx::Display TestScreen::GetPrimaryDisplay() const { return GetMonitor(); } diff --git a/ui/aura/test/test_screen.h b/ui/aura/test/test_screen.h index 399b486..143a979 100644 --- a/ui/aura/test/test_screen.h +++ b/ui/aura/test/test_screen.h @@ -27,6 +27,8 @@ class TestScreen : public gfx::ScreenImpl { gfx::NativeView view) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h index 69a6726..1819a9d 100644 --- a/ui/gfx/screen.h +++ b/ui/gfx/screen.h @@ -47,12 +47,12 @@ class UI_EXPORT Screen { // Returns the the display nearest the specified point. static gfx::Display GetDisplayNearestPoint(const gfx::Point& point); - // Returns the bounds of the work area of the primary display. - static gfx::Display GetPrimaryDisplay(); - // Returns the display that most closely intersects the provided bounds. static gfx::Display GetDisplayMatching(const gfx::Rect& match_rect); + // Returns the primary display. + static gfx::Display GetPrimaryDisplay(); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(Screen); }; diff --git a/ui/gfx/screen_aura.cc b/ui/gfx/screen_aura.cc index 851b976..befdeaf 100644 --- a/ui/gfx/screen_aura.cc +++ b/ui/gfx/screen_aura.cc @@ -23,9 +23,6 @@ void Screen::SetInstance(ScreenImpl* screen) { g_instance_ = screen; } -// TODO(oshima): Implement ScreenImpl for Linux/aura and remove this -// ifdef. - // static bool Screen::IsDIPEnabled() { return true; @@ -57,13 +54,13 @@ Display Screen::GetDisplayNearestPoint(const Point& point) { } // static -Display Screen::GetPrimaryDisplay() { - return g_instance_->GetPrimaryDisplay(); +Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { + return g_instance_->GetDisplayMatching(match_rect); } // static -Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { - return g_instance_->GetDisplayNearestPoint(match_rect.CenterPoint()); +Display Screen::GetPrimaryDisplay() { + return g_instance_->GetPrimaryDisplay(); } } // namespace gfx diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc index 3cae772..7b0b34c 100644 --- a/ui/gfx/screen_gtk.cc +++ b/ui/gfx/screen_gtk.cc @@ -129,6 +129,12 @@ gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { } // static +gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { + // TODO(thestig) Implement multi-monitor support. + return GetPrimaryDisplay(); +} + +// static gfx::Display Screen::GetPrimaryDisplay() { gfx::Rect bounds = NativePrimaryMonitorBounds(); // TODO(oshima): Implement ID and Observer. @@ -144,12 +150,6 @@ gfx::Display Screen::GetPrimaryDisplay() { } // static -gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { - // TODO(thestig) Implement multi-monitor support. - return GetPrimaryDisplay(); -} - -// static int Screen::GetNumDisplays() { // This query is kinda bogus for Linux -- do we want number of X screens? // The number of monitors Xinerama has? We'll just use whatever GDK uses. diff --git a/ui/gfx/screen_impl.h b/ui/gfx/screen_impl.h index 39e8f25..d75dbc5 100644 --- a/ui/gfx/screen_impl.h +++ b/ui/gfx/screen_impl.h @@ -8,9 +8,11 @@ #include "ui/gfx/display.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/point.h" namespace gfx { +class Display; +class Point; +class Rect; // A class that provides |gfx::Screen|'s implementation on aura. class UI_EXPORT ScreenImpl { @@ -25,6 +27,8 @@ class UI_EXPORT ScreenImpl { gfx::NativeView window) const = 0; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const = 0; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const = 0; virtual gfx::Display GetPrimaryDisplay() const = 0; }; diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm index 018e954..927970a 100644 --- a/ui/gfx/screen_mac.mm +++ b/ui/gfx/screen_mac.mm @@ -98,6 +98,12 @@ gfx::Display Screen::GetDisplayNearestWindow(gfx::NativeView view) { } // static +gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { + NSScreen* match_screen = GetMatchingScreen(match_rect); + return GetDisplayForScreen(match_screen, false /* may not be primary */); +} + +// static gfx::Display Screen::GetPrimaryDisplay() { // Primary display is defined as the display with the menubar, // which is always at index 0. @@ -107,12 +113,6 @@ gfx::Display Screen::GetPrimaryDisplay() { } // static -gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { - NSScreen* match_screen = GetMatchingScreen(match_rect); - return GetDisplayForScreen(match_screen, false /* may not be primary */); -} - -// static int Screen::GetNumDisplays() { // Don't just return the number of online displays. It includes displays // that mirror other displays, which are not desired in the count. It's diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc index 5f1d7de..4758360 100644 --- a/ui/gfx/screen_win.cc +++ b/ui/gfx/screen_win.cc @@ -73,6 +73,14 @@ gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { } // static +gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { + RECT other_bounds_rect = match_rect.ToRECT(); + MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( + &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); + return GetDisplay(monitor_info); +} + +// static gfx::Display Screen::GetPrimaryDisplay() { MONITORINFO mi = GetMonitorInfoForMonitor( MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); @@ -82,12 +90,4 @@ gfx::Display Screen::GetPrimaryDisplay() { return display; } -// static -gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { - RECT other_bounds_rect = match_rect.ToRECT(); - MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( - &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); - return GetDisplay(monitor_info); -} - } // namespace gfx |