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

Unified Diff: views/events/event.h

Issue 7942004: Consolidate/cleanup event cracking code; single out GdkEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: KeyboardCodeFromNative, Wayland, cleanup and consolidate. Created 9 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: views/events/event.h
diff --git a/views/events/event.h b/views/events/event.h
index 4231598e4c04eae765869dd822a7d813d10a1b7b..06282bcde31addd82d1cfa9eeaa3b4dcd560763e 100644
--- a/views/events/event.h
+++ b/views/events/event.h
@@ -14,14 +14,9 @@
#include "views/native_types.h"
#include "views/views_export.h"
-#if defined(USE_X11)
-typedef union _XEvent XEvent;
-#endif
-
namespace ui {
class OSExchangeData;
}
-using ui::OSExchangeData;
namespace views {
@@ -32,11 +27,6 @@ class NativeWidgetView;
class RootView;
}
-#if defined(OS_WIN) || defined(USE_AURA)
-VIEWS_EXPORT bool IsClientMouseEvent(const views::NativeEvent& native_event);
-VIEWS_EXPORT bool IsNonClientMouseEvent(const views::NativeEvent& native_event);
-#endif
-
////////////////////////////////////////////////////////////////////////////////
//
// Event class
@@ -88,21 +78,15 @@ class VIEWS_EXPORT Event {
type_ == ui::ET_TOUCH_CANCELLED;
}
-#if defined(OS_WIN) && !defined(USE_AURA)
- // Returns the EventFlags in terms of windows flags.
- int GetWindowsFlags() const;
-#elif defined(OS_LINUX)
- // Get the views::Event flags from a native GdkEvent.
- static int GetFlagsFromGdkEvent(NativeEvent native_event);
-#endif
-
protected:
Event(ui::EventType type, int flags);
- Event(NativeEvent native_event, ui::EventType type, int flags);
+ Event(const NativeEvent& native_event, ui::EventType type, int flags);
// Because the world is complicated, sometimes we have two different kinds of
// NativeEvent in play in the same executable. See native_types.h for the tale
// of woe.
- Event(NativeEvent2 native_event, ui::EventType type, int flags,
+ Event(const NativeEvent2& native_event,
+ ui::EventType type,
+ int flags,
FromNativeEvent2);
Event(const Event& model)
@@ -120,8 +104,9 @@ class VIEWS_EXPORT Event {
// Safely initializes the native event members of this class.
void Init();
- void InitWithNativeEvent(NativeEvent native_event);
- void InitWithNativeEvent2(NativeEvent2 native_event_2, FromNativeEvent2);
+ void InitWithNativeEvent(const NativeEvent& native_event);
+ void InitWithNativeEvent2(const NativeEvent2& native_event_2,
+ FromNativeEvent2);
NativeEvent native_event_;
NativeEvent2 native_event_2_;
@@ -145,8 +130,9 @@ class VIEWS_EXPORT LocatedEvent : public Event {
const gfx::Point& location() const { return location_; }
protected:
- explicit LocatedEvent(NativeEvent native_event);
- LocatedEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
+ explicit LocatedEvent(const NativeEvent& native_event);
+ LocatedEvent(const NativeEvent2& native_event_2,
+ FromNativeEvent2 from_native);
// TODO(msw): Kill this legacy constructor when we update uses.
// Simple initialization from cracked metadata.
@@ -175,8 +161,8 @@ class TouchEvent;
////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT MouseEvent : public LocatedEvent {
public:
- explicit MouseEvent(NativeEvent native_event);
- MouseEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
+ explicit MouseEvent(const NativeEvent& native_event);
+ MouseEvent(const NativeEvent2& native_event_2, FromNativeEvent2 from_native);
// Create a new MouseEvent which is identical to the provided model.
// If source / target views are provided, the model location will be converted
@@ -247,7 +233,7 @@ class VIEWS_EXPORT MouseEvent : public LocatedEvent {
////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT TouchEvent : public LocatedEvent {
public:
- TouchEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
+ TouchEvent(const NativeEvent2& native_event_2, FromNativeEvent2 from_native);
// Create a new touch event.
TouchEvent(ui::EventType type,
@@ -305,8 +291,8 @@ class VIEWS_EXPORT TouchEvent : public LocatedEvent {
////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT KeyEvent : public Event {
public:
- explicit KeyEvent(NativeEvent native_event);
- KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
+ explicit KeyEvent(const NativeEvent& native_event);
+ KeyEvent(const NativeEvent2& native_event_2, FromNativeEvent2 from_native);
// Creates a new KeyEvent synthetically (i.e. not in response to an input
// event from the host environment). This is typically only used in testing as
@@ -381,8 +367,9 @@ class VIEWS_EXPORT MouseWheelEvent : public MouseEvent {
// See |offset| for details.
static const int kWheelDelta;
- explicit MouseWheelEvent(NativeEvent native_event);
- MouseWheelEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
+ explicit MouseWheelEvent(const NativeEvent& native_event);
+ MouseWheelEvent(const NativeEvent2& native_event_2,
+ FromNativeEvent2 from_native);
// The amount to scroll. This is in multiples of kWheelDelta.
int offset() const { return offset_; }
@@ -411,7 +398,7 @@ class VIEWS_EXPORT MouseWheelEvent : public MouseEvent {
////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT DropTargetEvent : public LocatedEvent {
public:
- DropTargetEvent(const OSExchangeData& data,
+ DropTargetEvent(const ui::OSExchangeData& data,
int x,
int y,
int source_operations)
@@ -421,12 +408,12 @@ class VIEWS_EXPORT DropTargetEvent : public LocatedEvent {
// TODO(msw): Hook up key state flags for CTRL + drag and drop, etc.
}
- const OSExchangeData& data() const { return data_; }
+ const ui::OSExchangeData& data() const { return data_; }
int source_operations() const { return source_operations_; }
private:
// Data associated with the drag/drop session.
- const OSExchangeData& data_;
+ const ui::OSExchangeData& data_;
// Bitmask of supported ui::DragDropTypes::DragOperation by the source.
int source_operations_;

Powered by Google App Engine
This is Rietveld 408576698