Move GetDisplayServer to LinuxPlatform (add support for custom platform scripting api)
#2800
This commit is contained in:
@@ -12,15 +12,20 @@ struct android_app;
|
||||
/// <summary>
|
||||
/// The Android platform implementation and application management utilities.
|
||||
/// </summary>
|
||||
API_CLASS(Static, Tag="NoTypeInitializer")
|
||||
class FLAXENGINE_API AndroidPlatform : public UnixPlatform
|
||||
{
|
||||
public:
|
||||
|
||||
static android_app* GetApp();
|
||||
static String GetAppPackageName();
|
||||
static String GetDeviceManufacturer();
|
||||
static String GetDeviceModel();
|
||||
static String GetDeviceBuildNumber();
|
||||
// Gets 'getPackageName()' value.
|
||||
API_PROPERTY() static String GetAppPackageName();
|
||||
// Gets 'android.os.Build.MANUFACTURER' value.
|
||||
API_PROPERTY() static String GetDeviceManufacturer();
|
||||
// Gets 'android.os.Build.MODEL' value.
|
||||
API_PROPERTY() static String GetDeviceModel();
|
||||
// Gets 'android.os.Build.DISPLAY' value.
|
||||
API_PROPERTY() static String GetDeviceBuildNumber();
|
||||
static void PreInit(android_app* app);
|
||||
|
||||
public:
|
||||
|
||||
@@ -294,11 +294,6 @@ PlatformType PlatformBase::GetPlatformType()
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
|
||||
String PlatformBase::GetDisplayServer()
|
||||
{
|
||||
return String::Empty;
|
||||
}
|
||||
|
||||
bool PlatformBase::SupportsNativeDecorations()
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -369,11 +369,6 @@ public:
|
||||
/// </summary>
|
||||
API_PROPERTY() static PlatformType GetPlatformType();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the display server name on Linux.
|
||||
/// </summary>
|
||||
API_PROPERTY() static String GetDisplayServer();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if system provides decorations for windows.
|
||||
/// </summary>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
/// <summary>
|
||||
/// The GDK platform implementation and application management utilities.
|
||||
/// </summary>
|
||||
API_CLASS(Static, Tag="NoTypeInitializer")
|
||||
class FLAXENGINE_API GDKPlatform : public Win32Platform
|
||||
{
|
||||
public:
|
||||
@@ -37,10 +38,13 @@ public:
|
||||
/// <param name="hInstance">The Win32 application instance.</param>
|
||||
static void PreInit(void* hInstance);
|
||||
|
||||
static bool IsRunningOnDevKit();
|
||||
|
||||
static void SignInSilently();
|
||||
static void SignInWithUI();
|
||||
// True, if game is running Xbox Devkit.
|
||||
API_PROPERTY() static bool IsRunningOnDevKit();
|
||||
// Signs in user without showing UI. If user is not signed in, it will fail and return false. Use SignInWithUI to show UI and let user sign in.
|
||||
API_FUNCTION() static void SignInSilently();
|
||||
// Signs in user with showing UI. If user is already signed in, it will succeed and return true. If user is not signed in, it will show UI and let user sign in.
|
||||
API_FUNCTION() static void SignInWithUI();
|
||||
// Searches for a user with a specific local ID.
|
||||
static User* FindUser(const struct XUserLocalId& id);
|
||||
|
||||
public:
|
||||
|
||||
@@ -1801,6 +1801,11 @@ const String& LinuxPlatform::GetHomeDirectory()
|
||||
return HomeDir;
|
||||
}
|
||||
|
||||
String LinuxPlatform::GetDisplayServer()
|
||||
{
|
||||
return xDisplay ? TEXT("X11") : TEXT("");
|
||||
}
|
||||
|
||||
bool LinuxPlatform::Is64BitPlatform()
|
||||
{
|
||||
#ifdef PLATFORM_64BITS
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
/// <summary>
|
||||
/// The Linux platform implementation and application management utilities.
|
||||
/// </summary>
|
||||
API_CLASS(Static, Tag="NoTypeInitializer")
|
||||
class FLAXENGINE_API LinuxPlatform : public UnixPlatform
|
||||
{
|
||||
public:
|
||||
@@ -30,9 +31,13 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the current user home directory.
|
||||
/// </summary>
|
||||
/// <returns>The user home directory.</returns>
|
||||
static const String& GetHomeDirectory();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the display server name on Linux (eg. X11, Wayland).
|
||||
/// </summary>
|
||||
API_PROPERTY() static String GetDisplayServer();
|
||||
|
||||
/// <summary>
|
||||
/// An event that is fired when an XEvent is received during platform tick.
|
||||
/// </summary>
|
||||
|
||||
@@ -1691,6 +1691,14 @@ void* SDLPlatform::GetXDisplay()
|
||||
return X11Impl::xDisplay;
|
||||
}
|
||||
|
||||
String SDLPlatform::GetDisplayServer()
|
||||
{
|
||||
String driver(SDL_GetCurrentVideoDriver());
|
||||
if (driver.Length() > 0)
|
||||
driver[0] = StringUtils::ToUpper(driver[0]);
|
||||
return driver;
|
||||
}
|
||||
|
||||
void SDLPlatform::SetHighDpiAwarenessEnabled(bool enable)
|
||||
{
|
||||
base::SetHighDpiAwarenessEnabled(enable);
|
||||
|
||||
@@ -196,18 +196,6 @@ bool SDLPlatform::HandleEvent(SDL_Event& event)
|
||||
return true;
|
||||
}
|
||||
|
||||
String SDLPlatform::GetDisplayServer()
|
||||
{
|
||||
#if PLATFORM_LINUX
|
||||
String driver(SDL_GetCurrentVideoDriver());
|
||||
if (driver.Length() > 0)
|
||||
driver[0] = StringUtils::ToUpper(driver[0]);
|
||||
return driver;
|
||||
#else
|
||||
return String::Empty;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SDLPlatform::SupportsNativeDecorations()
|
||||
{
|
||||
return SDLImpl::WindowDecorationsSupported;
|
||||
|
||||
@@ -62,18 +62,17 @@ private:
|
||||
public:
|
||||
#if PLATFORM_LINUX
|
||||
static void* GetXDisplay();
|
||||
static String GetDisplayServer();
|
||||
#endif
|
||||
static bool UsesWindows();
|
||||
static bool UsesWayland();
|
||||
static bool UsesX11();
|
||||
|
||||
public:
|
||||
|
||||
// [PlatformBase]
|
||||
static bool Init();
|
||||
static void LogInfo();
|
||||
static void Tick();
|
||||
static String GetDisplayServer();
|
||||
static bool SupportsNativeDecorations();
|
||||
static bool SupportsNativeDecorationDragging();
|
||||
static void SetHighDpiAwarenessEnabled(bool enable);
|
||||
|
||||
Reference in New Issue
Block a user