Commit 649a7d8a authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[ozone/wayland] zaura_shell initial support

This allows lacros/chrome to auto hide/show ChromeOS shelf
when it enters in fullscreen mode. It is the so called
'immersive fullscreen' mode that chromeos/chrome has.

MANUAL TEST: Enter lacros/chrome in fullscreen and hover
the mouse pointer over the bottom border of the screen
(shelf area). The shelf should slide-up.

Note that this brings lacros/chrome fullscreen behavior
closer to chromeos/chrome's. In a follow up CL, the omnibox
widget that slides down from the upper border of Ash will
be plumbed up to lacros/chrome.

BUG=1113900
R=msisov@igalia.com, nickdiego@igalia.com

Change-Id: I4b7c04d18b73747a0c70bffa5a6d6741df6c4346
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353116Reviewed-by: default avatarMaksim Sisov (GMT+3) <msisov@igalia.com>
Reviewed-by: default avatarNick Yamane <nickdiego@igalia.com>
Commit-Queue: Antonio Gomes (GMT-4) <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#798117}
parent 17f99ea4
......@@ -146,6 +146,7 @@ source_set("wayland") {
"//base",
"//build:lacros_buildflags",
"//build/config/linux/libdrm",
"//components/exo/wayland/protocol:aura_shell_protocol",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//skia",
......
......@@ -4,6 +4,7 @@
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include <aura-shell-client-protocol.h>
#include <gtk-primary-selection-client-protocol.h>
#include <keyboard-extension-unstable-v1-client-protocol.h>
#include <linux-dmabuf-unstable-v1-client-protocol.h>
......@@ -190,6 +191,15 @@ const wl_interface* ObjectTraits<xdg_positioner>::interface =
void (*ObjectTraits<xdg_positioner>::deleter)(xdg_positioner*) =
&xdg_positioner_destroy;
const wl_interface* ObjectTraits<zaura_shell>::interface =
&zaura_shell_interface;
void (*ObjectTraits<zaura_shell>::deleter)(zaura_shell*) = &zaura_shell_destroy;
const wl_interface* ObjectTraits<zaura_surface>::interface =
&zaura_surface_interface;
void (*ObjectTraits<zaura_surface>::deleter)(zaura_surface*) =
&zaura_surface_destroy;
const wl_interface* ObjectTraits<zcr_keyboard_extension_v1>::interface =
&zcr_keyboard_extension_v1_interface;
void (*ObjectTraits<zcr_keyboard_extension_v1>::deleter)(
......
......@@ -39,6 +39,8 @@ struct xdg_surface;
struct xdg_toplevel;
struct xdg_popup;
struct xdg_positioner;
struct zaura_shell;
struct zaura_surface;
struct zcr_keyboard_extension_v1;
struct zcr_extended_keyboard_v1;
struct zwp_linux_dmabuf_v1;
......@@ -247,6 +249,18 @@ struct ObjectTraits<xdg_positioner> {
static void (*deleter)(xdg_positioner*);
};
template <>
struct ObjectTraits<zaura_shell> {
static const wl_interface* interface;
static void (*deleter)(zaura_shell*);
};
template <>
struct ObjectTraits<zaura_surface> {
static const wl_interface* interface;
static void (*deleter)(zaura_surface*);
};
template <>
struct ObjectTraits<zcr_keyboard_extension_v1> {
static const wl_interface* interface;
......
......@@ -52,6 +52,7 @@ constexpr uint32_t kMaxXdgShellVersion = 1;
constexpr uint32_t kMaxDeviceManagerVersion = 3;
constexpr uint32_t kMaxWpPresentationVersion = 1;
constexpr uint32_t kMaxTextInputManagerVersion = 1;
constexpr uint32_t kMinAuraShellVersion = 10;
constexpr uint32_t kMinWlDrmVersion = 2;
constexpr uint32_t kMinWlOutputVersion = 2;
} // namespace
......@@ -365,6 +366,15 @@ 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_ &&
(strcmp(interface, "zaura_shell") == 0) &&
version >= kMinAuraShellVersion) {
connection->aura_shell_ =
wl::Bind<struct zaura_shell>(registry, name, version);
if (!connection->aura_shell_) {
LOG(ERROR) << "Failed to bind zaura_shell";
return;
}
}
connection->ScheduleFlush();
......
......@@ -54,6 +54,7 @@ class WaylandConnection {
wl_subcompositor* subcompositor() const { return subcompositor_.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 {
......@@ -165,6 +166,7 @@ class WaylandConnection {
wl::Object<wp_presentation> presentation_;
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_;
// Event source instance. Must be declared before input objects so it
// outlives them so thus being able to properly handle their destruction.
......
......@@ -4,6 +4,7 @@
#include "ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h"
#include <aura-shell-client-protocol.h>
#include <xdg-shell-client-protocol.h>
#include <xdg-shell-unstable-v6-client-protocol.h>
......@@ -327,6 +328,14 @@ bool XDGSurfaceWrapperImpl::InitializeV6(bool with_toplevel) {
}
zxdg_toplevel_v6_add_listener(zxdg_toplevel_v6_.get(),
&zxdg_toplevel_v6_listener, this);
if (connection_->aura_shell()) {
aura_surface_.reset(zaura_shell_get_aura_surface(
connection_->aura_shell(), wayland_window_->root_surface()->surface()));
zaura_surface_set_fullscreen_mode(aura_surface_.get(),
ZAURA_SURFACE_FULLSCREEN_MODE_IMMERSIVE);
}
wayland_window_->root_surface()->Commit();
connection_->ScheduleFlush();
return true;
......
......@@ -87,6 +87,7 @@ class XDGSurfaceWrapperImpl : public ShellSurfaceWrapper {
wl::Object<zxdg_toplevel_v6> zxdg_toplevel_v6_;
wl::Object<struct xdg_surface> xdg_surface_;
wl::Object<xdg_toplevel> xdg_toplevel_;
wl::Object<zaura_surface> aura_surface_;
bool surface_for_popup_ = false;
......
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