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

Unified Diff: ui/ozone/platform/wayland/wayland_display.cc

Issue 2027943002: [WIP] Make content_shell run under Wayland Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/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..54efedbfc1f66682fc608a1156af6a05c7f6d009 100644
--- a/ui/ozone/platform/wayland/wayland_display.cc
+++ b/ui/ozone/platform/wayland/wayland_display.cc
@@ -23,9 +23,15 @@ const uint32_t kMaxShmVersion = 1;
const uint32_t kMaxXdgShellVersion = 1;
} // namespace
-WaylandDisplay::WaylandDisplay() {}
+WaylandDisplay* WaylandDisplay::instance_ = nullptr;
-WaylandDisplay::~WaylandDisplay() {}
+WaylandDisplay::WaylandDisplay() : desktop_platform_screen_delegate_(nullptr) {}
+
+WaylandDisplay::~WaylandDisplay() {
+ for (WaylandScreen* screen : screen_list_)
+ delete screen;
+ screen_list_.clear();
+}
bool WaylandDisplay::Initialize() {
static const wl_registry_listener registry_listener = {
@@ -64,6 +70,7 @@ bool WaylandDisplay::Initialize() {
return false;
}
+ instance_ = this;
return true;
}
@@ -127,6 +134,22 @@ void WaylandDisplay::OnFileCanReadWithoutBlocking(int fd) {
void WaylandDisplay::OnFileCanWriteWithoutBlocking(int fd) {}
+void WaylandDisplay::OutputSizeChanged(int32_t name,
+ unsigned width,
+ unsigned height) {
+ if (desktop_platform_screen_delegate_)
+ desktop_platform_screen_delegate_->OnOutputSizeChanged(name, width, height);
+}
+
+const std::vector<WaylandScreen*>& WaylandDisplay::GetScreenList() const {
+ return screen_list_;
+}
+
+void WaylandDisplay::SetDesktopScreenDelegate(
+ DesktopPlatformScreenDelegate* delegate) {
+ desktop_platform_screen_delegate_ = delegate;
+}
+
// static
void WaylandDisplay::Global(void* data,
wl_registry* registry,
@@ -169,6 +192,13 @@ 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->primary_screen_ = display->screen_list_.front();
}
display->ScheduleFlush();

Powered by Google App Engine
This is Rietveld 408576698