#ifndef UI_EVENTS_EVENT_UTILS_H_
#define UI_EVENTS_EVENT_UTILS_H_
#include <stdint.h>
#include <memory>
#include <string_view>
#include <vector>
#include "build/build_config.h"
#include "ui/display/display.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
#include "ui/events/events_export.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/events/platform_event.h"
#include "ui/events/types/event_type.h"
#include "ui/gfx/native_widget_types.h"
#if BUILDFLAG(IS_WIN)
#include "base/win/windows_types.h"
#endif
namespace gfx {
class Point;
class Vector2d;
}
namespace base {
class TimeTicks;
}
namespace ui {
class Event;
class MouseEvent;
enum class DomCode : uint32_t;
constexpr char kPropertyKeyboardState[] = …;
constexpr char kPropertyKeyboardGroup[] = …;
constexpr char kPropertyKeyboardHwKeyCode[] = …;
constexpr char kPropertyMouseCrossedIntermediateWindow[] = …;
EVENTS_EXPORT std::unique_ptr<Event> EventFromNative(
const PlatformEvent& native_event);
EVENTS_EXPORT EventType EventTypeFromNative(const PlatformEvent& native_event);
EVENTS_EXPORT int EventFlagsFromNative(const PlatformEvent& native_event);
EVENTS_EXPORT base::TimeTicks EventTimeFromNative(
const PlatformEvent& native_event);
EVENTS_EXPORT base::TimeTicks EventLatencyTimeFromNative(
const PlatformEvent& native_event,
base::TimeTicks current_time);
EVENTS_EXPORT gfx::PointF EventLocationFromNative(
const PlatformEvent& native_event);
EVENTS_EXPORT gfx::Point EventSystemLocationFromNative(
const PlatformEvent& native_event);
EVENTS_EXPORT KeyboardCode
KeyboardCodeFromNative(const PlatformEvent& native_event);
EVENTS_EXPORT DomCode CodeFromNative(const PlatformEvent& native_event);
EVENTS_EXPORT bool IsCharFromNative(const PlatformEvent& native_event);
EVENTS_EXPORT int GetChangedMouseButtonFlagsFromNative(
const PlatformEvent& native_event);
EVENTS_EXPORT PointerDetails
GetMousePointerDetailsFromNative(const PlatformEvent& native_event);
EVENTS_EXPORT const gfx::Vector2dF& GetMouseMovementFromNative(
const PlatformEvent& native_event);
EVENTS_EXPORT gfx::Vector2d GetMouseWheelOffset(
const PlatformEvent& native_event);
EVENTS_EXPORT gfx::Vector2d GetMouseWheelTick120ths(
const PlatformEvent& native_event);
EVENTS_EXPORT bool ShouldCopyPlatformEvents();
EVENTS_EXPORT PlatformEvent CreateInvalidPlatformEvent();
EVENTS_EXPORT bool IsPlatformEventValid(const PlatformEvent& platform_event);
EVENTS_EXPORT PointerDetails
GetTouchPointerDetailsFromNative(const PlatformEvent& native_event);
EVENTS_EXPORT bool GetFlingData(const PlatformEvent& native_event,
float* vx,
float* vy,
float* vx_ordinal,
float* vy_ordinal,
bool* is_cancel);
EVENTS_EXPORT bool GetScrollOffsets(const PlatformEvent& native_event,
float* x_offset,
float* y_offset,
float* x_offset_ordinal,
float* y_offset_ordinal,
int* finger_count,
EventMomentumPhase* momentum_phase);
EVENTS_EXPORT bool ShouldDefaultToNaturalScroll();
EVENTS_EXPORT display::Display::TouchSupport GetInternalDisplayTouchSupport();
EVENTS_EXPORT void ComputeEventLatencyOS(const PlatformEvent& native_event);
EVENTS_EXPORT void ComputeEventLatencyOS(ui::EventType type,
base::TimeTicks time_stamp,
base::TimeTicks current_time);
#if BUILDFLAG(IS_WIN)
EVENTS_EXPORT void ComputeEventLatencyOSFromTOUCHINPUT(
ui::EventType event_type,
TOUCHINPUT touch_input,
base::TimeTicks current_time);
EVENTS_EXPORT void ComputeEventLatencyOSFromPOINTER_INFO(
ui::EventType event_type,
POINTER_INFO pointer_info,
base::TimeTicks current_time);
EVENTS_EXPORT int GetModifiersFromKeyState();
EVENTS_EXPORT bool IsMouseEventFromTouch(UINT message);
EVENTS_EXPORT uint16_t GetScanCodeFromLParam(LPARAM lParam);
EVENTS_EXPORT LPARAM GetLParamFromScanCode(uint16_t scan_code);
EVENTS_EXPORT CHROME_MSG MSGFromKeyEvent(KeyEvent* key_event,
HWND hwnd = nullptr);
EVENTS_EXPORT KeyEvent KeyEventFromMSG(const CHROME_MSG& msg);
EVENTS_EXPORT MouseEvent MouseEventFromMSG(const CHROME_MSG& msg);
EVENTS_EXPORT MouseWheelEvent MouseWheelEventFromMSG(const CHROME_MSG& msg);
#endif
EVENTS_EXPORT int RegisterCustomEventType();
EVENTS_EXPORT void ConvertEventLocationToTargetWindowLocation(
const gfx::Point& target_window_origin,
const gfx::Point& current_window_origin,
ui::LocatedEvent* located_event);
EVENTS_EXPORT std::string_view EventTypeName(EventType type);
EVENTS_EXPORT std::vector<std::string_view> EventFlagsNames(int event_flags);
EVENTS_EXPORT std::vector<std::string_view> KeyEventFlagsNames(int event_flags);
EVENTS_EXPORT std::vector<std::string_view> MouseEventFlagsNames(
int event_flags);
}
#endif