Skip to content

Commit

Permalink
Defer calling WaylandToplevelWindow::InitializeAuraShell()
Browse files Browse the repository at this point in the history
... until the respective XDG surface is initialized.

The current call to WaylandToplevelWindow::InitializeAuraShell()
is not effective on Exo.
Basically, this method was being called prior to the respective
XDG surface got properly initialized on Exo.

Problem:

1) Lacros calls aura_surface_set_fullscreen_mode(), and Exo should
  processes the call like below:

  #1 exo::ShellSurfaceBase::SetUseImmersiveForFullscreen()
  #2 exo::Surface::SetUseImmersiveForFullscreen()
  #3 exo::wayland::AuraSurface::SetFullscreenMode()
  #4 exo::wayland::(anonymous namespace)::aura_surface_set_fullscreen_mode()

2) However, on frame #2, |exo::Surface::delegate_| was still NIL, and
  the call got bailed out.

3) |exo::Surface::delegate_| only gets assigned when Exo processes
  the call to xdg_wm_base_get_xdg_surface(), from the client side.

  #1 0x5563f0dbb100 exo::Surface::SetSurfaceDelegate()
  #2 0x5563f0dc1e33 exo::SurfaceTreeHost::SetRootSurface()
  #3 0x5563f0e02a23 exo::ShellSurfaceBase::ShellSurfaceBase()
  #4 0x5563f0dfdc65 exo::ShellSurface::ShellSurface()
  #5 0x5563f0e0f47f exo::XdgShellSurface::XdgShellSurface()
  #6 0x5563f0d95561 exo::Display::CreateXdgShellSurface()
  #7 0x5563ecbed19a exo::wayland::(anonymous namespace)::xdg_wm_base_get_xdg_surface()

CL fixes this by making the call to InitializeAuraShell() only
take place once the respective XDGSurface is initialized.

This is a fixup! of https://crrev.com/c/2353116.

BUG=1113900
R=msisov@igalia.com

Change-Id: I4169d30545238abf2ad46eaef9677a846d58c6f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566346
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: Maksim Sisov (GMT+2) <msisov@igalia.com>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#832825}
  • Loading branch information
tonikitoo authored and Chromium LUCI CQ committed Dec 2, 2020
1 parent ec0c537 commit 6fb4c47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ bool WaylandToplevelWindow::CreateShellSurface() {
shell_surface_->SetTitle(window_title_);
SetSizeConstraints();
TriggerStateChanges();
InitializeAuraShellSurface();
return true;
}

Expand Down Expand Up @@ -386,7 +387,6 @@ bool WaylandToplevelWindow::OnInitialize(
#endif
SetWaylandExtension(this, static_cast<WaylandExtension*>(this));
SetWmMoveLoopHandler(this, static_cast<WmMoveLoopHandler*>(this));
InitializeAuraShell();
return true;
}

Expand Down Expand Up @@ -465,9 +465,12 @@ void WaylandToplevelWindow::SetOrResetRestoredBounds() {
}
}

void WaylandToplevelWindow::InitializeAuraShell() {
if (connection()->zaura_shell()) {
DCHECK(!aura_surface_);
void WaylandToplevelWindow::InitializeAuraShellSurface() {
// InitializeAuraShellSurface() should be called after the XDG surface is
// initialized.
DCHECK(shell_surface_);

if (connection()->zaura_shell() && !aura_surface_) {
aura_surface_.reset(zaura_shell_get_aura_surface(
connection()->zaura_shell()->wl_object(), root_surface()->surface()));
zaura_surface_set_fullscreen_mode(aura_surface_.get(),
Expand Down
5 changes: 3 additions & 2 deletions ui/ozone/platform/wayland/host/wayland_toplevel_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class WaylandToplevelWindow : public WaylandWindow,

void SetOrResetRestoredBounds();

// Initializes the aura-shell EXO extension, if available.
void InitializeAuraShell();
// Initializes the aura-shell surface, in the case aura-shell EXO extension
// is available.
void InitializeAuraShellSurface();

// Wrappers around shell surface.
std::unique_ptr<ShellSurfaceWrapper> shell_surface_;
Expand Down

0 comments on commit 6fb4c47

Please sign in to comment.