Chromium Code Reviews| Index: components/exo/shell_surface.h |
| diff --git a/components/exo/shell_surface.h b/components/exo/shell_surface.h |
| index 6a85feb62f533f0e084c71e5893a7a9d59777e95..296259ba5dbfd8e26b67940cafcb857746573632 100644 |
| --- a/components/exo/shell_surface.h |
| +++ b/components/exo/shell_surface.h |
| @@ -47,9 +47,21 @@ class ShellSurface : public SurfaceDelegate, |
| public WMHelper::ActivationObserver, |
| public WMHelper::AccessibilityObserver { |
| public: |
| + enum class BoundsMode { SHELL, CLIENT, FIXED }; |
| + |
| + // The |origin| is in screen coordinates. When bounds are controlled by the |
| + // shell or fixed, it determines the initial position of the shell surface. |
| + // In that case, the position specified as part of the geometry is relative |
| + // to the shell surface. |
| + // |
| + // When bounds are controlled by the client, it represents the origin of a |
| + // coordinate system to which the position of the shell surface, specified |
| + // as part of the geometry, is relative. The client must acknowledge changes |
| + // to the origin, and offset the geometry accordingly. |
| ShellSurface(Surface* surface, |
| ShellSurface* parent, |
| - const gfx::Rect& initial_bounds, |
| + BoundsMode bounds_mode, |
| + const gfx::Point& origin, |
| bool activatable, |
| bool can_minimize, |
| int container); |
| @@ -62,6 +74,11 @@ class ShellSurface : public SurfaceDelegate, |
| close_callback_ = close_callback; |
| } |
| + // Set the callback to run when the shell surface is destroyed. |
| + void set_destroyed_callback(const base::Closure& destroyed_callback) { |
| + destroyed_callback_ = destroyed_callback; |
| + } |
| + |
| // Set the callback to run when the surface is destroyed. |
| void set_surface_destroyed_callback( |
| const base::Closure& surface_destroyed_callback) { |
| @@ -85,7 +102,8 @@ class ShellSurface : public SurfaceDelegate, |
| base::Callback<uint32_t(const gfx::Size& size, |
| ash::wm::WindowStateType state_type, |
| bool resizing, |
| - bool activated)>; |
| + bool activated, |
| + const gfx::Point& origin)>; |
| void set_configure_callback(const ConfigureCallback& configure_callback) { |
| configure_callback_ = configure_callback; |
| } |
| @@ -111,6 +129,10 @@ class ShellSurface : public SurfaceDelegate, |
| // Restore the shell surface. |
| void Restore(); |
| + // Start and stop a client-driven move of the shell surface. |
| + void SetMoving(); |
|
reveman
2017/02/06 19:49:34
Please remove all functionality related to this fr
Dominik Laskowski
2017/02/08 18:07:40
Done.
|
| + void UnsetMoving(bool revert); |
| + |
| // Set fullscreen state for shell surface. |
| void SetFullscreen(bool fullscreen); |
| @@ -266,6 +288,9 @@ class ShellSurface : public SurfaceDelegate, |
| // End current drag operation. |
| void EndDrag(bool revert); |
| + // End current drag or client-driven move. |
| + void EndDragOrMove(bool revert); |
| + |
| // Returns true if surface is currently being resized. |
| bool IsResizing() const; |
| @@ -279,14 +304,21 @@ class ShellSurface : public SurfaceDelegate, |
| // Updates the bounds of widget to match the current surface bounds. |
| void UpdateWidgetBounds(); |
| + // Updates the bounds of surface to match the current widget bounds. |
| + void UpdateSurfaceBounds(); |
| + |
| // Creates, deletes and update the shadow bounds based on |
| // |pending_shadow_content_bounds_|. |
| void UpdateShadow(); |
| + // In the coordinate system of the parent root window. |
| + gfx::Point GetMouseLocation() const; |
| + |
| views::Widget* widget_ = nullptr; |
| Surface* surface_; |
| aura::Window* parent_; |
| - gfx::Rect initial_bounds_; |
| + const BoundsMode bounds_mode_; |
| + gfx::Point origin_; |
| bool activatable_ = true; |
| const bool can_minimize_; |
| // Container Window Id (see ash/public/cpp/shell_window_ids.h) |
| @@ -301,14 +333,15 @@ class ShellSurface : public SurfaceDelegate, |
| double scale_ = 1.0; |
| double pending_scale_ = 1.0; |
| base::Closure close_callback_; |
| + base::Closure destroyed_callback_; |
|
reveman
2017/02/06 19:49:34
why is this needed? please remove if related to in
Dominik Laskowski
2017/02/08 18:07:40
WaylandRemoteShell updates the origin for each she
|
| base::Closure surface_destroyed_callback_; |
| StateChangedCallback state_changed_callback_; |
| ConfigureCallback configure_callback_; |
| ScopedConfigure* scoped_configure_ = nullptr; |
| bool ignore_window_bounds_changes_ = false; |
| - gfx::Point origin_; |
| + gfx::Vector2d origin_offset_; |
| gfx::Vector2d pending_origin_offset_; |
| - gfx::Vector2d pending_origin_config_offset_; |
| + gfx::Vector2d pending_origin_offset_accumulator_; |
|
reveman
2017/02/06 19:49:34
I guess this is just a cleanup? Can you keep it as
Dominik Laskowski
2017/02/08 18:07:40
The diff for this rename is small, and the change
|
| int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) |
| int pending_resize_component_ = HTCAPTION; |
| aura::Window* shadow_overlay_ = nullptr; |
| @@ -318,6 +351,7 @@ class ShellSurface : public SurfaceDelegate, |
| float shadow_background_opacity_ = 1.0; |
| std::deque<Config> pending_configs_; |
| std::unique_ptr<ash::WindowResizer> resizer_; |
| + std::unique_ptr<ash::WindowResizer> move_resizer_; |
|
reveman
2017/02/06 19:49:34
please remove from this patch
Dominik Laskowski
2017/02/08 18:07:40
Done.
|
| std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; |
| int top_inset_height_ = 0; |
| int pending_top_inset_height_ = 0; |