Index: ui/ozone/platform/wayland/wayland_display.cc |
diff --git a/ui/ozone/platform/wayland/wayland_display.cc b/ui/ozone/platform/wayland/wayland_display.cc |
index 4feb9d7d103496d9977783dd22bd4da09c47a83f..b6e5c5e5241797d8d3abdb898308074bab07a292 100644 |
--- a/ui/ozone/platform/wayland/wayland_display.cc |
+++ b/ui/ozone/platform/wayland/wayland_display.cc |
@@ -23,9 +23,16 @@ const uint32_t kMaxShmVersion = 1; |
const uint32_t kMaxXdgShellVersion = 1; |
} // namespace |
+WaylandDisplay* WaylandDisplay::instance_ = nullptr; |
Michael Forney
2016/06/10 18:12:21
Why do we need to make this a singleton?
joone
2016/06/14 00:04:43
We don't need WaylandDisplay::instance any more si
|
+ |
WaylandDisplay::WaylandDisplay() {} |
-WaylandDisplay::~WaylandDisplay() {} |
+WaylandDisplay::~WaylandDisplay() { |
+ for (WaylandScreen* screen : screen_list_) |
+ delete screen; |
+ screen_list_.clear(); |
+ instance_ = nullptr; |
+} |
bool WaylandDisplay::Initialize() { |
static const wl_registry_listener registry_listener = { |
@@ -64,6 +71,7 @@ bool WaylandDisplay::Initialize() { |
return false; |
} |
+ instance_ = this; |
return true; |
} |
@@ -106,6 +114,12 @@ void WaylandDisplay::RemoveWindow(gfx::AcceleratedWidget widget) { |
window_map_.erase(widget); |
} |
+WaylandScreen* WaylandDisplay::PrimaryScreen() const { |
+ if (!screen_list_.size()) |
+ return nullptr; |
+ return screen_list_.front(); |
+} |
+ |
void WaylandDisplay::OnDispatcherListChanged() { |
StartProcessingEvents(); |
} |
@@ -127,6 +141,21 @@ void WaylandDisplay::OnFileCanReadWithoutBlocking(int fd) { |
void WaylandDisplay::OnFileCanWriteWithoutBlocking(int fd) {} |
+void WaylandDisplay::OnOutputGeometryChanged(int32_t name, |
+ const gfx::Rect& rect) { |
+ display::Screen::GetScreen()->OnOutputGeometryChanged(name, rect); |
Michael Forney
2016/06/10 18:12:21
Can't WaylandScreen call this?
Also, maybe I'm mi
joone
2016/06/14 00:04:43
I missed to include the header file.
|
+ if (!output_complete_closure_.is_null()) |
+ output_complete_closure_.Run(); |
+} |
+ |
+void WaylandDisplay::SetOutputCompleteClosure(const base::Closure& closure) { |
+ output_complete_closure_ = closure; |
Michael Forney
2016/06/10 18:12:21
I think this should be a method on WaylandScreen.
joone
2016/06/14 00:04:43
Done.
|
+} |
+ |
+const std::vector<WaylandScreen*>& WaylandDisplay::GetScreenList() const { |
+ return screen_list_; |
+} |
+ |
// static |
void WaylandDisplay::Global(void* data, |
wl_registry* registry, |
@@ -169,6 +198,12 @@ void WaylandDisplay::Global(void* data, |
xdg_shell_add_listener(display->shell_.get(), &shell_listener, display); |
xdg_shell_use_unstable_version(display->shell_.get(), |
XDG_SHELL_VERSION_CURRENT); |
+ } else if (strcmp(interface, "wl_output") == 0) { |
+ WaylandScreen* screen = new WaylandScreen(registry, name); |
+ if (!display->screen_list_.empty()) |
+ NOTIMPLEMENTED() << "Multiple screens support is not implemented"; |
+ |
+ display->screen_list_.push_back(screen); |
} |
display->ScheduleFlush(); |