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

Unified Diff: ash/aura/pointer_watcher_adapter.cc

Issue 2256343003: Update ui::PointerEvent to support mouse wheel and capture change events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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
« no previous file with comments | « no previous file | ash/aura/pointer_watcher_adapter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/aura/pointer_watcher_adapter.cc
diff --git a/ash/aura/pointer_watcher_adapter.cc b/ash/aura/pointer_watcher_adapter.cc
index c57b6b5d5d6c2df393883e3c7ea08cff324c19c9..c2e3c8c1f2c329570ab796694077151827095a9b 100644
--- a/ash/aura/pointer_watcher_adapter.cc
+++ b/ash/aura/pointer_watcher_adapter.cc
@@ -7,6 +7,7 @@
#include "ash/shell.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/window.h"
+#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
#include "ui/gfx/geometry/point.h"
@@ -43,18 +44,12 @@ void PointerWatcherAdapter::RemovePointerWatcher(
}
void PointerWatcherAdapter::OnMouseEvent(ui::MouseEvent* event) {
- if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) {
- FOR_EACH_OBSERVER(views::PointerWatcher, non_move_watchers_,
- OnMouseCaptureChanged());
- FOR_EACH_OBSERVER(views::PointerWatcher, move_watchers_,
- OnMouseCaptureChanged());
- return;
- }
-
// For compatibility with the mus version, don't send drags.
if (event->type() != ui::ET_MOUSE_PRESSED &&
event->type() != ui::ET_MOUSE_RELEASED &&
- event->type() != ui::ET_MOUSE_MOVED)
+ event->type() != ui::ET_MOUSE_MOVED &&
+ event->type() != ui::ET_MOUSEWHEEL &&
+ event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)
return;
DCHECK(ui::PointerEvent::CanConvertFrom(*event));
@@ -73,10 +68,15 @@ void PointerWatcherAdapter::OnTouchEvent(ui::TouchEvent* event) {
gfx::Point PointerWatcherAdapter::GetLocationInScreen(
const ui::LocatedEvent& event) const {
- aura::Window* target = static_cast<aura::Window*>(event.target());
- gfx::Point location_in_screen = event.location();
- aura::client::GetScreenPositionClient(target->GetRootWindow())
- ->ConvertPointToScreen(target, &location_in_screen);
+ gfx::Point location_in_screen;
+ if (event.type() == ui::ET_MOUSE_CAPTURE_CHANGED) {
+ location_in_screen = display::Screen::GetScreen()->GetCursorScreenPoint();
+ } else {
+ aura::Window* target = static_cast<aura::Window*>(event.target());
+ location_in_screen = event.location();
+ aura::client::GetScreenPositionClient(target->GetRootWindow())
+ ->ConvertPointToScreen(target, &location_in_screen);
+ }
return location_in_screen;
}
« no previous file with comments | « no previous file | ash/aura/pointer_watcher_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698