Slate.ForceRawInputSimulation

Slate.ForceRawInputSimulation

#Overview

name: Slate.ForceRawInputSimulation

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Slate.ForceRawInputSimulation is to control the simulation of raw input in the Windows application environment of Unreal Engine. This setting is primarily used for input handling and simulation within the Slate UI framework.

This setting variable is relied upon by the ApplicationCore module, specifically within the Windows application implementation. It’s used in the WindowsApplication.cpp file, which is part of the Windows-specific application handling in Unreal Engine.

The value of this variable is set through an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands. It’s initialized as false by default.

The Slate.ForceRawInputSimulation variable interacts directly with a static integer variable named ForceRawInputSimulation. They share the same value, with the console variable acting as an interface to modify the static variable.

Developers must be aware that this variable is platform-specific (Windows only) and is used in conjunction with another variable, EnableRawInputSimulationOverRDP, to determine whether raw input should be simulated. The ShouldSimulateRawInput() function uses both these variables to make this determination.

Best practices when using this variable include:

  1. Only modify it when necessary, as it affects the input handling behavior of the application.
  2. Be aware of its interaction with remote desktop sessions (RDP) and the EnableRawInputSimulationOverRDP variable.
  3. Use it for debugging or specific input simulation scenarios, rather than in regular production builds.

Regarding the associated variable ForceRawInputSimulation:

The purpose of ForceRawInputSimulation is to serve as the actual storage for the Slate.ForceRawInputSimulation setting. It’s a static integer variable that directly controls whether raw input simulation should be forced.

This variable is used within the ApplicationCore module, specifically in the Windows application implementation.

Its value is set through the Slate.ForceRawInputSimulation console variable, allowing for runtime modification.

ForceRawInputSimulation interacts directly with the Slate.ForceRawInputSimulation console variable and is used in conjunction with EnableRawInputSimulationOverRDP in the ShouldSimulateRawInput() function.

Developers should be aware that modifying ForceRawInputSimulation directly is not recommended. Instead, they should use the Slate.ForceRawInputSimulation console variable to ensure proper synchronization.

Best practices for ForceRawInputSimulation include:

  1. Avoid modifying it directly in code; use the console variable instead.
  2. Consider its impact on input handling when debugging input-related issues on Windows platforms.
  3. Be cautious when enabling it, as it may affect the normal input behavior of the application.

#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:73

Scope: file

Source code excerpt:

static int32 ForceRawInputSimulation = false;
FAutoConsoleVariableRef	CVarForceRawInputSimulation(
	TEXT("Slate.ForceRawInputSimulation"),
	ForceRawInputSimulation,
	TEXT("")
);
#else
static int32 ForceRawInputSimulation = false;
static int32 EnableRawInputSimulationOverRDP = false;

#Associated Variable and Callsites

This variable is associated with another variable named ForceRawInputSimulation. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/Windows/WindowsApplication.cpp:71

Scope: file

Source code excerpt:

);

static int32 ForceRawInputSimulation = false;
FAutoConsoleVariableRef	CVarForceRawInputSimulation(
	TEXT("Slate.ForceRawInputSimulation"),
	ForceRawInputSimulation,
	TEXT("")
);
#else
static int32 ForceRawInputSimulation = false;
static int32 EnableRawInputSimulationOverRDP = false;
#endif

/* 
* Enabling first touch event will prevent small pop on some touch input devices.
*/

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/Windows/WindowsApplication.cpp:98

Scope (from outer to inner):

file
function     static bool ShouldSimulateRawInput

Source code excerpt:

static bool ShouldSimulateRawInput()
{
	return ForceRawInputSimulation || (EnableRawInputSimulationOverRDP && FPlatformMisc::IsRemoteSession());
}

FWindowsApplication* FWindowsApplication::CreateWindowsApplication( const HINSTANCE InstanceHandle, const HICON IconHandle )
{
	WindowsApplication = new FWindowsApplication( InstanceHandle, IconHandle );
	return WindowsApplication;