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

Unified Diff: ui/events/ozone/events_ozone.h

Issue 566673003: ozone: events: Centralize & document our NativeEvent woes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/events/ozone/events_ozone.h
diff --git a/ui/events/ozone/events_ozone.h b/ui/events/ozone/events_ozone.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad603cdadd9775370c4ac06e6e309bfa6d7a4b12
--- /dev/null
+++ b/ui/events/ozone/events_ozone.h
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_OZONE_EVENTS_OZONE_H_
+#define UI_EVENTS_OZONE_EVENTS_OZONE_H_
+
+#include "base/callback.h"
+#include "base/event_types.h"
+#include "ui/events/events_export.h"
+
+namespace ui {
+
+class Event;
+
+// Wrap a "native" ui::Event in another ui::Event & dispatch it.
+//
+// This is really unfortunate, but exists for two reasons:
+//
+// 1. Some of the ui::Event constructors depend on global state that
+// is only used when building from a "native" event. For example:
+// last_click_event_ is used when constructing MouseEvent from
+// NativeEvent to determine click count.
+//
+// 2. Events contain a reference to a "native event", which some code
+// depends on. The ui::Event might get mutated during dispatch, but
+// the native event won't. Some code depends on the fact that the
+// "native" version of the event is unmodified.
kpschoedel 2014/09/11 21:23:19 … and some code depends (for at least little longe
+//
+// We are trying to fix both of these issues, but in the meantime we
+// define NativeEvent == ui::Event.
+//
+EVENTS_EXPORT void DispatchEventFromNativeUiEvent(
+ const base::NativeEvent& native_event,
+ base::Callback<void(ui::Event*)> callback);
+
+} // namespace ui
+
+#endif // UI_EVENTS_OZONE_EVENTS_OZONE_H_
« no previous file with comments | « ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc ('k') | ui/events/ozone/events_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698