diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/test/test_screen.cc | 6 | ||||
-rw-r--r-- | ui/aura/test/test_screen.h | 3 | ||||
-rw-r--r-- | ui/gfx/screen.h | 7 | ||||
-rw-r--r-- | ui/gfx/screen_android.cc | 6 | ||||
-rw-r--r-- | ui/gfx/screen_gtk.cc | 7 | ||||
-rw-r--r-- | ui/gfx/screen_ios.mm | 7 | ||||
-rw-r--r-- | ui/gfx/screen_mac.mm | 7 | ||||
-rw-r--r-- | ui/gfx/screen_win.cc | 7 | ||||
-rw-r--r-- | ui/gfx/screen_win.h | 3 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_screen_x11.cc | 10 |
10 files changed, 52 insertions, 11 deletions
diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc index 13d1232..474ac29 100644 --- a/ui/aura/test/test_screen.cc +++ b/ui/aura/test/test_screen.cc @@ -113,10 +113,14 @@ gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPoint() { return root_window_->GetTopWindowContainingPoint(point); } -int TestScreen::GetNumDisplays() { +int TestScreen::GetNumDisplays() const { return 1; } +std::vector<gfx::Display> TestScreen::GetAllDisplays() const { + return std::vector<gfx::Display>(1, display_); +} + gfx::Display TestScreen::GetDisplayNearestWindow( gfx::NativeWindow window) const { return display_; diff --git a/ui/aura/test/test_screen.h b/ui/aura/test/test_screen.h index c4615c7..00d684b 100644 --- a/ui/aura/test/test_screen.h +++ b/ui/aura/test/test_screen.h @@ -48,7 +48,8 @@ class TestScreen : public gfx::Screen, virtual bool IsDIPEnabled() OVERRIDE; virtual gfx::Point GetCursorScreenPoint() OVERRIDE; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; - virtual int GetNumDisplays() OVERRIDE; + virtual int GetNumDisplays() const OVERRIDE; + virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView view) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h index 9410d02..7958f65 100644 --- a/ui/gfx/screen.h +++ b/ui/gfx/screen.h @@ -5,6 +5,8 @@ #ifndef UI_GFX_SCREEN_H_ #define UI_GFX_SCREEN_H_ +#include <vector> + #include "base/basictypes.h" #include "ui/base/ui_export.h" #include "ui/gfx/display.h" @@ -55,7 +57,10 @@ class UI_EXPORT Screen { // Returns the number of displays. // Mirrored displays are excluded; this method is intended to return the // number of distinct, usable displays. - virtual int GetNumDisplays() = 0; + virtual int GetNumDisplays() const = 0; + + // Returns the list of displays that are currently available. + virtual std::vector<gfx::Display> GetAllDisplays() const = 0; // Returns the display nearest the specified window. virtual gfx::Display GetDisplayNearestWindow(NativeView view) const = 0; diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc index 6c4d633..1376136 100644 --- a/ui/gfx/screen_android.cc +++ b/ui/gfx/screen_android.cc @@ -50,7 +50,11 @@ class ScreenAndroid : public Screen { return GetPrimaryDisplay(); } - virtual int GetNumDisplays() OVERRIDE { return 1; } + virtual int GetNumDisplays() const OVERRIDE { return 1; } + + virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + return std::vector<gfx::Display>(1, GetPrimaryDisplay()); + } virtual gfx::Display GetDisplayMatching( const gfx::Rect& match_rect) const OVERRIDE { diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc index 8ef803d..85dd87e 100644 --- a/ui/gfx/screen_gtk.cc +++ b/ui/gfx/screen_gtk.cc @@ -107,13 +107,18 @@ class ScreenGtk : public gfx::Screen { // Returns the number of displays. // Mirrored displays are excluded; this method is intended to return the // number of distinct, usable displays. - virtual int GetNumDisplays() OVERRIDE { + virtual int GetNumDisplays() const OVERRIDE { // 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. GdkScreen* screen = gdk_screen_get_default(); return gdk_screen_get_n_monitors(screen); } + virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + NOTIMPLEMENTED(); + return std::vector<gfx::Display>(1, GetPrimaryDisplay()); + } + // Returns the display nearest the specified window. virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView view) const OVERRIDE { diff --git a/ui/gfx/screen_ios.mm b/ui/gfx/screen_ios.mm index dfb0d1b..6450e14 100644 --- a/ui/gfx/screen_ios.mm +++ b/ui/gfx/screen_ios.mm @@ -26,7 +26,7 @@ class ScreenIos : public gfx::Screen { return gfx::NativeWindow(); } - virtual int GetNumDisplays() OVERRIDE { + virtual int GetNumDisplays() const OVERRIDE { #if TARGET_IPHONE_SIMULATOR // UIScreen does not reliably return correct results on the simulator. return 1; @@ -35,6 +35,11 @@ class ScreenIos : public gfx::Screen { #endif } + virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + NOTIMPLEMENTED(); + return std::vector<gfx::Display>(1, GetPrimaryDisplay()); + } + // Returns the display nearest the specified window. virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView view) const OVERRIDE { diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm index d9e1f0a..8f85ae6 100644 --- a/ui/gfx/screen_mac.mm +++ b/ui/gfx/screen_mac.mm @@ -89,7 +89,7 @@ class ScreenMac : public gfx::Screen { return gfx::NativeWindow(); } - virtual int GetNumDisplays() OVERRIDE { + virtual int GetNumDisplays() const OVERRIDE { // 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 // tempting to use the count returned by CGGetActiveDisplayList, but active @@ -123,6 +123,11 @@ class ScreenMac : public gfx::Screen { return display_count; } + virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + NOTIMPLEMENTED(); + return std::vector<gfx::Display>(1, GetPrimaryDisplay()); + } + virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView view) const OVERRIDE { NSWindow* window = [view window]; diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc index 8bb1548..23dbc9d 100644 --- a/ui/gfx/screen_win.cc +++ b/ui/gfx/screen_win.cc @@ -55,10 +55,15 @@ gfx::NativeWindow ScreenWin::GetWindowAtCursorScreenPoint() { return GetNativeWindowFromHWND(window_hwnd); } -int ScreenWin::GetNumDisplays() { +int ScreenWin::GetNumDisplays() const { return GetSystemMetrics(SM_CMONITORS); } +std::vector<gfx::Display> ScreenWin::GetAllDisplays() const { + NOTIMPLEMENTED(); + return std::vector<gfx::Display>(1, GetPrimaryDisplay()); +} + gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const { HWND window_hwnd = GetHWNDFromNativeView(window); if (!window_hwnd) { diff --git a/ui/gfx/screen_win.h b/ui/gfx/screen_win.h index f6b7d40a..cc59352 100644 --- a/ui/gfx/screen_win.h +++ b/ui/gfx/screen_win.h @@ -21,7 +21,8 @@ class UI_EXPORT ScreenWin : public gfx::Screen { virtual bool IsDIPEnabled() OVERRIDE; virtual gfx::Point GetCursorScreenPoint() OVERRIDE; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; - virtual int GetNumDisplays() OVERRIDE; + virtual int GetNumDisplays() const OVERRIDE; + virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView window) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc index 77dbaa4..a462da7 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc @@ -39,7 +39,8 @@ class DesktopScreenX11 : public gfx::Screen { virtual bool IsDIPEnabled() OVERRIDE; virtual gfx::Point GetCursorScreenPoint() OVERRIDE; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; - virtual int GetNumDisplays() OVERRIDE; + virtual int GetNumDisplays() const OVERRIDE; + virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView window) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( @@ -95,12 +96,17 @@ gfx::NativeWindow DesktopScreenX11::GetWindowAtCursorScreenPoint() { return NULL; } -int DesktopScreenX11::GetNumDisplays() { +int DesktopScreenX11::GetNumDisplays() const { // TODO(erg): Figure this out with oshima or piman because I have no clue // about the XRandR implications here. return 1; } +std::vector<gfx::Display> DesktopScreenX11::GetAllDisplays() const { + // TODO(erg): Do the right thing once we know what that is. + return std::vector<gfx::Display>(1, GetPrimaryDisplay()); +} + gfx::Display DesktopScreenX11::GetDisplayNearestWindow( gfx::NativeView window) const { // TODO(erg): Do the right thing once we know what that is. |