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

Unified Diff: ui/aura/monitor_manager.cc

Issue 9701098: MultiMonitor support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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
Index: ui/aura/monitor_manager.cc
diff --git a/ui/aura/monitor_manager.cc b/ui/aura/monitor_manager.cc
index 542750f2d6c0cbbe308706da41fa94bdcaed0da6..78a2c2600de9fdcf30710042e56a9e0f96b9d911 100644
--- a/ui/aura/monitor_manager.cc
+++ b/ui/aura/monitor_manager.cc
@@ -4,7 +4,22 @@
#include "ui/aura/monitor_manager.h"
+#include <stdio.h>
+
+#include "ui/aura/monitor.h"
+#include "ui/aura/root_window_host.h"
+#include "ui/gfx/rect.h"
+
namespace aura {
+namespace {
+// Default bounds for a monitor.
+static const int kDefaultHostWindowX = 200;
+static const int kDefaultHostWindowY = 200;
+static const int kDefaultHostWindowWidth = 1280;
+static const int kDefaultHostWindowHeight = 1024;
+} // namespace
+
+bool MonitorManager::use_fullscreen_host_window_ = false;
MonitorManager::MonitorManager() {
}
@@ -21,7 +36,7 @@ void MonitorManager::RemoveObserver(MonitorObserver* observer) {
}
RootWindow* MonitorManager::CreateRootWindowForPrimaryMonitor() {
- return CreateRootWindowForMonitor(GetPrimaryMonitor());
+ return CreateRootWindowForMonitor(GetMonitorAt(0));
}
void MonitorManager::NotifyBoundsChanged(const Monitor* monitor) {
@@ -29,4 +44,21 @@ void MonitorManager::NotifyBoundsChanged(const Monitor* monitor) {
OnMonitorBoundsChanged(monitor));
}
+Monitor* MonitorManager::CreateMonitorFromSpec(const std::string& spec) {
+ gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY,
+ kDefaultHostWindowWidth, kDefaultHostWindowHeight);
+ int x = 0, y = 0, width, height;
+ if (sscanf(spec.c_str(), "%dx%d", &width, &height) == 2) {
+ bounds.set_size(gfx::Size(width, height));
+ } else if (sscanf(spec.c_str(), "%d+%d-%dx%d", &x, &y, &width, &height)
+ == 4) {
+ bounds = gfx::Rect(x, y, width, height);
+ } else if (use_fullscreen_host_window_) {
+ bounds = gfx::Rect(aura::RootWindowHost::GetNativeScreenSize());
+ }
+ Monitor* monitor = new Monitor();
+ monitor->set_bounds(bounds);
+ return monitor;
+}
+
} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698