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

Unified Diff: ui/views/mus/window_manager_connection.cc

Issue 2092343002: Touch HUD app for mustash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/mus/window_manager_connection.cc
diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc
index 4d1fe3bc11b140cd67ac7eff5d48387e1e3ff4cc..0e62c76b7c708e53b0c0e153654b4d54cfee5bcd 100644
--- a/ui/views/mus/window_manager_connection.cc
+++ b/ui/views/mus/window_manager_connection.cc
@@ -14,6 +14,7 @@
#include "components/mus/public/cpp/window_tree_client.h"
#include "components/mus/public/interfaces/event_matcher.mojom.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
+#include "mojo/common/common_type_converters.h"
#include "services/shell/public/cpp/connection.h"
#include "services/shell/public/cpp/connector.h"
#include "ui/views/mus/clipboard_mus.h"
@@ -86,8 +87,14 @@ void WindowManagerConnection::AddPointerWatcher(PointerWatcher* watcher) {
// Start a watcher for pointer down.
// TODO(jamescook): Extend event observers to handle multiple event types.
mus::mojom::EventMatcherPtr matcher = mus::mojom::EventMatcher::New();
- matcher->type_matcher = mus::mojom::EventTypeMatcher::New();
- matcher->type_matcher->type = ui::mojom::EventType::POINTER_DOWN;
+ matcher->types_matcher = mus::mojom::EventMultTypeMatcher::New();
+
+ matcher->types_matcher->types = mojo::Array<ui::mojom::EventType>::New(4);
+ matcher->types_matcher->types.push_back(ui::mojom::EventType::POINTER_DOWN);
+ matcher->types_matcher->types.push_back(ui::mojom::EventType::POINTER_UP);
+ matcher->types_matcher->types.push_back(ui::mojom::EventType::POINTER_MOVE);
+ matcher->types_matcher->types.push_back(
+ ui::mojom::EventType::POINTER_CANCEL);
client_->SetEventObserver(std::move(matcher));
sadrul 2016/06/27 14:44:54 We currently have PointerWatcher instances that wa
riajiang 2016/06/28 21:52:51 Done.
}
}
@@ -169,12 +176,29 @@ void WindowManagerConnection::OnEventObserved(const ui::Event& event,
gfx::Point location_in_screen = event.AsLocatedEvent()->root_location();
if (event.type() == ui::ET_MOUSE_PRESSED) {
FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_,
- OnMousePressed(*event.AsMouseEvent(), location_in_screen,
- target_widget));
+ OnMousePressObserved(
+ *event.AsMouseEvent(), location_in_screen,
+ target_widget));
} else if (event.type() == ui::ET_TOUCH_PRESSED) {
FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_,
- OnTouchPressed(*event.AsTouchEvent(), location_in_screen,
- target_widget));
+ OnTouchPressObserved(
+ *event.AsTouchEvent(), location_in_screen,
+ target_widget));
+ } else if (event.type() == ui::ET_TOUCH_RELEASED) {
+ FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_,
+ OnTouchReleaseObserved(
+ *event.AsTouchEvent(), location_in_screen,
+ target_widget));
+ } else if (event.type() == ui::ET_TOUCH_MOVED) {
+ FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_,
+ OnTouchMoveObserved(
+ *event.AsTouchEvent(), location_in_screen,
+ target_widget));
+ } else if (event.type() == ui::ET_TOUCH_CANCELLED) {
+ FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_,
+ OnTouchCancellObserved(
+ *event.AsTouchEvent(), location_in_screen,
+ target_widget));
}
}

Powered by Google App Engine
This is Rietveld 408576698