Enable OnController_X function deprecations for the Slate App and the Generic Message handler.

#jira UE-156743
#rb Patrick.Boutot
#rnx
#preflight 62d083ff7e1c26dcd7d35502

[CL 21099901 by ben hoffman in ue5-main branch]
This commit is contained in:
ben hoffman
2022-07-14 17:32:34 -04:00
parent 5a2a71ef07
commit 7f71aead5a
3 changed files with 97 additions and 79 deletions
@@ -8,6 +8,7 @@
#include "Math/Vector2D.h"
#include "Templates/SharedPointer.h"
#include "Misc/Optional.h"
#include "GenericPlatform/GenericPlatformInputDeviceMapper.h"
class FGenericWindow;
@@ -305,28 +306,34 @@ public:
virtual bool OnControllerAnalog(FGamepadKeyNames::Type KeyName, FPlatformUserId PlatformUserId, FInputDeviceId InputDeviceId, float AnalogValue)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
if (!ShouldUsePlatformUserId())
{
return OnControllerAnalog(KeyName, PlatformUserId.GetInternalId(), AnalogValue);
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
return false;
}
virtual bool OnControllerButtonPressed(FGamepadKeyNames::Type KeyName, FPlatformUserId PlatformUserId, FInputDeviceId InputDeviceId, bool IsRepeat)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
if (!ShouldUsePlatformUserId())
{
return OnControllerButtonPressed(KeyName, PlatformUserId.GetInternalId(), IsRepeat);
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
return false;
}
virtual bool OnControllerButtonReleased(FGamepadKeyNames::Type KeyName, FPlatformUserId PlatformUserId, FInputDeviceId InputDeviceId, bool IsRepeat)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
if (!ShouldUsePlatformUserId())
{
return OnControllerButtonReleased(KeyName, PlatformUserId.GetInternalId(), IsRepeat);
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
return false;
}
@@ -513,38 +520,54 @@ public:
}
// Deprecate these when engine code has been converted to handle platform user id
//UE_DEPRECATED(5.1, "This version of OnControllerAnalog has been deprecated, please use the one that takes an FPlatformUser and FInputDeviceId instead.")
UE_DEPRECATED(5.1, "This version of OnControllerAnalog has been deprecated, please use the one that takes an FPlatformUser and FInputDeviceId instead.")
virtual bool OnControllerAnalog(FGamepadKeyNames::Type KeyName, int32 ControllerId, float AnalogValue)
{
if (ShouldUsePlatformUserId())
{
return OnControllerAnalog(KeyName, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE, AnalogValue);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnControllerAnalog(KeyName, UserId, DeviceId, AnalogValue);
}
return false;
}
//UE_DEPRECATED(5.1, "This version of OnControllerButtonPressed has been deprecated, please use the one that takes an FPlatformUser and FInputDeviceId instead.")
UE_DEPRECATED(5.1, "This version of OnControllerButtonPressed has been deprecated, please use the one that takes an FPlatformUser and FInputDeviceId instead.")
virtual bool OnControllerButtonPressed(FGamepadKeyNames::Type KeyName, int32 ControllerId, bool IsRepeat)
{
if (ShouldUsePlatformUserId())
{
return OnControllerButtonPressed(KeyName, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE, IsRepeat);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnControllerButtonPressed(KeyName, UserId, DeviceId, IsRepeat);
}
return false;
}
//UE_DEPRECATED(5.1, "This version of OnControllerButtonReleased has been deprecated, please use the one that takes an FPlatformUser and FInputDeviceId instead.")
UE_DEPRECATED(5.1, "This version of OnControllerButtonReleased has been deprecated, please use the one that takes an FPlatformUser and FInputDeviceId instead.")
virtual bool OnControllerButtonReleased(FGamepadKeyNames::Type KeyName, int32 ControllerId, bool IsRepeat)
{
if (ShouldUsePlatformUserId())
{
return OnControllerButtonReleased(KeyName, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE, IsRepeat);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnControllerButtonReleased(KeyName, UserId, DeviceId, IsRepeat);
}
return false;
}
virtual bool OnTouchStarted(const TSharedPtr< FGenericWindow >& Window, const FVector2D& Location, float Force, int32 TouchIndex, int32 ControllerId)
{
{
if (ShouldUsePlatformUserId())
{
return OnTouchStarted(Window, Location, Force, TouchIndex, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnTouchStarted(Window, Location, Force, TouchIndex, UserId, DeviceId);
}
return false;
}
@@ -552,7 +575,11 @@ public:
{
if (ShouldUsePlatformUserId())
{
return OnTouchMoved(Location, Force, TouchIndex, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnTouchMoved(Location, Force, TouchIndex, UserId, DeviceId);
}
return false;
}
@@ -560,7 +587,11 @@ public:
{
if (ShouldUsePlatformUserId())
{
return OnTouchEnded(Location, TouchIndex, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnTouchEnded(Location, TouchIndex, UserId, DeviceId);
}
return false;
}
@@ -568,7 +599,11 @@ public:
{
if (ShouldUsePlatformUserId())
{
return OnTouchForceChanged(Location, Force, TouchIndex, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnTouchForceChanged(Location, Force, TouchIndex, UserId, DeviceId);
}
return false;
}
@@ -576,7 +611,11 @@ public:
{
if (ShouldUsePlatformUserId())
{
return OnTouchFirstMove(Location, Force, TouchIndex, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnTouchFirstMove(Location, Force, TouchIndex, UserId, DeviceId);
}
return false;
}
@@ -584,7 +623,11 @@ public:
{
if (ShouldUsePlatformUserId())
{
return OnMotionDetected(Tilt, RotationRate, Gravity, Acceleration, FPlatformUserId(ControllerId), INPUTDEVICEID_NONE);
// Remap the old int32 ControlerId to the new Platform user for backwards compat
FPlatformUserId UserId = FGenericPlatformMisc::GetPlatformUserForUserIndex(ControllerId);
FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
IPlatformInputDeviceMapper::Get().RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
return OnMotionDetected(Tilt, RotationRate, Gravity, Acceleration, UserId, DeviceId);
}
return false;
}