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

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

Issue 101573006: Changes MouseEvent constructor to take changed_button_flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test; needs updated expectations as mouse entered wasnt sent before because of env::mouse_butto… Created 7 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 | « ui/aura/remote_root_window_host_win.cc ('k') | ui/aura/root_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) 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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // and then it releases the capture. In that case OnMouseExited won't 373 // and then it releases the capture. In that case OnMouseExited won't
374 // be called. So it is natural not to emit OnMouseExited even though 374 // be called. So it is natural not to emit OnMouseExited even though
375 // |window| is the capture window. 375 // |window| is the capture window.
376 gfx::Point last_mouse_location = GetLastMouseLocationInRoot(); 376 gfx::Point last_mouse_location = GetLastMouseLocationInRoot();
377 if (window->Contains(mouse_moved_handler_) && 377 if (window->Contains(mouse_moved_handler_) &&
378 window->ContainsPointInRoot(last_mouse_location)) 378 window->ContainsPointInRoot(last_mouse_location))
379 DispatchMouseExitAtPoint(last_mouse_location); 379 DispatchMouseExitAtPoint(last_mouse_location);
380 } 380 }
381 381
382 void RootWindow::DispatchMouseExitAtPoint(const gfx::Point& point) { 382 void RootWindow::DispatchMouseExitAtPoint(const gfx::Point& point) {
383 ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE); 383 ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE,
384 ui::EF_NONE);
384 DispatchDetails details = 385 DispatchDetails details =
385 DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED); 386 DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED);
386 if (details.dispatcher_destroyed) 387 if (details.dispatcher_destroyed)
387 return; 388 return;
388 } 389 }
389 390
390 void RootWindow::OnWindowVisibilityChanged(Window* window, bool is_visible) { 391 void RootWindow::OnWindowVisibilityChanged(Window* window, bool is_visible) {
391 if (!is_visible) 392 if (!is_visible)
392 OnWindowHidden(window, WINDOW_HIDDEN); 393 OnWindowHidden(window, WINDOW_HIDDEN);
393 394
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 // |mouse_moved_handler_| may have been set to a Window in a different root 626 // |mouse_moved_handler_| may have been set to a Window in a different root
626 // (see below). Clear it here to ensure we don't end up referencing a stale 627 // (see below). Clear it here to ensure we don't end up referencing a stale
627 // Window. 628 // Window.
628 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_)) 629 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_))
629 mouse_moved_handler_ = NULL; 630 mouse_moved_handler_ = NULL;
630 631
631 if (old_capture && old_capture->GetRootWindow() == window() && 632 if (old_capture && old_capture->GetRootWindow() == window() &&
632 old_capture->delegate()) { 633 old_capture->delegate()) {
633 // Send a capture changed event with bogus location data. 634 // Send a capture changed event with bogus location data.
634 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), 635 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(),
635 gfx::Point(), 0); 636 gfx::Point(), 0, 0);
636 637
637 DispatchDetails details = DispatchEvent(old_capture, &event); 638 DispatchDetails details = DispatchEvent(old_capture, &event);
638 if (details.dispatcher_destroyed) 639 if (details.dispatcher_destroyed)
639 return; 640 return;
640 641
641 old_capture->delegate()->OnCaptureLost(); 642 old_capture->delegate()->OnCaptureLost();
642 } 643 }
643 644
644 if (new_capture) { 645 if (new_capture) {
645 // Make all subsequent mouse events go to the capture window. We shouldn't 646 // Make all subsequent mouse events go to the capture window. We shouldn't
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 synthesize_mouse_move_ = false; 1130 synthesize_mouse_move_ = false;
1130 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); 1131 gfx::Point root_mouse_location = GetLastMouseLocationInRoot();
1131 if (!window()->bounds().Contains(root_mouse_location)) 1132 if (!window()->bounds().Contains(root_mouse_location))
1132 return details; 1133 return details;
1133 gfx::Point host_mouse_location = root_mouse_location; 1134 gfx::Point host_mouse_location = root_mouse_location;
1134 ConvertPointToHost(&host_mouse_location); 1135 ConvertPointToHost(&host_mouse_location);
1135 1136
1136 ui::MouseEvent event(ui::ET_MOUSE_MOVED, 1137 ui::MouseEvent event(ui::ET_MOUSE_MOVED,
1137 host_mouse_location, 1138 host_mouse_location,
1138 host_mouse_location, 1139 host_mouse_location,
1139 ui::EF_IS_SYNTHESIZED); 1140 ui::EF_IS_SYNTHESIZED,
1141 0);
1140 return OnHostMouseEventImpl(&event); 1142 return OnHostMouseEventImpl(&event);
1141 } 1143 }
1142 1144
1143 void RootWindow::SynthesizeMouseMoveEventAsync() { 1145 void RootWindow::SynthesizeMouseMoveEventAsync() {
1144 DispatchDetails details = SynthesizeMouseMoveEvent(); 1146 DispatchDetails details = SynthesizeMouseMoveEvent();
1145 if (details.dispatcher_destroyed) 1147 if (details.dispatcher_destroyed)
1146 return; 1148 return;
1147 } 1149 }
1148 1150
1149 gfx::Transform RootWindow::GetInverseRootTransform() const { 1151 gfx::Transform RootWindow::GetInverseRootTransform() const {
(...skipping 10 matching lines...) Expand all
1160 flags |= ui::EF_IS_NON_CLIENT; 1162 flags |= ui::EF_IS_NON_CLIENT;
1161 event->set_flags(flags); 1163 event->set_flags(flags);
1162 1164
1163 if (!dispatching_held_event_) { 1165 if (!dispatching_held_event_) {
1164 SetLastMouseLocation(window(), event->location()); 1166 SetLastMouseLocation(window(), event->location());
1165 synthesize_mouse_move_ = false; 1167 synthesize_mouse_move_ = false;
1166 } 1168 }
1167 } 1169 }
1168 1170
1169 } // namespace aura 1171 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/remote_root_window_host_win.cc ('k') | ui/aura/root_window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698