Commit 4fd192a8 authored by Dominik Laskowski's avatar Dominik Laskowski Committed by Commit Bot

exo: Remove fallback for surface hierarchy

Clients without relative surface hierarchy are no longer in use.

Bug: b:77972398
Test: exo_unittests
Change-Id: Ief12aa0320747233853202389755ed816529971e
Reviewed-on: https://chromium-review.googlesource.com/1164549
Commit-Queue: Dominik Laskowski <domlaskowski@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581399}
parent ed7c7640
......@@ -807,16 +807,6 @@ gfx::Rect ClientControlledShellSurface::GetShadowBounds() const {
frame_view->GetWindowBoundsForClientBounds(shadow_bounds).size());
}
if (geometry_changed_callback_.is_null()) {
aura::Window* window = widget_->GetNativeWindow();
// Convert from screen to display coordinates.
wm::ConvertRectFromScreen(window->parent(), &shadow_bounds);
// Convert from display to window coordinates.
shadow_bounds -= window->bounds().OffsetFromOrigin();
}
return shadow_bounds;
}
......@@ -858,11 +848,7 @@ gfx::Rect ClientControlledShellSurface::GetWidgetBounds() const {
gfx::Point ClientControlledShellSurface::GetSurfaceOrigin() const {
DCHECK(resize_component_ == HTCAPTION);
if (geometry_changed_callback_)
return gfx::Point();
// TODO(oshima): geometry_changed_callback_ must be always set by now, so
// this is not necessary any more. Remove this.
return gfx::Point() - GetVisibleBounds().OffsetFromOrigin();
return gfx::Point();
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -41,14 +41,13 @@ class ClientControlledShellSurface
public display::DisplayObserver,
public ui::CompositorLockClient {
public:
using GeometryChangedCallback =
base::RepeatingCallback<void(const gfx::Rect& geometry)>;
ClientControlledShellSurface(Surface* surface,
bool can_minimize,
int container);
~ClientControlledShellSurface() override;
using GeometryChangedCallback =
base::RepeatingCallback<void(const gfx::Rect& geometry)>;
void set_geometry_changed_callback(const GeometryChangedCallback& callback) {
geometry_changed_callback_ = callback;
}
......
......@@ -371,12 +371,8 @@ TEST_F(ClientControlledShellSurfaceTest, ShadowWithStateChange) {
surface->SetFrame(SurfaceFrameType::SHADOW);
surface->Commit();
// Placing a shadow at screen origin will make the shadow's origin (-10, -10).
const gfx::Rect shadow_bounds(content_size);
// Expected shadow position/bounds in parent coordinates.
const gfx::Point expected_shadow_origin(-10, -10);
const gfx::Rect expected_shadow_bounds(expected_shadow_origin, content_size);
// In parent coordinates.
const gfx::Rect shadow_bounds(gfx::Point(-10, -10), content_size);
views::Widget* widget = shell_surface->GetWidget();
aura::Window* window = widget->GetNativeWindow();
......@@ -388,7 +384,7 @@ TEST_F(ClientControlledShellSurfaceTest, ShadowWithStateChange) {
EXPECT_TRUE(shadow->layer()->visible());
// Origin must be in sync.
EXPECT_EQ(expected_shadow_origin, shadow->content_bounds().origin());
EXPECT_EQ(shadow_bounds.origin(), shadow->content_bounds().origin());
const gfx::Rect work_area =
display::Screen::GetScreen()->GetPrimaryDisplay().work_area();
......@@ -405,13 +401,12 @@ TEST_F(ClientControlledShellSurfaceTest, ShadowWithStateChange) {
// area,/ thus not visible until new bounds is committed.
widget->Restore();
EXPECT_TRUE(shadow->layer()->visible());
const gfx::Rect shadow_in_maximized(expected_shadow_origin, work_area.size());
EXPECT_EQ(shadow_in_maximized, shadow->content_bounds());
EXPECT_EQ(work_area, shadow->content_bounds());
// The bounds is updated.
shell_surface->SetShadowBounds(shadow_bounds);
surface->Commit();
EXPECT_EQ(expected_shadow_bounds, shadow->content_bounds());
EXPECT_EQ(shadow_bounds, shadow->content_bounds());
}
TEST_F(ClientControlledShellSurfaceTest, ShadowWithTransform) {
......@@ -433,8 +428,8 @@ TEST_F(ClientControlledShellSurfaceTest, ShadowWithTransform) {
aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
ui::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
// Placing a shadow at screen origin will make the shadow's origin (-10, -10).
const gfx::Rect shadow_bounds(content_size);
// In parent coordinates.
const gfx::Rect shadow_bounds(gfx::Point(-10, -10), content_size);
// Shadow bounds relative to its parent should not be affected by a transform.
gfx::Transform transform;
......
......@@ -2550,10 +2550,6 @@ class WaylandRemoteShell : public ash::TabletModeObserver,
display::Screen::GetScreen()->RemoveObserver(this);
}
bool HasRelativeSurfaceHierarchy() const {
return wl_resource_get_version(remote_shell_resource_) >= 9;
}
std::unique_ptr<ClientControlledShellSurface> CreateShellSurface(
Surface* surface,
int container,
......@@ -2883,11 +2879,9 @@ void remote_shell_get_remote_surface(wl_client* client,
shell_surface->set_configure_callback(
base::Bind(&HandleRemoteSurfaceConfigureCallback,
base::Unretained(remote_surface_resource)));
if (shell->HasRelativeSurfaceHierarchy()) {
shell_surface->set_geometry_changed_callback(
base::BindRepeating(&HandleRemoteSurfaceGeometryChangedCallback,
base::Unretained(remote_surface_resource)));
}
shell_surface->set_geometry_changed_callback(
base::BindRepeating(&HandleRemoteSurfaceGeometryChangedCallback,
base::Unretained(remote_surface_resource)));
if (wl_resource_get_version(remote_surface_resource) >= 10) {
shell_surface->set_client_controlled_move_resize(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