// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_EVENTS_EVENT_CONSTANTS_H_ #define UI_EVENTS_EVENT_CONSTANTS_H_ #include "build/build_config.h" namespace ui { // Event flags currently supported. It is OK to add values to the middle of // this list and/or reorder it, but make sure you also touch the various other // enums/constants that want to stay in sync with this. For example, // KeyEventFlags and MouseEventFlags should not overlap EventFlags. EventFlags; // Used to denote no flags explicitly constexpr EventFlags EF_NONE = …; // Universally applicable status bits. constexpr EventFlags EF_IS_SYNTHESIZED = …; // Modifier key state. constexpr EventFlags EF_SHIFT_DOWN = …; constexpr EventFlags EF_CONTROL_DOWN = …; constexpr EventFlags EF_ALT_DOWN = …; // GUI Key (e.g. Command on OS X keyboards, Search on Chromebook keyboards, // Windows on MS-oriented keyboards) constexpr EventFlags EF_COMMAND_DOWN = …; // Function key. constexpr EventFlags EF_FUNCTION_DOWN = …; constexpr EventFlags EF_ALTGR_DOWN = …; constexpr EventFlags EF_MOD3_DOWN = …; // Other keyboard states. constexpr EventFlags EF_NUM_LOCK_ON = …; constexpr EventFlags EF_CAPS_LOCK_ON = …; constexpr EventFlags EF_SCROLL_LOCK_ON = …; // Mouse buttons. constexpr EventFlags EF_LEFT_MOUSE_BUTTON = …; constexpr EventFlags EF_MIDDLE_MOUSE_BUTTON = …; constexpr EventFlags EF_RIGHT_MOUSE_BUTTON = …; constexpr EventFlags EF_BACK_MOUSE_BUTTON = …; constexpr EventFlags EF_FORWARD_MOUSE_BUTTON = …; constexpr EventFlags EF_MOUSE_BUTTON = …; // An artificial value used to bridge platform differences. // Many commands on Mac as Cmd+Key are the counterparts of // Ctrl+Key on other platforms. #if BUILDFLAG(IS_APPLE) constexpr EventFlags EF_PLATFORM_ACCELERATOR = EF_COMMAND_DOWN; #else constexpr EventFlags EF_PLATFORM_ACCELERATOR = …; #endif // Flags specific to key events. // WARNING: If you add or remove values make sure traits for serializing these // values are updated. KeyEventFlags; // Key event fabricated by the underlying IME without a user action. (Linux X11 // only) constexpr KeyEventFlags EF_IME_FABRICATED_KEY = …; constexpr KeyEventFlags EF_IS_REPEAT = …; // Do not remap; the event was created with the desired final values. constexpr KeyEventFlags EF_FINAL = …; // Windows extended key (see WM_KEYDOWN doc) constexpr KeyEventFlags EF_IS_EXTENDED_KEY = …; // Event was generated by a stylus button constexpr KeyEventFlags EF_IS_STYLUS_BUTTON = …; #if BUILDFLAG(IS_CHROMEOS) // Event was generated by customizing a button on a mouse or graphics tablet. constexpr KeyEventFlags EF_IS_CUSTOMIZED_FROM_BUTTON = 1 << 21; constexpr KeyEventFlags EF_MAX_KEY_EVENT_FLAGS_VALUE = (1 << 22) - 1; #else constexpr KeyEventFlags EF_MAX_KEY_EVENT_FLAGS_VALUE = …; #endif // Flags specific to mouse events. MouseEventFlags; constexpr MouseEventFlags EF_IS_DOUBLE_CLICK = …; constexpr MouseEventFlags EF_IS_TRIPLE_CLICK = …; constexpr MouseEventFlags EF_IS_NON_CLIENT = …; // Indicates this mouse event is generated from an unconsumed touch/gesture // event. constexpr MouseEventFlags EF_FROM_TOUCH = …; // Indicates this event was generated from touch accessibility mode. constexpr MouseEventFlags EF_TOUCH_ACCESSIBILITY = …; // Indicates this mouse event is generated because the cursor was just hidden. // This can be used to update hover state. constexpr MouseEventFlags EF_CURSOR_HIDE = …; // Indicates this mouse event is from high precision touchpad and will come with // a high precision delta. constexpr MouseEventFlags EF_PRECISION_SCROLLING_DELTA = …; // Indicates this mouse event is generated when users is requesting to scroll by // pages. constexpr MouseEventFlags EF_SCROLL_BY_PAGE = …; // Indicates this mouse event is unadjusted mouse events that has unadjusted // movement delta, i.e. is from WM_INPUT on Windows. constexpr MouseEventFlags EF_UNADJUSTED_MOUSE = …; // Indicates this mouse event should not trigger mouse warping (which moves the // mouse to another display when the mouse hits the window boundaries). constexpr MouseEventFlags EF_NOT_SUITABLE_FOR_MOUSE_WARPING = …; // Flags specific to touch events. TouchEventFlags; // Indicates this touch event is reserved for gesture recognition and // should not be handled in the event handler. constexpr TouchEventFlags EF_RESERVED_FOR_GESTURE = …; // These value match the Windows default. constexpr int kDoubleClickTimeMs = …; // Result of dispatching an event. enum EventResult { … }; // Phase of the event dispatch. enum EventPhase { … }; // Phase information used for a ScrollEvent. ScrollEventPhase is for scroll // stream from user gesture, EventMomentumPhase is for inertia scroll stream // after user gesture. enum class ScrollEventPhase { … }; // Momentum phase information used for a ScrollEvent. enum class EventMomentumPhase { … }; enum EventDeviceId { … }; // Pointing device type. enum class EventPointerType : int { … }; // Device type for gesture events. enum class GestureDeviceType : int { … }; } // namespace ui #endif // UI_EVENTS_EVENT_CONSTANTS_H_