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

Unified Diff: ash/wm/window_util.cc

Issue 14273008: Add ash-enable-sticky-edges for 'sticky' instead of 'snap' behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
Index: ash/wm/window_util.cc
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 481a27cbc8a2bba583409e0afe69fd52cba5bf3e..7f41badf1e93f6feb9004ebc6850719fbc032bc8 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -7,11 +7,14 @@
#include <vector>
#include "ash/ash_constants.h"
+#include "ash/ash_switches.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/activation_controller.h"
#include "ash/wm/window_properties.h"
+#include "ash/wm/workspace/workspace_window_resizer.h"
+#include "base/command_line.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
@@ -25,6 +28,14 @@
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
+namespace {
+
+// Number of pixels of mouse movement required before windows drag or resize
+// beyond the edge of a workspace.
+const int kWindowStickySize = 64;
+
+}
+
namespace ash {
namespace wm {
@@ -218,5 +229,17 @@ bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) {
return true;
}
+bool ShouldStickToEdge(int distance_from_edge) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshEnableStickyEdges)) {
+ return distance_from_edge < 0 &&
+ distance_from_edge > -kWindowStickySize;
+ } else {
+ const int sticky_size = internal::WorkspaceWindowResizer::kScreenEdgeInset;
flackr 2013/04/16 00:32:14 Assuming this method stays here we should probably
stevenjb 2013/04/16 20:08:20 Moved back.
+ return distance_from_edge < sticky_size &&
+ distance_from_edge > -sticky_size * 2;
+ }
+}
+
} // namespace wm
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698