Commit b0eca47e authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[ozone/wayland] Wrap zaura_shell object with a WaylandZAuraRemote class

This is a follow up to https://crrev.com/c/2508132, where
the capability of firing tablet state changes was added to
EXO, via zaura_shell extension.

It wraps the current ui::WaylandConnection::zaura_shell_ instance
so that adding capabilities to listen to compositor event is easier
(see crrev.com/c/2491517 in relation chain).
No behavior change expected.

BUG=1113900

R=jamescook@chromium.org, rjkroege@chromium.org

Change-Id: I2f6e83d53ae05b5674dd2dfc9d7fe146cfd8e18c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510932
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823019}
parent cd39d85f
......@@ -126,6 +126,8 @@ source_set("wayland") {
"host/wayland_window_manager.h",
"host/wayland_window_observer.cc",
"host/wayland_window_observer.h",
"host/wayland_zaura_shell.cc",
"host/wayland_zaura_shell.h",
"host/wayland_zwp_linux_dmabuf.cc",
"host/wayland_zwp_linux_dmabuf.h",
"host/xdg_foreign_wrapper.cc",
......
......@@ -21,7 +21,6 @@
#include "ui/gfx/geometry/point.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/ozone/platform/wayland/host/gtk_primary_selection_device_manager.h"
#include "ui/ozone/platform/wayland/host/zwp_primary_selection_device_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h"
#include "ui/ozone/platform/wayland/host/wayland_clipboard.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor.h"
......@@ -38,8 +37,10 @@
#include "ui/ozone/platform/wayland/host/wayland_touch.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window_drag_controller.h"
#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h"
#include "ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.h"
#include "ui/ozone/platform/wayland/host/xdg_foreign_wrapper.h"
#include "ui/ozone/platform/wayland/host/zwp_primary_selection_device_manager.h"
#if defined(USE_LIBWAYLAND_STUBS)
#include <dlfcn.h>
......@@ -419,15 +420,16 @@ void WaylandConnection::Global(void* data,
auto wayland_drm = wl::Bind<struct wl_drm>(registry, name, version);
connection->drm_ =
std::make_unique<WaylandDrm>(wayland_drm.release(), connection);
} else if (!connection->aura_shell_ &&
} else if (!connection->zaura_shell_ &&
(strcmp(interface, "zaura_shell") == 0) &&
version >= kMinAuraShellVersion) {
connection->aura_shell_ =
wl::Bind<struct zaura_shell>(registry, name, version);
if (!connection->aura_shell_) {
auto zaura_shell = wl::Bind<struct zaura_shell>(registry, name, version);
if (!zaura_shell) {
LOG(ERROR) << "Failed to bind zaura_shell";
return;
}
connection->zaura_shell_ =
std::make_unique<WaylandZAuraShell>(zaura_shell.release(), connection);
} else if (!connection->xdg_decoration_manager_ &&
strcmp(interface, "zxdg_decoration_manager_v1") == 0) {
connection->xdg_decoration_manager_ =
......
......@@ -31,6 +31,7 @@ class WaylandOutputManager;
class WaylandPointer;
class WaylandShm;
class WaylandTouch;
class WaylandZAuraShell;
class WaylandZwpLinuxDmabuf;
class WaylandDataDeviceManager;
class WaylandCursorPosition;
......@@ -68,7 +69,6 @@ class WaylandConnection {
wp_viewporter* viewporter() const { return viewporter_.get(); }
xdg_wm_base* shell() const { return shell_.get(); }
zxdg_shell_v6* shell_v6() const { return shell_v6_.get(); }
zaura_shell* aura_shell() const { return aura_shell_.get(); }
wl_seat* seat() const { return seat_.get(); }
wp_presentation* presentation() const { return presentation_.get(); }
zwp_text_input_manager_v1* text_input_manager_v1() const {
......@@ -118,6 +118,8 @@ class WaylandConnection {
return buffer_manager_host_.get();
}
WaylandZAuraShell* zaura_shell() const { return zaura_shell_.get(); }
WaylandZwpLinuxDmabuf* zwp_dmabuf() const { return zwp_dmabuf_.get(); }
WaylandDrm* drm() const { return drm_.get(); }
......@@ -199,7 +201,6 @@ class WaylandConnection {
wl::Object<wp_viewporter> viewporter_;
wl::Object<zcr_keyboard_extension_v1> keyboard_extension_v1_;
wl::Object<zwp_text_input_manager_v1> text_input_manager_v1_;
wl::Object<zaura_shell> aura_shell_;
wl::Object<zwp_linux_explicit_synchronization_v1>
linux_explicit_synchronization_;
wl::Object<zxdg_decoration_manager_v1> xdg_decoration_manager_;
......@@ -218,6 +219,7 @@ class WaylandConnection {
std::unique_ptr<WaylandClipboard> clipboard_;
std::unique_ptr<WaylandOutputManager> wayland_output_manager_;
std::unique_ptr<WaylandCursorPosition> wayland_cursor_position_;
std::unique_ptr<WaylandZAuraShell> zaura_shell_;
std::unique_ptr<WaylandZwpLinuxDmabuf> zwp_dmabuf_;
std::unique_ptr<WaylandDrm> drm_;
std::unique_ptr<WaylandShm> shm_;
......
......@@ -21,6 +21,7 @@
#include "ui/ozone/platform/wayland/host/wayland_event_source.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window_drag_controller.h"
#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h"
#include "ui/platform_window/extensions/wayland_extension.h"
#include "ui/platform_window/wm/wm_drop_handler.h"
......@@ -431,10 +432,10 @@ void WaylandToplevelWindow::SetOrResetRestoredBounds() {
}
void WaylandToplevelWindow::InitializeAuraShell() {
if (connection()->aura_shell()) {
if (connection()->zaura_shell()) {
DCHECK(!aura_surface_);
aura_surface_.reset(zaura_shell_get_aura_surface(
connection()->aura_shell(), root_surface()->surface()));
connection()->zaura_shell()->wl_object(), root_surface()->surface()));
zaura_surface_set_fullscreen_mode(aura_surface_.get(),
ZAURA_SURFACE_FULLSCREEN_MODE_IMMERSIVE);
}
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h"
#include "base/check.h"
namespace ui {
WaylandZAuraShell::WaylandZAuraShell(zaura_shell* aura_shell,
WaylandConnection* connection)
: obj_(aura_shell), connection_(connection) {
DCHECK(obj_);
DCHECK(connection_);
}
WaylandZAuraShell::~WaylandZAuraShell() = default;
} // namespace ui
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_ZAURA_SHELL_H_
#define UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_ZAURA_SHELL_H_
#include "ui/ozone/platform/wayland/common/wayland_object.h"
namespace ui {
class WaylandConnection;
// Wraps the zaura_shell object.
class WaylandZAuraShell {
public:
WaylandZAuraShell(zaura_shell* aura_shell, WaylandConnection* connection);
WaylandZAuraShell(const WaylandZAuraShell&) = delete;
WaylandZAuraShell& operator=(const WaylandZAuraShell&) = delete;
~WaylandZAuraShell();
zaura_shell* wl_object() const { return obj_.get(); }
private:
wl::Object<zaura_shell> obj_;
WaylandConnection* const connection_;
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_ZAURA_SHELL_H_
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