FCohtmlInputPreprocessor
Inherits from IInputProcessor
Public Types
Section titled “Public Types”| Name | |
|---|---|
| using ECohtmlGamepadBehaviourOnFocusLost | EGamepadBehaviour |
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| FCohtmlInputPreprocessor() | |
| virtual | ~FCohtmlInputPreprocessor() |
| virtual void | Tick(const float DeltaTime, FSlateApplication & SlateApp, TSharedRef< ICursor > Cursor) |
| virtual bool | HandleKeyDownEvent(FSlateApplication & SlateApp, const FKeyEvent & InKeyEvent) override |
| virtual bool | HandleKeyUpEvent(FSlateApplication & SlateApp, const FKeyEvent & InKeyEvent) override |
| virtual bool | HandleAnalogInputEvent(FSlateApplication & SlateApp, const FAnalogInputEvent & InAnalogInputEvent) override |
| virtual bool | HandleMouseMoveEvent(FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) override |
| virtual bool | HandleMouseButtonDownEvent(FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) override |
| virtual bool | HandleMouseButtonUpEvent(FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) override |
| virtual bool | HandleMouseButtonDoubleClickEvent(FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) override |
| virtual bool | HandleMouseWheelOrGestureEvent(FSlateApplication & SlateApp, const FPointerEvent & InWheelEvent, const FPointerEvent * InGestureEvent) override |
| virtual bool | HandleMotionDetectedEvent(FSlateApplication & SlateApp, const FMotionEvent & MotionEvent) override |
| virtual bool | HandleMouseEvent(FSlateApplication & SlateApp, const FPointerEvent & MouseEvent, cohtml::MouseEventData::EventType EventType) |
| virtual bool | ShouldHandleInput() |
| virtual bool | ShouldDiscardMouseData(FCohtmlInputWorldData & WorldData) |
| virtual bool | GetWorldData(FCohtmlInputWorldData & WorldData) |
| virtual cohtml::MouseEventData | GetCoherentMouseData(const FPointerEvent & MouseEvent, cohtml::MouseEventData::EventType EventType) |
| virtual FVector2D | GetScaledWindowPosition(FSlateApplication & SlateApp, const FPointerEvent & MouseEvent, FCohtmlInputWorldData & WorldData) |
| virtual TOptional< FSceneViewProjectionData > | GetProjectionData(APlayerController * PlayerController) |
| virtual FReply | HandleHUDInput(FVector2D ConstrainedPos, UCohtmlBaseComponent * Component, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent) |
| virtual FReply | HandleInWorldInput(UCohtmlBaseComponent * Component, COHERENT_FLOAT_FVECTOR2 & UV, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent) |
| virtual FReply | TryForwardInWorldInput(const FCohtmlInputWorldData & WorldData, FVector2D ViewportPositionVec2D, TOptional< FSceneViewProjectionData > ProjectionData, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent) |
| virtual FReply | TryForwardHUDInput(UWorld * World, FVector2D ViewportPositionVec2D, TOptional< FSceneViewProjectionData > ProjectionData, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent) |
| virtual FReply | TryForwardUMGInput(FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) |
| virtual FReply | DiscardViewFocus(cohtml::MouseEventData::EventType EventType, const FPointerEvent & MouseEvent) |
| virtual void | RefocusView(UCohtmlBaseComponent * NewFocusedView, const FPointerEvent & MouseEvent =FPointerEvent()) |
| virtual bool | ShouldPropagateKeyInput(const FKeyEvent & KeyEvent) |
| virtual void | ProcessKeyEvent(const FInputEvent & Event, cohtml::KeyEventData::EventType Type) |
| virtual void | OnFocusReceived(const FPointerEvent & MouseEvent) |
| virtual void | OnFocusLost(const FPointerEvent & MouseEvent) |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| EGamepadBehaviour | GamepadBehaviourOnFocusLost |
| bool | bShouldPropagateInput |
| bool | bReceivesInput |
| bool | bPropagateInputToUMG |
| TWeakObjectPtr< UCohtmlBaseComponent > | FocusedComponent |
| TUniquePtr< FCohtmlInputPreprocessorIME > | IMEManager |
Public Types Documentation
Section titled “Public Types Documentation”using EGamepadBehaviour
Section titled “using EGamepadBehaviour”using FCohtmlInputPreprocessor::EGamepadBehaviour = ECohtmlGamepadBehaviourOnFocusLost;Public Functions Documentation
Section titled “Public Functions Documentation”function FCohtmlInputPreprocessor
Section titled “function FCohtmlInputPreprocessor”FCohtmlInputPreprocessor()function ~FCohtmlInputPreprocessor
Section titled “function ~FCohtmlInputPreprocessor”inline virtual ~FCohtmlInputPreprocessor()function Tick
Section titled “function Tick”inline virtual void Tick( const float DeltaTime, FSlateApplication & SlateApp, TSharedRef< ICursor > Cursor)function HandleKeyDownEvent
Section titled “function HandleKeyDownEvent”virtual bool HandleKeyDownEvent( FSlateApplication & SlateApp, const FKeyEvent & InKeyEvent) overrideKey down input
function HandleKeyUpEvent
Section titled “function HandleKeyUpEvent”virtual bool HandleKeyUpEvent( FSlateApplication & SlateApp, const FKeyEvent & InKeyEvent) overrideKey up input
function HandleAnalogInputEvent
Section titled “function HandleAnalogInputEvent”virtual bool HandleAnalogInputEvent( FSlateApplication & SlateApp, const FAnalogInputEvent & InAnalogInputEvent) overrideAnalog axis input
function HandleMouseMoveEvent
Section titled “function HandleMouseMoveEvent”virtual bool HandleMouseMoveEvent( FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) overrideMouse movement input
function HandleMouseButtonDownEvent
Section titled “function HandleMouseButtonDownEvent”virtual bool HandleMouseButtonDownEvent( FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) overrideMouse button press
function HandleMouseButtonUpEvent
Section titled “function HandleMouseButtonUpEvent”virtual bool HandleMouseButtonUpEvent( FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) overrideMouse button release
function HandleMouseButtonDoubleClickEvent
Section titled “function HandleMouseButtonDoubleClickEvent”virtual bool HandleMouseButtonDoubleClickEvent( FSlateApplication & SlateApp, const FPointerEvent & MouseEvent) overrideMouse button double clicked.
function HandleMouseWheelOrGestureEvent
Section titled “function HandleMouseWheelOrGestureEvent”virtual bool HandleMouseWheelOrGestureEvent( FSlateApplication & SlateApp, const FPointerEvent & InWheelEvent, const FPointerEvent * InGestureEvent) overrideMouse wheel input
function HandleMotionDetectedEvent
Section titled “function HandleMotionDetectedEvent”virtual bool HandleMotionDetectedEvent( FSlateApplication & SlateApp, const FMotionEvent & MotionEvent) overrideCalled when a motion-driven device has new input
function HandleMouseEvent
Section titled “function HandleMouseEvent”virtual bool HandleMouseEvent( FSlateApplication & SlateApp, const FPointerEvent & MouseEvent, cohtml::MouseEventData::EventType EventType)The root method for all mouse-related event handling. Should return false if it is unable to handle the event, so that it can be passed to UE4.
function ShouldHandleInput
Section titled “function ShouldHandleInput”virtual bool ShouldHandleInput()Decides if a given input should be handled at all - can be used to skip event forwarding entirely, for example when the game window is minimized or there is no active UI in the game
function ShouldDiscardMouseData
Section titled “function ShouldDiscardMouseData”virtual bool ShouldDiscardMouseData( FCohtmlInputWorldData & WorldData)Some of the mouse data passing through the InputPreprocessor is not relevant to the UI, for example mouse events over buttons in the editor in PIE. You can use this method to leave such events to Unreal Engine to handle by returning true.
function GetWorldData
Section titled “function GetWorldData”virtual bool GetWorldData( FCohtmlInputWorldData & WorldData)Parameters:
- WorldData - An out parameter to fill with the data
Return: Should return false to signal that the data is unable to be obtained, for example due to the game world still initializing.
Returns the basic engine data (world, controler, etc.) needed for event forwarding
function GetCoherentMouseData
Section titled “function GetCoherentMouseData”virtual cohtml::MouseEventData GetCoherentMouseData( const FPointerEvent & MouseEvent, cohtml::MouseEventData::EventType EventType)Parameters:
- MouseEvent - The current UE4 mouse event
Return: A cohtml::MouseEventData representation of the current event
Transforms a UE4 event into a Cohtml mouse event. Some of the event properties might get changed later on during processing, but you can use this to fill in the most trivial ones via a simple mapping
function GetScaledWindowPosition
Section titled “function GetScaledWindowPosition”virtual FVector2D GetScaledWindowPosition( FSlateApplication & SlateApp, const FPointerEvent & MouseEvent, FCohtmlInputWorldData & WorldData)Return: A scaled representation of the current event coordinates
Scales the coordinates of the current UE4 event to local window coordinates, possibly scaled for DPI, letterboxing, etc.
function GetProjectionData
Section titled “function GetProjectionData”virtual TOptional< FSceneViewProjectionData > GetProjectionData( APlayerController * PlayerController)Return: A (possibly empty) projection data
Gets the projection data, which might be used later on during forwarding. Can be empty, for example if the viewport of player character are invalid.
function HandleHUDInput
Section titled “function HandleHUDInput”virtual FReply HandleHUDInput( FVector2D ConstrainedPos, UCohtmlBaseComponent * Component, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent)Parameters:
- ConstrainedPos - The event coordinates inside the constrained window view.
- Component - The component which holds the view.
- CoherentMouseData - The current event that would be sent to Cohtml.
- MouseEvent - The original UE4 event that this HUD is handling.
Return: FReply that signifies if the event was handled or not.
Called for every HUD view found during forwarding
function HandleInWorldInput
Section titled “function HandleInWorldInput”virtual FReply HandleInWorldInput( UCohtmlBaseComponent * Component, COHERENT_FLOAT_FVECTOR2 & UV, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent)Parameters:
- Component - The component which holds the view.
- UV - The hit UV coordinates.
- CoherentMouseData - The current event that would be sent to Cohtml.
- MouseEvent - The original UE4 event that this HUD is handling.
Return: FReply that signifies if the event was handled or not.
Called for every in-world Gameface component found during forwarding
function TryForwardInWorldInput
Section titled “function TryForwardInWorldInput”virtual FReply TryForwardInWorldInput( const FCohtmlInputWorldData & WorldData, FVector2D ViewportPositionVec2D, TOptional< FSceneViewProjectionData > ProjectionData, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent)function TryForwardHUDInput
Section titled “function TryForwardHUDInput”virtual FReply TryForwardHUDInput( UWorld * World, FVector2D ViewportPositionVec2D, TOptional< FSceneViewProjectionData > ProjectionData, cohtml::MouseEventData & CoherentMouseData, const FPointerEvent & MouseEvent)function TryForwardUMGInput
Section titled “function TryForwardUMGInput”virtual FReply TryForwardUMGInput( FSlateApplication & SlateApp, const FPointerEvent & MouseEvent)function DiscardViewFocus
Section titled “function DiscardViewFocus”virtual FReply DiscardViewFocus( cohtml::MouseEventData::EventType EventType, const FPointerEvent & MouseEvent)Parameters:
- EventType the type of the pointer event
Return: Whether or not we will handle the event.
Called during error states or when we have reason to believe that we might have to release the input focus back to the engine.
function RefocusView
Section titled “function RefocusView”virtual void RefocusView( UCohtmlBaseComponent * NewFocusedView, const FPointerEvent & MouseEvent =FPointerEvent())Parameters:
- NewFocusedView the Component which holds the view.
Called when a new view should become the focused one.
function ShouldPropagateKeyInput
Section titled “function ShouldPropagateKeyInput”virtual bool ShouldPropagateKeyInput( const FKeyEvent & KeyEvent)Parameters:
- KeyEvent - The event currently being handled
Return: Should return true if we want to propagate the event to the engine.
Called at the end of keyboard/gamepad input handling, to determine whether or not we will forward the event to the game. Will be called regardless of whether or not any Cohtml view handled the event.
function ProcessKeyEvent
Section titled “function ProcessKeyEvent”virtual void ProcessKeyEvent( const FInputEvent & Event, cohtml::KeyEventData::EventType Type)Parameters:
- Event - The UE4 event currently being handled
- Type - The type of the event
Called on every key event to process it. This mainly consists of just forwarding the input to the currently focused component, if any.
function OnFocusReceived
Section titled “function OnFocusReceived”virtual void OnFocusReceived( const FPointerEvent & MouseEvent)Parameters:
- MouseEvent - The event that caused the focus to change.
Called when the focus switches from the Game to the UI
function OnFocusLost
Section titled “function OnFocusLost”virtual void OnFocusLost( const FPointerEvent & MouseEvent)Parameters:
- MouseEvent - The event that caused the focus to change.
Called when the focus switches from the UI to the Game.
Public Attributes Documentation
Section titled “Public Attributes Documentation”variable GamepadBehaviourOnFocusLost
Section titled “variable GamepadBehaviourOnFocusLost”EGamepadBehaviour GamepadBehaviourOnFocusLost = EGamepadBehaviour::CohtmlResetState;variable bShouldPropagateInput
Section titled “variable bShouldPropagateInput”bool bShouldPropagateInput = true;variable bReceivesInput
Section titled “variable bReceivesInput”bool bReceivesInput = true;variable bPropagateInputToUMG
Section titled “variable bPropagateInputToUMG”bool bPropagateInputToUMG = false;variable FocusedComponent
Section titled “variable FocusedComponent”TWeakObjectPtr< UCohtmlBaseComponent > FocusedComponent;variable IMEManager
Section titled “variable IMEManager”TUniquePtr< FCohtmlInputPreprocessorIME > IMEManager;© 2026 Coherent Labs. All rights reserved.