Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: components/mus/example/wm/move_loop.h

Issue 1416453005: Adds window resizing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/example/wm/BUILD.gn ('k') | components/mus/example/wm/move_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/example/wm/move_loop.h
diff --git a/components/mus/example/wm/move_loop.h b/components/mus/example/wm/move_loop.h
index 07aabc6fac8021054ac9b135cea3fe389aeafdc7..1e2a78ee55c698636a2d4e2d8057687242a4121e 100644
--- a/components/mus/example/wm/move_loop.h
+++ b/components/mus/example/wm/move_loop.h
@@ -23,6 +23,21 @@ class MoveLoop : public mus::WindowObserver {
DONE,
};
+ enum class HorizontalLocation {
+ LEFT,
+ RIGHT,
+ OTHER,
+ };
+
+ enum class VerticalLocation {
+ TOP,
+ BOTTOM,
+ OTHER,
+ };
+
+ // Number of pixels in which a resize is triggered.
+ static const int kResizeSize = 8;
+
~MoveLoop() override;
// If a move/resize loop should occur for the specified parameters creates
@@ -35,7 +50,22 @@ class MoveLoop : public mus::WindowObserver {
MoveResult Move(const mus::mojom::Event& event);
private:
- MoveLoop(mus::Window* target, const mus::mojom::Event& event);
+ enum class Type {
+ MOVE,
+ RESIZE,
+ };
+
+ MoveLoop(mus::Window* target,
+ const mus::mojom::Event& event,
+ Type type,
+ HorizontalLocation h_loc,
+ VerticalLocation v_loc);
+
+ static void DetermineType(mus::Window* target,
+ const gfx::Point& location,
+ Type* type,
+ HorizontalLocation* h_loc,
+ VerticalLocation* v_loc);
// Does the actual move/resize.
void MoveImpl(const mus::mojom::Event& event);
@@ -47,6 +77,8 @@ class MoveLoop : public mus::WindowObserver {
void Revert();
+ gfx::Rect DetermineBoundsFromDelta(const gfx::Vector2d& delta);
+
// mus::WindowObserver:
void OnTreeChanged(const TreeChangeParams& params) override;
void OnWindowBoundsChanged(mus::Window* window,
@@ -58,6 +90,10 @@ class MoveLoop : public mus::WindowObserver {
// window unexpectedly changes while the move is in progress.
mus::Window* target_;
+ const Type type_;
+ const HorizontalLocation h_loc_;
+ const VerticalLocation v_loc_;
+
// The id of the pointer that triggered the move.
const int32_t pointer_id_;
« no previous file with comments | « components/mus/example/wm/BUILD.gn ('k') | components/mus/example/wm/move_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698