WindowsApplication.ApplyLowLevelMouseFilter

WindowsApplication.ApplyLowLevelMouseFilter

#Overview

name: WindowsApplication.ApplyLowLevelMouseFilter

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 WindowsApplication.ApplyLowLevelMouseFilter is to apply a low-level mouse filter that screens out mouse inputs that behave like touch inputs in the Windows application of Unreal Engine.

This setting variable is primarily used in the Windows-specific implementation of the Application Core subsystem of Unreal Engine. It’s part of the FWindowsApplication class, which handles Windows-specific application functionality.

The value of this variable is not directly set as a traditional variable. Instead, it’s implemented as a method (ApplyLowLevelMouseFilter()) that can be called to apply the filter. It’s invoked in the following scenarios:

  1. During the FWindowsApplication constructor if the command line parameter “-FilterLowLevelMouse” is present.
  2. As a console command that can be triggered at runtime.

This variable interacts with a corresponding RemoveLowLevelMouseFilter() method, which removes the applied filter. Both methods are registered as console commands, allowing developers to toggle the filter on and off during runtime.

Developers should be aware of the following:

  1. This filter is primarily intended for game mode, as it may interfere with digitizer devices in the editor.
  2. It’s designed to filter out mouse inputs that mimic touch inputs, which can be useful for certain types of applications or when dealing with specific input devices.
  3. The filter is automatically removed when the application is destroyed or if an error occurs during shutdown.

Best practices when using this variable include:

  1. Only apply the filter when necessary, typically in game mode rather than in the editor.
  2. Be cautious when using this filter if your application relies on precise mouse input or uses specialized input devices.
  3. Consider providing user options to enable or disable this filter if it significantly affects input behavior.
  4. Test thoroughly with various input devices to ensure the filter doesn’t negatively impact user experience.

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

Scope (from outer to inner):

file
function     FWindowsApplication::FWindowsApplication

Source code excerpt:

		ApplyLowLevelMouseFilter();
	}	
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("WindowsApplication.ApplyLowLevelMouseFilter"), TEXT("Applies Low Level mouse filter that filters out mouse inputs that act like touch inputs"), FConsoleCommandDelegate::CreateRaw(this, &FWindowsApplication::ApplyLowLevelMouseFilter));
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("WindowsApplication.RemoveLowLevelMouseFilter"), TEXT("Removes Low Level mouse filter that filters out mouse inputs that act like touch inputs"), FConsoleCommandDelegate::CreateRaw(this, &FWindowsApplication::RemoveLowLevelMouseFilter));
}

void FWindowsApplication::ApplyLowLevelMouseFilter()
{
	//Only check fake mouse inputs in game or digitizer devices will not work in the editor.

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

Scope (from outer to inner):

file
function     void FWindowsApplication::DestroyApplication

Source code excerpt:


	RemoveLowLevelMouseFilter();
	IConsoleManager::Get().UnregisterConsoleObject(TEXT("WindowsApplication.ApplyLowLevelMouseFilter"));
	IConsoleManager::Get().UnregisterConsoleObject(TEXT("WindowsApplication.RemoveLowLevelMouseFilter"));
}

void FWindowsApplication::ShutDownAfterError()
{
	// Restore accessibility shortcuts and remove the saved state from the .ini

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

Scope (from outer to inner):

file
function     void FWindowsApplication::ShutDownAfterError

Source code excerpt:


	RemoveLowLevelMouseFilter();
	IConsoleManager::Get().UnregisterConsoleObject(TEXT("WindowsApplication.ApplyLowLevelMouseFilter"));
	IConsoleManager::Get().UnregisterConsoleObject(TEXT("WindowsApplication.RemoveLowLevelMouseFilter"));
}

bool FWindowsApplication::RegisterClass( const HINSTANCE HInstance, const HICON HIcon )
{
	WNDCLASS wc;