Commit 7f69b097 authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

ozone/wayland: Allow to run ozone/wayland without wl_seat.

This change removes hard requirement on a wl_seat and allows
to run Ozone/Wayland without that. This is required by 1)
tests that will be run with headless weston 2) systems that
run without any perihperial peripheral devices.

TBR=spang@chromium.org

Bug: 1029241
Change-Id: I9970052b3d6d593591eb93738d0b83218abd1353
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2088852Reviewed-by: default avatarMaksim Sisov <msisov@igalia.com>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#747153}
parent cf67a5c0
...@@ -83,15 +83,16 @@ bool WaylandConnection::Initialize() { ...@@ -83,15 +83,16 @@ bool WaylandConnection::Initialize() {
LOG(ERROR) << "No wl_shm object"; LOG(ERROR) << "No wl_shm object";
return false; return false;
} }
if (!seat_) {
LOG(ERROR) << "No wl_seat object";
return false;
}
if (!shell_v6_ && !shell_) { if (!shell_v6_ && !shell_) {
LOG(ERROR) << "No Wayland shell found"; LOG(ERROR) << "No Wayland shell found";
return false; return false;
} }
// When we are running tests with weston in headless mode, the seat is not
// announced.
if (!seat_)
LOG(WARNING) << "No wl_seat object. The functionality may suffer.";
return true; return true;
} }
...@@ -122,13 +123,17 @@ void WaylandConnection::MaybePrepareReadQueue() { ...@@ -122,13 +123,17 @@ void WaylandConnection::MaybePrepareReadQueue() {
} }
void WaylandConnection::ScheduleFlush() { void WaylandConnection::ScheduleFlush() {
if (scheduled_flush_) // When we are in tests, the message loop is set later when the
return; // initialization of the OzonePlatform complete. Thus, just
DCHECK(base::MessageLoopCurrentForUI::IsSet()); // flush directly. This doesn't happen in normal run.
base::ThreadTaskRunnerHandle::Get()->PostTask( if (!base::MessageLoopCurrentForUI::IsSet()) {
FROM_HERE, Flush();
base::BindOnce(&WaylandConnection::Flush, base::Unretained(this))); } else if (!scheduled_flush_) {
scheduled_flush_ = true; base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&WaylandConnection::Flush, base::Unretained(this)));
scheduled_flush_ = true;
}
} }
void WaylandConnection::SetCursorBitmap(const std::vector<SkBitmap>& bitmaps, void WaylandConnection::SetCursorBitmap(const std::vector<SkBitmap>& bitmaps,
......
...@@ -47,7 +47,11 @@ WaylandWindow* WaylandWindow::FromSurface(wl_surface* surface) { ...@@ -47,7 +47,11 @@ WaylandWindow* WaylandWindow::FromSurface(wl_surface* surface) {
void WaylandWindow::UpdateBufferScale(bool update_bounds) { void WaylandWindow::UpdateBufferScale(bool update_bounds) {
DCHECK(connection_->wayland_output_manager()); DCHECK(connection_->wayland_output_manager());
const auto* screen = connection_->wayland_output_manager()->wayland_screen(); const auto* screen = connection_->wayland_output_manager()->wayland_screen();
DCHECK(screen);
// The client might not create screen at all.
if (!screen)
return;
const auto widget = GetWidget(); const auto widget = GetWidget();
int32_t new_scale = 0; int32_t new_scale = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment