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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 67403003: Don't lock the cursor when dragging or resizing a window with touch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return 0; 337 return 0;
338 } 338 }
339 339
340 private: 340 private:
341 int size_; 341 int size_;
342 int min_; 342 int min_;
343 int max_; 343 int max_;
344 }; 344 };
345 345
346 WorkspaceWindowResizer::~WorkspaceWindowResizer() { 346 WorkspaceWindowResizer::~WorkspaceWindowResizer() {
347 Shell* shell = Shell::GetInstance(); 347 if (did_lock_cursor_) {
348 shell->cursor_manager()->UnlockCursor(); 348 Shell* shell = Shell::GetInstance();
349 shell->cursor_manager()->UnlockCursor();
350 }
349 if (instance_ == this) 351 if (instance_ == this)
350 instance_ = NULL; 352 instance_ = NULL;
351 } 353 }
352 354
353 // static 355 // static
354 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( 356 WorkspaceWindowResizer* WorkspaceWindowResizer::Create(
355 aura::Window* window, 357 aura::Window* window,
356 const gfx::Point& location_in_parent, 358 const gfx::Point& location_in_parent,
357 int window_component, 359 int window_component,
358 aura::client::WindowMoveSource source, 360 aura::client::WindowMoveSource source,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 500
499 const gfx::Point& WorkspaceWindowResizer::GetInitialLocation() const { 501 const gfx::Point& WorkspaceWindowResizer::GetInitialLocation() const {
500 return details_.initial_location_in_parent; 502 return details_.initial_location_in_parent;
501 } 503 }
502 504
503 WorkspaceWindowResizer::WorkspaceWindowResizer( 505 WorkspaceWindowResizer::WorkspaceWindowResizer(
504 const Details& details, 506 const Details& details,
505 const std::vector<aura::Window*>& attached_windows) 507 const std::vector<aura::Window*>& attached_windows)
506 : details_(details), 508 : details_(details),
507 attached_windows_(attached_windows), 509 attached_windows_(attached_windows),
510 did_lock_cursor_(false),
508 did_move_or_resize_(false), 511 did_move_or_resize_(false),
509 total_min_(0), 512 total_min_(0),
510 total_initial_size_(0), 513 total_initial_size_(0),
511 snap_type_(SNAP_NONE), 514 snap_type_(SNAP_NONE),
512 num_mouse_moves_since_bounds_change_(0), 515 num_mouse_moves_since_bounds_change_(0),
513 magnetism_window_(NULL), 516 magnetism_window_(NULL),
514 weak_ptr_factory_(this) { 517 weak_ptr_factory_(this) {
515 DCHECK(details_.is_resizable); 518 DCHECK(details_.is_resizable);
516 519
517 Shell* shell = Shell::GetInstance(); 520 // A mousemove should still show the cursor even if the window is
518 shell->cursor_manager()->LockCursor(); 521 // being moved or resized with touch, so do not lock the cursor.
522 if (details.source != aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
523 Shell* shell = Shell::GetInstance();
524 shell->cursor_manager()->LockCursor();
525 did_lock_cursor_ = true;
526 }
519 527
520 aura::Window* dock_container = Shell::GetContainer( 528 aura::Window* dock_container = Shell::GetContainer(
521 window()->GetRootWindow(), kShellWindowId_DockedContainer); 529 window()->GetRootWindow(), kShellWindowId_DockedContainer);
522 dock_layout_ = static_cast<DockedWindowLayoutManager*>( 530 dock_layout_ = static_cast<DockedWindowLayoutManager*>(
523 dock_container->layout_manager()); 531 dock_container->layout_manager());
524 532
525 // Only support attaching to the right/bottom. 533 // Only support attaching to the right/bottom.
526 DCHECK(attached_windows_.empty() || 534 DCHECK(attached_windows_.empty() ||
527 (details.window_component == HTRIGHT || 535 (details.window_component == HTRIGHT ||
528 details.window_component == HTBOTTOM)); 536 details.window_component == HTBOTTOM));
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 if (!dock_layout_->is_dragged_window_docked()) 1031 if (!dock_layout_->is_dragged_window_docked())
1024 dock_layout_->DockDraggedWindow(window()); 1032 dock_layout_->DockDraggedWindow(window());
1025 } else { 1033 } else {
1026 if (dock_layout_->is_dragged_window_docked()) 1034 if (dock_layout_->is_dragged_window_docked())
1027 dock_layout_->UndockDraggedWindow(); 1035 dock_layout_->UndockDraggedWindow();
1028 } 1036 }
1029 } 1037 }
1030 1038
1031 } // namespace internal 1039 } // namespace internal
1032 } // namespace ash 1040 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.h ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698