Skip to content

Commit

Permalink
ozone/wayland: Remove ScopedDisableClientSideDecorationsForTest
Browse files Browse the repository at this point in the history
https://crrev.com/c/4745201 removed the //chrome parts using it, so we
can remove the implementation in //ui/ozone as well.

Bug: 1220274
Change-Id: Iad50870d7e4426bb9818497ec6a311aaf76121a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4797739
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Commit-Queue: Max Ihlenfeldt <max@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1186369}
  • Loading branch information
MaxIhlenfeldt authored and Chromium LUCI CQ committed Aug 22, 2023
1 parent f4997f1 commit 2acba6b
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 66 deletions.
13 changes: 1 addition & 12 deletions ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@
#include "chromeos/crosapi/cpp/crosapi_constants.h"
#endif

namespace wl {

bool g_disallow_setting_decoration_insets_for_testing = false;

void AllowClientSideDecorationsForTesting(bool allow) {
g_disallow_setting_decoration_insets_for_testing = !allow;
}

} // namespace wl

namespace ui {

namespace {
Expand Down Expand Up @@ -364,8 +354,7 @@ bool WaylandToplevelWindow::ShouldUpdateWindowShape() const {
}

bool WaylandToplevelWindow::CanSetDecorationInsets() const {
return connection()->SupportsSetWindowGeometry() &&
!wl::g_disallow_setting_decoration_insets_for_testing;
return connection()->SupportsSetWindowGeometry();
}

void WaylandToplevelWindow::SetOpaqueRegion(
Expand Down
12 changes: 0 additions & 12 deletions ui/ozone/platform/wayland/host/wayland_toplevel_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ namespace views::corewm {
enum class TooltipTrigger;
} // namespace views::corewm

namespace wl {

// Client-side decorations on Wayland take some portion of the window surface,
// and when they are turned on or off, the window geometry is changed. That
// happens only once at the moment of switching the decoration mode, and has
// no further impact on the user experience, but the initial geometry of a
// top-level window is different on Wayland if compared to other platforms,
// which affects certain tests.
void AllowClientSideDecorationsForTesting(bool allow);

} // namespace wl

namespace ui {

class GtkSurface1;
Expand Down
21 changes: 0 additions & 21 deletions ui/ozone/platform/wayland/wayland_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@

namespace ui {

namespace {

class WaylandScopedDisableClientSideDecorationsForTest
: public PlatformUtils::ScopedDisableClientSideDecorationsForTest {
public:
WaylandScopedDisableClientSideDecorationsForTest() {
wl::AllowClientSideDecorationsForTesting(false);
}

~WaylandScopedDisableClientSideDecorationsForTest() override {
wl::AllowClientSideDecorationsForTesting(true);
}
};

} // namespace

WaylandUtils::WaylandUtils(WaylandConnection* connection)
: connection_(connection) {}

Expand All @@ -42,11 +26,6 @@ std::string WaylandUtils::GetWmWindowClass(
return desktop_base_name;
}

std::unique_ptr<PlatformUtils::ScopedDisableClientSideDecorationsForTest>
WaylandUtils::DisableClientSideDecorationsForTest() {
return std::make_unique<WaylandScopedDisableClientSideDecorationsForTest>();
}

void WaylandUtils::OnUnhandledKeyEvent(const KeyEvent& key_event) {
auto* seat = connection_->seat();
if (!seat)
Expand Down
2 changes: 0 additions & 2 deletions ui/ozone/platform/wayland/wayland_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class WaylandUtils : public PlatformUtils {

gfx::ImageSkia GetNativeWindowIcon(intptr_t target_window_id) override;
std::string GetWmWindowClass(const std::string& desktop_base_name) override;
std::unique_ptr<PlatformUtils::ScopedDisableClientSideDecorationsForTest>
DisableClientSideDecorationsForTest() override;
void OnUnhandledKeyEvent(const KeyEvent& key_event) override;

private:
Expand Down
5 changes: 0 additions & 5 deletions ui/ozone/platform/x11/x11_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ std::string X11Utils::GetWmWindowClass(const std::string& desktop_base_name) {
return window_class;
}

std::unique_ptr<PlatformUtils::ScopedDisableClientSideDecorationsForTest>
X11Utils::DisableClientSideDecorationsForTest() {
return {};
}

void X11Utils::OnUnhandledKeyEvent(const KeyEvent& key_event) {
// Do nothing.
}
Expand Down
2 changes: 0 additions & 2 deletions ui/ozone/platform/x11/x11_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class X11Utils : public PlatformUtils {

gfx::ImageSkia GetNativeWindowIcon(intptr_t target_window_id) override;
std::string GetWmWindowClass(const std::string& desktop_base_name) override;
std::unique_ptr<PlatformUtils::ScopedDisableClientSideDecorationsForTest>
DisableClientSideDecorationsForTest() override;
void OnUnhandledKeyEvent(const KeyEvent& key_event) override;
};

Expand Down
12 changes: 0 additions & 12 deletions ui/ozone/public/platform_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ class KeyEvent;
// Ozone.
class COMPONENT_EXPORT(OZONE_BASE) PlatformUtils {
public:
class ScopedDisableClientSideDecorationsForTest {
public:
ScopedDisableClientSideDecorationsForTest() = default;
virtual ~ScopedDisableClientSideDecorationsForTest() = default;
};

virtual ~PlatformUtils() = default;

// Returns an icon for a native window referred by |target_window_id|. Can be
Expand All @@ -43,12 +37,6 @@ class COMPONENT_EXPORT(OZONE_BASE) PlatformUtils {
virtual std::string GetWmWindowClass(
const std::string& desktop_base_name) = 0;

// Disables client-side decorations for the lifetime of the returned object.
// Client-side decorations are implemented platform-specific way, which may
// affect tests.
virtual std::unique_ptr<ScopedDisableClientSideDecorationsForTest>
DisableClientSideDecorationsForTest() = 0;

// Called when it is found that a KeyEvent is not consumed.
virtual void OnUnhandledKeyEvent(const KeyEvent& key_event) = 0;
};
Expand Down

0 comments on commit 2acba6b

Please sign in to comment.