Commit 1477a258 authored by Dominik Laskowski's avatar Dominik Laskowski Committed by Commit Bot

exo: Remove origin offset in ClientControlledShellSurface

The purpose of the origin offset was to adjust window geometry in screen
coordinates during display reconfiguration, but this is no longer needed
in the upcoming protocol with explicit target display.

Bug: b:77972398
Test: None
Change-Id: Id346b8c6c1a743975e5f9b075931635ac7697d53
Reviewed-on: https://chromium-review.googlesource.com/1164547Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Dominik Laskowski <domlaskowski@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581367}
parent d7406299
...@@ -268,10 +268,7 @@ class ClientControlledShellSurface::ScopedLockedToRoot { ...@@ -268,10 +268,7 @@ class ClientControlledShellSurface::ScopedLockedToRoot {
ClientControlledShellSurface::ClientControlledShellSurface(Surface* surface, ClientControlledShellSurface::ClientControlledShellSurface(Surface* surface,
bool can_minimize, bool can_minimize,
int container) int container)
: ShellSurfaceBase(surface, gfx::Point(), true, can_minimize, container), : ShellSurfaceBase(surface, gfx::Point(), true, can_minimize, container) {
primary_display_id_(
display::Screen::GetScreen()->GetPrimaryDisplay().id()) {
WMHelper::GetInstance()->AddDisplayConfigurationObserver(this);
display::Screen::GetScreen()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this);
} }
...@@ -279,7 +276,6 @@ ClientControlledShellSurface::~ClientControlledShellSurface() { ...@@ -279,7 +276,6 @@ ClientControlledShellSurface::~ClientControlledShellSurface() {
if (wide_frame_) if (wide_frame_)
wide_frame_->Close(); wide_frame_->Close();
WMHelper::GetInstance()->RemoveDisplayConfigurationObserver(this);
display::Screen::GetScreen()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this);
} }
...@@ -730,36 +726,6 @@ void ClientControlledShellSurface::OnDisplayMetricsChanged( ...@@ -730,36 +726,6 @@ void ClientControlledShellSurface::OnDisplayMetricsChanged(
EnsureCompositorIsLockedForOrientationChange(); EnsureCompositorIsLockedForOrientationChange();
} }
////////////////////////////////////////////////////////////////////////////////
// ash::WindowTreeHostManager::Observer overrides:
void ClientControlledShellSurface::OnDisplayConfigurationChanged() {
const display::Screen* screen = display::Screen::GetScreen();
int64_t primary_display_id = screen->GetPrimaryDisplay().id();
if (primary_display_id == primary_display_id_)
return;
display::Display old_primary_display;
if (screen->GetDisplayWithDisplayId(primary_display_id_,
&old_primary_display)) {
// Give the client a chance to adjust window positions before switching to
// the new coordinate system. Retain the old origin by reverting the origin
// delta until the next configure is acknowledged.
gfx::Vector2d delta = gfx::Point() - old_primary_display.bounds().origin();
origin_offset_ -= delta;
pending_origin_offset_accumulator_ += delta;
if (widget_) {
UpdateWidgetBounds();
UpdateShadow();
}
Configure();
}
primary_display_id_ = primary_display_id;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// ui::CompositorLockClient overrides: // ui::CompositorLockClient overrides:
...@@ -845,7 +811,6 @@ gfx::Rect ClientControlledShellSurface::GetShadowBounds() const { ...@@ -845,7 +811,6 @@ gfx::Rect ClientControlledShellSurface::GetShadowBounds() const {
aura::Window* window = widget_->GetNativeWindow(); aura::Window* window = widget_->GetNativeWindow();
// Convert from screen to display coordinates. // Convert from screen to display coordinates.
shadow_bounds -= origin_offset_;
wm::ConvertRectFromScreen(window->parent(), &shadow_bounds); wm::ConvertRectFromScreen(window->parent(), &shadow_bounds);
// Convert from display to window coordinates. // Convert from display to window coordinates.
...@@ -888,9 +853,7 @@ gfx::Rect ClientControlledShellSurface::GetWidgetBounds() const { ...@@ -888,9 +853,7 @@ gfx::Rect ClientControlledShellSurface::GetWidgetBounds() const {
return frame_view->GetWindowBoundsForClientBounds(GetVisibleBounds()); return frame_view->GetWindowBoundsForClientBounds(GetVisibleBounds());
} }
gfx::Rect bounds(GetVisibleBounds()); return GetVisibleBounds();
bounds.Offset(-origin_offset_.x(), -origin_offset_.y());
return bounds;
} }
gfx::Point ClientControlledShellSurface::GetSurfaceOrigin() const { gfx::Point ClientControlledShellSurface::GetSurfaceOrigin() const {
...@@ -899,8 +862,7 @@ gfx::Point ClientControlledShellSurface::GetSurfaceOrigin() const { ...@@ -899,8 +862,7 @@ gfx::Point ClientControlledShellSurface::GetSurfaceOrigin() const {
return gfx::Point(); return gfx::Point();
// TODO(oshima): geometry_changed_callback_ must be always set by now, so // TODO(oshima): geometry_changed_callback_ must be always set by now, so
// this is not necessary any more. Remove this. // this is not necessary any more. Remove this.
return gfx::Point() - return gfx::Point() - GetVisibleBounds().OffsetFromOrigin();
(GetVisibleBounds().origin() - origin_offset_).OffsetFromOrigin();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <string> #include <string>
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/display/window_tree_host_manager.h"
#include "ash/wm/client_controlled_state.h" #include "ash/wm/client_controlled_state.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -40,7 +39,6 @@ enum class Orientation { PORTRAIT, LANDSCAPE }; ...@@ -40,7 +39,6 @@ enum class Orientation { PORTRAIT, LANDSCAPE };
class ClientControlledShellSurface class ClientControlledShellSurface
: public ShellSurfaceBase, : public ShellSurfaceBase,
public display::DisplayObserver, public display::DisplayObserver,
public ash::WindowTreeHostManager::Observer,
public ui::CompositorLockClient { public ui::CompositorLockClient {
public: public:
using GeometryChangedCallback = using GeometryChangedCallback =
...@@ -216,9 +214,6 @@ class ClientControlledShellSurface ...@@ -216,9 +214,6 @@ class ClientControlledShellSurface
void OnDisplayMetricsChanged(const display::Display& display, void OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) override; uint32_t changed_metrics) override;
// Overridden from ash::WindowTreeHostManager::Observer:
void OnDisplayConfigurationChanged() override;
// Overridden from ui::CompositorLockClient: // Overridden from ui::CompositorLockClient:
void CompositorLockTimedOut() override; void CompositorLockTimedOut() override;
...@@ -268,7 +263,6 @@ class ClientControlledShellSurface ...@@ -268,7 +263,6 @@ class ClientControlledShellSurface
const ash::CustomFrameViewAsh* GetFrameView() const; const ash::CustomFrameViewAsh* GetFrameView() const;
GeometryChangedCallback geometry_changed_callback_; GeometryChangedCallback geometry_changed_callback_;
int64_t primary_display_id_;
int top_inset_height_ = 0; int top_inset_height_ = 0;
int pending_top_inset_height_ = 0; int pending_top_inset_height_ = 0;
......
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