WindowsApplication.EnableFirstTouchEvent
WindowsApplication.EnableFirstTouchEvent
#Overview
name: WindowsApplication.EnableFirstTouchEvent
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable FirstTouch Event which prevents small pop on some touch input devices
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of WindowsApplication.EnableFirstTouchEvent is to prevent small “pop” movements on some touch input devices when handling touch events in the Windows application layer of Unreal Engine.
This setting variable is primarily used in the ApplicationCore module, specifically in the Windows-specific implementation of the application layer. It’s part of the input handling system for Windows platforms.
The value of this variable is set through a console variable (CVar) system. It’s initialized as a static boolean variable bEnableFirstTouchEvent
and then linked to the console variable “WindowsApplication.EnableFirstTouchEvent” using FAutoConsoleVariableRef.
The associated variable that interacts with it is bEnableFirstTouchEvent
. They share the same value, with the console variable acting as an external interface to modify the internal static boolean.
Developers must be aware that this variable affects the behavior of touch input processing on Windows platforms. When enabled, it introduces additional logic to handle the first touch movement event differently, which can help reduce unwanted small movements or “pops” that some touch devices might exhibit.
Best practices when using this variable include:
- Only enable it if you’re experiencing issues with touch input on Windows devices.
- Test thoroughly with various touch input devices to ensure it doesn’t negatively impact other touch interactions.
- Consider making it configurable in your game’s settings if touch input is a critical part of your game’s interface.
Regarding the associated variable bEnableFirstTouchEvent
:
The purpose of bEnableFirstTouchEvent
is to serve as the internal representation of the WindowsApplication.EnableFirstTouchEvent setting.
This variable is used directly in the touch input processing logic within the FWindowsApplication class. It’s checked when processing touch move events to determine whether to apply the special first-touch handling.
The value of this variable is set indirectly through the console variable system. Any changes to WindowsApplication.EnableFirstTouchEvent will be reflected in bEnableFirstTouchEvent
.
There are no other variables that directly interact with bEnableFirstTouchEvent
, but it does influence the behavior of the TouchInfoArray
when processing touch events.
Developers should be aware that modifying this variable directly in code is not recommended, as it may be overwritten by the console variable system. Instead, they should use the WindowsApplication.EnableFirstTouchEvent console variable to control this feature.
Best practices for bEnableFirstTouchEvent
align with those of WindowsApplication.EnableFirstTouchEvent, focusing on careful testing and consideration of its impact on touch input behavior across different devices.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/Windows/WindowsApplication.cpp:87
Scope: file
Source code excerpt:
static bool bEnableFirstTouchEvent = false;
FAutoConsoleVariableRef CVarEnableFirstTouchEvent(
TEXT("WindowsApplication.EnableFirstTouchEvent"),
bEnableFirstTouchEvent,
TEXT("Enable FirstTouch Event which prevents small pop on some touch input devices")
);
const FIntPoint FWindowsApplication::MinimizedWindowPosition(-32000,-32000);
#Associated Variable and Callsites
This variable is associated with another variable named bEnableFirstTouchEvent
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/Windows/WindowsApplication.cpp:85
Scope: file
Source code excerpt:
* Enabling first touch event will prevent small pop on some touch input devices.
*/
static bool bEnableFirstTouchEvent = false;
FAutoConsoleVariableRef CVarEnableFirstTouchEvent(
TEXT("WindowsApplication.EnableFirstTouchEvent"),
bEnableFirstTouchEvent,
TEXT("Enable FirstTouch Event which prevents small pop on some touch input devices")
);
const FIntPoint FWindowsApplication::MinimizedWindowPosition(-32000,-32000);
FWindowsApplication* WindowsApplication = nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/Windows/WindowsApplication.cpp:2360
Scope: file
Source code excerpt:
UE_LOG(LogWindowsDesktop, Verbose, TEXT("OnTouchMoved at (%f, %f), finger %d (system touch id %d)"), Location.X, Location.Y, TouchIndex, Input.dwID);
if (bEnableFirstTouchEvent)
{
// track first move event, for helping with "pop" on the filtered small movements
if (!TouchInfoArray[TouchIndex].HasMoved)
{
if (TouchInfoArray[TouchIndex].PreviousLocation != Location)
{