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

Unified Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 15008002: Make touch-resizing windows to screen edge possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move border immediately under the finger + change snapping distance back to 16 Created 7 years, 6 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/workspace/workspace_window_resizer.cc
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index 25430933827c63762fb0e9b7dcc1cc1d348f5370..710eaad3f10c2bae279b97f6ff755cfe60f513ee 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -36,9 +36,11 @@
namespace ash {
-scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window,
- const gfx::Point& point_in_parent,
- int window_component) {
+scoped_ptr<WindowResizer> CreateWindowResizer(
+ aura::Window* window,
+ const gfx::Point& point_in_parent,
+ int window_component,
+ aura::client::WindowMoveSource source) {
DCHECK(window);
// No need to return a resizer when the window cannot get resized.
if (!wm::CanResizeWindow(window) && window_component != HTCAPTION)
@@ -56,18 +58,19 @@ scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window,
window,
point_in_parent,
window_component,
+ source,
std::vector<aura::Window*>());
} else if (wm::IsWindowNormal(window)) {
window_resizer = DefaultWindowResizer::Create(
- window, point_in_parent, window_component);
+ window, point_in_parent, window_component, source);
}
if (window_resizer) {
window_resizer = internal::DragWindowResizer::Create(
- window_resizer, window, point_in_parent, window_component);
+ window_resizer, window, point_in_parent, window_component, source);
}
if (window_resizer && window->type() == aura::client::WINDOW_TYPE_PANEL) {
window_resizer = PanelWindowResizer::Create(
- window_resizer, window, point_in_parent, window_component);
+ window_resizer, window, point_in_parent, window_component, source);
}
return make_scoped_ptr<WindowResizer>(window_resizer);
}
@@ -80,6 +83,10 @@ namespace {
// to move or resize beyond that edge.
const int kStickyDistancePixels = 64;
+// Snapping distance used instead of WorkspaceWindowResizer::kScreenEdgeInset
+// when resizing a window using touchscreen.
+const int kScreenEdgeInsetForTouchResize = 16;
sky 2013/06/14 15:57:27 I thought we were going to make this 32?
mohsen 2013/06/14 16:21:48 32 was for the case that we only wanted to use sna
sky 2013/06/14 16:25:07 I only mention it since I thought we agreed on 32
mohsen 2013/06/14 18:17:17 Well, I thought that was for when we only have sna
+
// Returns true if the window should stick to the edge.
bool ShouldStickToEdge(int distance_from_edge, int sticky_size) {
if (CommandLine::ForCurrentProcess()->HasSwitch(
@@ -310,8 +317,9 @@ WorkspaceWindowResizer* WorkspaceWindowResizer::Create(
aura::Window* window,
const gfx::Point& location_in_parent,
int window_component,
+ aura::client::WindowMoveSource source,
const std::vector<aura::Window*>& attached_windows) {
- Details details(window, location_in_parent, window_component);
+ Details details(window, location_in_parent, window_component, source);
return details.is_resizable ?
new WorkspaceWindowResizer(details, attached_windows) : NULL;
}
@@ -326,6 +334,9 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
} else if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshEnableStickyEdges)) {
sticky_size = kStickyDistancePixels;
+ } else if ((details_.bounds_change & kBoundsChange_Resizes) &&
+ details_.source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
+ sticky_size = kScreenEdgeInsetForTouchResize;
sky 2013/06/14 15:57:27 Do you want this only effect snapping to screen bo
mohsen 2013/06/14 16:21:48 The problem only happens for resizing to the scree
sky 2013/06/14 16:25:07 My point is that doing the change here effects *al
mohsen 2013/06/14 18:17:17 I think this sticy_size is only used for snapping
sky 2013/06/14 19:22:22 Ah yes, you are right. Sorry about that.
} else {
sticky_size = kScreenEdgeInset;
}

Powered by Google App Engine
This is Rietveld 408576698