Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: ui/gfx/screen_aurax11.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/screen_aura.cc ('k') | ui/gfx/screen_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen_aurax11.cc
diff --git a/ui/gfx/screen_aurax11.cc b/ui/gfx/screen_aurax11.cc
index 03b4e4e1f0cbad37ec9d847e9d18092cac311376..0f16bfebc2b18ae8d998ae37577634622f614e09 100644
--- a/ui/gfx/screen_aurax11.cc
+++ b/ui/gfx/screen_aurax11.cc
@@ -12,10 +12,21 @@
#if !defined(USE_ASH)
namespace gfx {
+namespace {
+gfx::Size Screen::GetPrimaryMonitorSize() {
+ ::Display* display = ui::GetXDisplay();
+ ::Screen* screen = DefaultScreenOfDisplay(display);
+ int width = WidthOfScreen(screen);
+ int height = HeightOfScreen(screen);
+
+ return gfx::Size(width, height);
+}
+} // namespace
// TODO(piman,erg): This file needs to be rewritten by someone who understands
// the subtlety of X11. That is not erg.
+// static
gfx::Point Screen::GetCursorScreenPoint() {
Display* display = ui::GetXDisplay();
@@ -36,67 +47,45 @@ gfx::Point Screen::GetCursorScreenPoint() {
return gfx::Point(root_x, root_y);
}
-gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(
- gfx::NativeView view) {
- // TODO(erg): There was a comment about how we shouldn't use _NET_WORKAREA
- // here by danakj@.
- return GetMonitorAreaNearestWindow(view);
-}
-
-gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeView view) {
- // TODO(erg): Yet another stub.
- return GetPrimaryMonitorBounds();
-}
-
// static
-gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
- // TODO(jamiewalch): Restrict this to the work area of the monitor.
- return GetMonitorAreaNearestPoint(point);
+gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
+ // TODO(erg): I have no clue. May need collaboration with
+ // RootWindowHostLinux?
+ return NULL;
}
// static
-gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
- // TODO(erg): gdk actually has a description for this! We can implement this
- // one.
- return GetPrimaryMonitorBounds();
-}
-
-gfx::Rect Screen::GetPrimaryMonitorWorkArea() {
- // TODO(erg): Also needs a real implementation.
- return gfx::Rect(gfx::Point(0, 0), GetPrimaryMonitorSize());
-}
-
-gfx::Rect Screen::GetPrimaryMonitorBounds() {
- // TODO(erg): Probably needs to be smarter?
- return gfx::Rect(gfx::Point(0, 0), GetPrimaryMonitorSize());
+int Screen::GetNumMonitors() {
+ // TODO(erg): Figure this out with oshima or piman because I have no clue
+ // about the Xinerama implications here.
+ return 1;
}
-gfx::Rect Screen::GetMonitorWorkAreaMatching(const gfx::Rect& match_rect) {
+// static
+Monitor Screen::GetMonitorNearestWindow(NativeWindow window) {
// TODO(erg): We need to eventually support multiple monitors.
- return GetPrimaryMonitorWorkArea();
+ return GetPrimaryMonitor();
}
-gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
- // TODO(erg): I have no clue. May need collaboration with
- // RootWindowHostLinux?
- return NULL;
+// static
+Monitor Screen::GetMonitorNearestPoint(const Point& point) {
+ // TODO(erg): We need to eventually support multiple monitors.
+ return GetPrimaryMonitor();
}
-gfx::Size Screen::GetPrimaryMonitorSize() {
- ::Display* display = ui::GetXDisplay();
- ::Screen* screen = DefaultScreenOfDisplay(display);
- int width = WidthOfScreen(screen);
- int height = HeightOfScreen(screen);
-
- return gfx::Size(width, height);
+// static
+Monitor Screen::GetPrimaryMonitor() {
+ // TODO(erg): There was a comment about how we shouldn't use _NET_WORKAREA
+ // for work area by danakj@.
+ // TODO(jamiewalch): Restrict work area to the actual work area of
+ // the monitor.
+ return Monitor(gfx::Rect(GetPrimaryMonitorSize()));
}
-int Screen::GetNumMonitors() {
- // TODO(erg): Figure this out with oshima or piman because I have no clue
- // about the Xinerama implications here.
- return 1;
+// static
+Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) {
+ return GetPrimaryMonitor();
}
} // namespace gfx
-
#endif // !defined(USE_ASH)
« no previous file with comments | « ui/gfx/screen_aura.cc ('k') | ui/gfx/screen_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698