Commit 407d5cfd authored by Nick Diego Yamane's avatar Nick Diego Yamane Committed by Commit Bot

ozone/wayland: Avoid unneeded subsequent xdg-decoration set_mode requests

xdg-decoration spec says:

 > [...] clients are responsible for preventing configure loops and
 > must make sure not to send multiple successive set_mode requests
 > with the same decoration mode.

which wasn't being done so far and issues like crbug.com/1131662 were
observed. This patch fixes it by avoiding re-sending subsequent set_mode
requests with the same decoration mode.

Additionally a few cleanups and style fixes are made.

R=msisov@igalia.com

Bug: 1131662
Change-Id: I7cb64557775fa8562284067fb90d8cba0dea5d84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2436851Reviewed-by: default avatarAntonio Gomes (GMT-4) <tonikitoo@igalia.com>
Reviewed-by: default avatarAbhijeet Kandalkar <abhijeet@igalia.com>
Reviewed-by: default avatarMaksim Sisov (GMT+3) <msisov@igalia.com>
Commit-Queue: Nick Yamane <nickdiego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#811600}
parent 55c6a3a8
......@@ -4,6 +4,7 @@
#include "ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h"
#include <xdg-decoration-unstable-v1-client-protocol.h>
#include <xdg-shell-client-protocol.h>
#include <xdg-shell-unstable-v6-client-protocol.h>
......@@ -205,7 +206,10 @@ void XDGSurfaceWrapperImpl::CloseTopLevelStable(
void XDGSurfaceWrapperImpl::SetTopLevelDecorationMode(
zxdg_toplevel_decoration_v1_mode requested_mode) {
zxdg_toplevel_decoration_mode_ = requested_mode;
if (requested_mode == decoration_mode_)
return;
decoration_mode_ = requested_mode;
zxdg_toplevel_decoration_v1_set_mode(zxdg_toplevel_decoration_.get(),
requested_mode);
}
......
......@@ -9,7 +9,9 @@
#include <xdg-decoration-unstable-v1-client-protocol.h>
#include "base/macros.h"
#include <cstdint>
#include <string>
#include "base/strings/string16.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
......@@ -27,6 +29,8 @@ class XDGSurfaceWrapperImpl : public ShellSurfaceWrapper {
public:
XDGSurfaceWrapperImpl(WaylandWindow* wayland_window,
WaylandConnection* connection);
XDGSurfaceWrapperImpl(const XDGSurfaceWrapperImpl&) = delete;
XDGSurfaceWrapperImpl& operator=(const XDGSurfaceWrapperImpl&) = delete;
~XDGSurfaceWrapperImpl() override;
// ShellSurfaceWrapper overrides:
......@@ -103,9 +107,11 @@ class XDGSurfaceWrapperImpl : public ShellSurfaceWrapper {
wl::Object<zxdg_toplevel_decoration_v1> zxdg_toplevel_decoration_;
bool surface_for_popup_ = false;
enum zxdg_toplevel_decoration_v1_mode zxdg_toplevel_decoration_mode_;
DISALLOW_COPY_AND_ASSIGN(XDGSurfaceWrapperImpl);
// Keeps track of the decoration mode currently in use if xdg-decoration
// protocol extension is available, otherwise CLIENT_SIDE is assumed.
enum zxdg_toplevel_decoration_v1_mode decoration_mode_ =
ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
};
} // namespace ui
......
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