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

Side by Side Diff: ash/wm/toplevel_window_event_handler.cc

Issue 15008002: Make touch-resizing windows to screen edge possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust unit tests with final behavior 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/toplevel_window_event_handler.h ('k') | ash/wm/window_resizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/toplevel_window_event_handler.h" 5 #include "ash/wm/toplevel_window_event_handler.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/property_util.h" 8 #include "ash/wm/property_util.h"
9 #include "ash/wm/resize_shadow_controller.h" 9 #include "ash/wm/resize_shadow_controller.h"
10 #include "ash/wm/window_properties.h" 10 #include "ash/wm/window_properties.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 int component = 221 int component =
222 target->delegate()->GetNonClientComponent(event->location()); 222 target->delegate()->GetNonClientComponent(event->location());
223 if (WindowResizer::GetBoundsChangeForWindowComponent(component) == 0) { 223 if (WindowResizer::GetBoundsChangeForWindowComponent(component) == 0) {
224 window_resizer_.reset(); 224 window_resizer_.reset();
225 return; 225 return;
226 } 226 }
227 in_gesture_drag_ = true; 227 in_gesture_drag_ = true;
228 pre_drag_window_bounds_ = target->bounds(); 228 pre_drag_window_bounds_ = target->bounds();
229 gfx::Point location_in_parent( 229 gfx::Point location_in_parent(
230 ConvertPointToParent(target, event->location())); 230 ConvertPointToParent(target, event->location()));
231 CreateScopedWindowResizer(target, location_in_parent, component); 231 CreateScopedWindowResizer(target, location_in_parent, component,
232 aura::client::WINDOW_MOVE_SOURCE_TOUCH);
232 break; 233 break;
233 } 234 }
234 case ui::ET_GESTURE_SCROLL_UPDATE: { 235 case ui::ET_GESTURE_SCROLL_UPDATE: {
235 if (!in_gesture_drag_) 236 if (!in_gesture_drag_)
236 return; 237 return;
237 if (window_resizer_.get() && 238 if (window_resizer_.get() &&
238 window_resizer_->resizer()->GetTarget() != target) { 239 window_resizer_->resizer()->GetTarget() != target) {
239 return; 240 return;
240 } 241 }
241 HandleDrag(target, event); 242 HandleDrag(target, event);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 aura::Env::GetInstance()->is_touch_down()) { 317 aura::Env::GetInstance()->is_touch_down()) {
317 in_gesture_drag_ = true; 318 in_gesture_drag_ = true;
318 bool has_point = root_window->gesture_recognizer()-> 319 bool has_point = root_window->gesture_recognizer()->
319 GetLastTouchPointForTarget(source, &drag_location); 320 GetLastTouchPointForTarget(source, &drag_location);
320 DCHECK(has_point); 321 DCHECK(has_point);
321 } else { 322 } else {
322 drag_location = root_window->GetLastMouseLocationInRoot(); 323 drag_location = root_window->GetLastMouseLocationInRoot();
323 aura::Window::ConvertPointToTarget( 324 aura::Window::ConvertPointToTarget(
324 root_window, source->parent(), &drag_location); 325 root_window, source->parent(), &drag_location);
325 } 326 }
326 CreateScopedWindowResizer(source, drag_location, HTCAPTION); 327 CreateScopedWindowResizer(source, drag_location, HTCAPTION, move_source);
327 aura::client::CursorClient* cursor_client = 328 aura::client::CursorClient* cursor_client =
328 aura::client::GetCursorClient(root_window); 329 aura::client::GetCursorClient(root_window);
329 if (cursor_client) 330 if (cursor_client)
330 cursor_client->SetCursor(ui::kCursorPointer); 331 cursor_client->SetCursor(ui::kCursorPointer);
331 bool destroyed = false; 332 bool destroyed = false;
332 destroyed_ = &destroyed; 333 destroyed_ = &destroyed;
333 #if !defined(OS_MACOSX) 334 #if !defined(OS_MACOSX)
334 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); 335 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
335 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop); 336 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
336 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher()); 337 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
(...skipping 26 matching lines...) Expand all
363 EndMoveLoop(); 364 EndMoveLoop();
364 } else if (window_resizer_) { 365 } else if (window_resizer_) {
365 window_resizer_->resizer()->RevertDrag(); 366 window_resizer_->resizer()->RevertDrag();
366 window_resizer_.reset(); 367 window_resizer_.reset();
367 } 368 }
368 } 369 }
369 370
370 void ToplevelWindowEventHandler::CreateScopedWindowResizer( 371 void ToplevelWindowEventHandler::CreateScopedWindowResizer(
371 aura::Window* window, 372 aura::Window* window,
372 const gfx::Point& point_in_parent, 373 const gfx::Point& point_in_parent,
373 int window_component) { 374 int window_component,
375 aura::client::WindowMoveSource source) {
374 window_resizer_.reset(); 376 window_resizer_.reset();
375 WindowResizer* resizer = 377 WindowResizer* resizer =
376 CreateWindowResizer(window, point_in_parent, window_component).release(); 378 CreateWindowResizer(window, point_in_parent, window_component,
379 source).release();
377 if (resizer) 380 if (resizer)
378 window_resizer_.reset(new ScopedWindowResizer(this, resizer)); 381 window_resizer_.reset(new ScopedWindowResizer(this, resizer));
379 } 382 }
380 383
381 void ToplevelWindowEventHandler::CompleteDrag(DragCompletionStatus status, 384 void ToplevelWindowEventHandler::CompleteDrag(DragCompletionStatus status,
382 int event_flags) { 385 int event_flags) {
383 scoped_ptr<ScopedWindowResizer> resizer(window_resizer_.release()); 386 scoped_ptr<ScopedWindowResizer> resizer(window_resizer_.release());
384 if (resizer) { 387 if (resizer) {
385 if (status == DRAG_COMPLETE) 388 if (status == DRAG_COMPLETE)
386 resizer->resizer()->CompleteDrag(event_flags); 389 resizer->resizer()->CompleteDrag(event_flags);
(...skipping 13 matching lines...) Expand all
400 // We also update the current window component here because for the 403 // We also update the current window component here because for the
401 // mouse-drag-release-press case, where the mouse is released and 404 // mouse-drag-release-press case, where the mouse is released and
402 // pressed without mouse move event. 405 // pressed without mouse move event.
403 int component = 406 int component =
404 target->delegate()->GetNonClientComponent(event->location()); 407 target->delegate()->GetNonClientComponent(event->location());
405 if ((event->flags() & 408 if ((event->flags() &
406 (ui::EF_IS_DOUBLE_CLICK | ui::EF_IS_TRIPLE_CLICK)) == 0 && 409 (ui::EF_IS_DOUBLE_CLICK | ui::EF_IS_TRIPLE_CLICK)) == 0 &&
407 WindowResizer::GetBoundsChangeForWindowComponent(component)) { 410 WindowResizer::GetBoundsChangeForWindowComponent(component)) {
408 gfx::Point location_in_parent( 411 gfx::Point location_in_parent(
409 ConvertPointToParent(target, event->location())); 412 ConvertPointToParent(target, event->location()));
410 CreateScopedWindowResizer(target, location_in_parent, component); 413 CreateScopedWindowResizer(target, location_in_parent, component,
414 aura::client::WINDOW_MOVE_SOURCE_MOUSE);
411 } else { 415 } else {
412 window_resizer_.reset(); 416 window_resizer_.reset();
413 } 417 }
414 if (WindowResizer::GetBoundsChangeForWindowComponent(component) != 0) 418 if (WindowResizer::GetBoundsChangeForWindowComponent(component) != 0)
415 event->StopPropagation(); 419 event->StopPropagation();
416 } 420 }
417 421
418 void ToplevelWindowEventHandler::HandleMouseReleased( 422 void ToplevelWindowEventHandler::HandleMouseReleased(
419 aura::Window* target, 423 aura::Window* target,
420 ui::MouseEvent* event) { 424 ui::MouseEvent* event) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { 504 void ToplevelWindowEventHandler::ResizerWindowDestroyed() {
501 // We explicitly don't invoke RevertDrag() since that may do things to window. 505 // We explicitly don't invoke RevertDrag() since that may do things to window.
502 // Instead we destroy the resizer. 506 // Instead we destroy the resizer.
503 window_resizer_.reset(); 507 window_resizer_.reset();
504 508
505 // End the move loop. This does nothing if we're not in a move loop. 509 // End the move loop. This does nothing if we're not in a move loop.
506 EndMoveLoop(); 510 EndMoveLoop();
507 } 511 }
508 512
509 } // namespace ash 513 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/toplevel_window_event_handler.h ('k') | ash/wm/window_resizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698