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

Side by Side Diff: ui/aura/root_window.cc

Issue 8892013: Properly cleans up state when mouse capture changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Spelling Created 9 years 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 | « no previous file | ui/aura/window_unittest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return; 354 return;
355 355
356 if (capture_window_ && capture_window_->delegate()) 356 if (capture_window_ && capture_window_->delegate())
357 capture_window_->delegate()->OnCaptureLost(); 357 capture_window_->delegate()->OnCaptureLost();
358 capture_window_ = window; 358 capture_window_ = window;
359 359
360 if (capture_window_) { 360 if (capture_window_) {
361 // Make all subsequent mouse events and touch go to the capture window. We 361 // Make all subsequent mouse events and touch go to the capture window. We
362 // shouldn't need to send an event here as OnCaptureLost should take care of 362 // shouldn't need to send an event here as OnCaptureLost should take care of
363 // that. 363 // that.
364 if (mouse_pressed_handler_)
365 mouse_pressed_handler_ = capture_window_;
366 if (touch_event_handler_) 364 if (touch_event_handler_)
367 touch_event_handler_ = capture_window_; 365 touch_event_handler_ = capture_window_;
366 if (mouse_moved_handler_ || mouse_button_flags_ != 0)
367 mouse_moved_handler_ = capture_window_;
368 } else { 368 } else {
369 // When capture is lost, we must reset the event handlers. 369 // When capture is lost, we must reset the event handlers.
370 mouse_pressed_handler_ = NULL;
371 touch_event_handler_ = NULL; 370 touch_event_handler_ = NULL;
371 mouse_moved_handler_ = NULL;
372 } 372 }
373 mouse_pressed_handler_ = NULL;
373 } 374 }
374 375
375 void RootWindow::ReleaseCapture(Window* window) { 376 void RootWindow::ReleaseCapture(Window* window) {
376 if (capture_window_ != window) 377 if (capture_window_ != window)
377 return; 378 return;
378 SetCapture(NULL); 379 SetCapture(NULL);
379 } 380 }
380 381
381 void RootWindow::SetTransform(const ui::Transform& transform) { 382 void RootWindow::SetTransform(const ui::Transform& transform) {
382 Window::SetTransform(transform); 383 Window::SetTransform(transform);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { 608 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) {
608 bounds.set_size(gfx::Size(parsed_width, parsed_height)); 609 bounds.set_size(gfx::Size(parsed_width, parsed_height));
609 } else if (use_fullscreen_host_window_) { 610 } else if (use_fullscreen_host_window_) {
610 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize()); 611 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize());
611 } 612 }
612 613
613 return bounds; 614 return bounds;
614 } 615 }
615 616
616 } // namespace aura 617 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698