Add Platform.Users to handle users per-platform

This commit is contained in:
Wojtek Figat
2021-11-07 20:46:56 +01:00
parent 21e6e8bc7b
commit b3eb17f61e
17 changed files with 203 additions and 94 deletions

View File

@@ -21,6 +21,7 @@
#include "Engine/Platform/WindowsManager.h"
#include "Engine/Platform/Clipboard.h"
#include "Engine/Platform/IGuiData.h"
#include "Engine/Platform/Base/PlatformUtils.h"
#include "Engine/Utilities/StringConverter.h"
#include "Engine/Threading/Threading.h"
#include "Engine/Engine/Engine.h"
@@ -51,7 +52,7 @@
CPUInfo UnixCpu;
int ClockSource;
Guid DeviceId;
String UserLocale, ComputerName, UserName, HomeDir;
String UserLocale, ComputerName, HomeDir;
byte MacAddress[6];
#define UNIX_APP_BUFF_SIZE 256
@@ -2014,6 +2015,10 @@ bool LinuxPlatform::Init()
UnixCpu.CacheLineSize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
ASSERT(UnixCpu.CacheLineSize && Math::IsPowerOfTwo(UnixCpu.CacheLineSize));
// Get user name string
getlogin_r(buffer, UNIX_APP_BUFF_SIZE);
OnPlatformUserAdd(New<User>(String(buffer));
UnixGetMacAddress(MacAddress);
// Generate unique device ID
@@ -2054,10 +2059,6 @@ bool LinuxPlatform::Init()
gethostname(buffer, UNIX_APP_BUFF_SIZE);
ComputerName = String(buffer);
// Get user name string
getlogin_r(buffer, UNIX_APP_BUFF_SIZE);
UserName = String(buffer);
// Get home dir
struct passwd pw;
struct passwd* result = NULL;
@@ -2603,11 +2604,6 @@ String LinuxPlatform::GetComputerName()
return ComputerName;
}
String LinuxPlatform::GetUserName()
{
return UserName;
}
bool LinuxPlatform::GetHasFocus()
{
// Check if any window is focused