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() {
LOG(ERROR) << "No wl_shm object";
return false;
}
if (!seat_) {
LOG(ERROR) << "No wl_seat object";
return false;
}
if (!shell_v6_ && !shell_) {
LOG(ERROR) << "No Wayland shell found";
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;
}
......@@ -122,13 +123,17 @@ void WaylandConnection::MaybePrepareReadQueue() {
}
void WaylandConnection::ScheduleFlush() {
if (scheduled_flush_)
return;
DCHECK(base::MessageLoopCurrentForUI::IsSet());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&WaylandConnection::Flush, base::Unretained(this)));
scheduled_flush_ = true;
// When we are in tests, the message loop is set later when the
// initialization of the OzonePlatform complete. Thus, just
// flush directly. This doesn't happen in normal run.
if (!base::MessageLoopCurrentForUI::IsSet()) {
Flush();
} else if (!scheduled_flush_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&WaylandConnection::Flush, base::Unretained(this)));
scheduled_flush_ = true;
}
}
void WaylandConnection::SetCursorBitmap(const std::vector<SkBitmap>& bitmaps,
......
......@@ -47,7 +47,11 @@ WaylandWindow* WaylandWindow::FromSurface(wl_surface* surface) {
void WaylandWindow::UpdateBufferScale(bool update_bounds) {
DCHECK(connection_->wayland_output_manager());
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();
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