diff options
Diffstat (limited to 'chromium/ui/events/event_utils.h')
-rw-r--r-- | chromium/ui/events/event_utils.h | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/chromium/ui/events/event_utils.h b/chromium/ui/events/event_utils.h index e67a74111d6..87b720d5884 100644 --- a/chromium/ui/events/event_utils.h +++ b/chromium/ui/events/event_utils.h @@ -6,8 +6,10 @@ #define UI_EVENTS_EVENT_UTILS_H_ #include "base/event_types.h" +#include "base/memory/scoped_ptr.h" #include "ui/events/event_constants.h" #include "ui/events/keycodes/keyboard_codes.h" +#include "ui/gfx/display.h" #include "ui/gfx/native_widget_types.h" #include "ui/events/events_export.h" @@ -31,6 +33,11 @@ class Event; // Updates the list of devices for cached properties. EVENTS_EXPORT void UpdateDeviceList(); +// Returns a ui::Event wrapping a native event. Ownership of the returned value +// is transferred to the caller. +EVENTS_EXPORT scoped_ptr<Event> EventFromNative( + const base::NativeEvent& native_event); + // Get the EventType from a native event. EVENTS_EXPORT EventType EventTypeFromNative( const base::NativeEvent& native_event); @@ -48,7 +55,8 @@ EVENTS_EXPORT base::TimeDelta EventTimeForNow(); // Get the location from a native event. The coordinate system of the resultant // |Point| has the origin at top-left of the "root window". The nature of // this "root window" and how it maps to platform-specific drawing surfaces is -// defined in ui/aura/root_window.* and ui/aura/root_window_host*. +// defined in ui/aura/root_window.* and ui/aura/window_tree_host*. +// TODO(tdresser): Return gfx::PointF here. See crbug.com/337827. EVENTS_EXPORT gfx::Point EventLocationFromNative( const base::NativeEvent& native_event); @@ -74,8 +82,9 @@ EVENTS_EXPORT KeyboardCode KeyboardCodeFromNative( EVENTS_EXPORT const char* CodeFromNative( const base::NativeEvent& native_event); -// Returns true if the message is a mouse event. -EVENTS_EXPORT bool IsMouseEvent(const base::NativeEvent& native_event); +// Returns the platform related key code. For X11, it is xksym value. +EVENTS_EXPORT uint32 PlatformKeycodeFromNative( + const base::NativeEvent& native_event); // Returns the flags of the button that changed during a press/release. EVENTS_EXPORT int GetChangedMouseButtonFlagsFromNative( @@ -85,6 +94,15 @@ EVENTS_EXPORT int GetChangedMouseButtonFlagsFromNative( EVENTS_EXPORT gfx::Vector2d GetMouseWheelOffset( const base::NativeEvent& native_event); +// Returns a copy of |native_event|. Depending on the platform, this copy may +// need to be deleted with ReleaseCopiedNativeEvent(). +base::NativeEvent CopyNativeEvent( + const base::NativeEvent& native_event); + +// Delete a |native_event| previously created by CopyNativeEvent(). +void ReleaseCopiedNativeEvent( + const base::NativeEvent& native_event); + // Gets the touch id from a native event. EVENTS_EXPORT int GetTouchId(const base::NativeEvent& native_event); @@ -124,26 +142,17 @@ EVENTS_EXPORT bool GetGestureTimes(const base::NativeEvent& native_event, double* start_time, double* end_time); -// Enable/disable natural scrolling for touchpads. -EVENTS_EXPORT void SetNaturalScroll(bool enabled); - -// In natural scrolling enabled for touchpads? -EVENTS_EXPORT bool IsNaturalScrollEnabled(); - // Returns whether natural scrolling should be used for touchpad. EVENTS_EXPORT bool ShouldDefaultToNaturalScroll(); +// Returns whether or not the internal display produces touch events. +EVENTS_EXPORT gfx::Display::TouchSupport GetInternalDisplayTouchSupport(); + // Was this event generated by a touchpad device? // The caller is responsible for ensuring that this is a mouse/touchpad event // before calling this function. EVENTS_EXPORT bool IsTouchpadEvent(const base::NativeEvent& event); -// Returns true if event is noop. -EVENTS_EXPORT bool IsNoopEvent(const base::NativeEvent& event); - -// Creates and returns no-op event. -EVENTS_EXPORT base::NativeEvent CreateNoopEvent(); - #if defined(OS_WIN) EVENTS_EXPORT int GetModifiersFromACCEL(const ACCEL& accel); EVENTS_EXPORT int GetModifiersFromKeyState(); @@ -156,11 +165,8 @@ EVENTS_EXPORT bool IsMouseEventFromTouch(UINT message); // representing an extended key contains 0xE000 bits. EVENTS_EXPORT uint16 GetScanCodeFromLParam(LPARAM lParam); EVENTS_EXPORT LPARAM GetLParamFromScanCode(uint16 scan_code); -#endif -// Returns true if default post-target handling was canceled for |event| after -// its dispatch to its target. -EVENTS_EXPORT bool EventCanceledDefaultHandling(const Event& event); +#endif // Registers a custom event type. EVENTS_EXPORT int RegisterCustomEventType(); |