mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
commit
4353d2a10d
5 changed files with 39 additions and 0 deletions
|
@ -103,6 +103,7 @@ namespace Beefy.gfx
|
|||
scope AutoBeefPerf("Image.LoadFromFile");
|
||||
|
||||
var useFileName = scope String()..Append(fileName);
|
||||
useFileName.Replace('\\', '/');
|
||||
FilePackManager.TryMakeMemoryString(useFileName);
|
||||
void* aNativeTextureSegment = Gfx_LoadTexture(useFileName, (int32)flags);
|
||||
if (aNativeTextureSegment == null)
|
||||
|
|
|
@ -623,6 +623,9 @@ abstract class CommonDialog
|
|||
|
||||
public Result<DialogResult> ShowDialog(INativeWindow owner = null)
|
||||
{
|
||||
if (!Linux.IsSystemdAvailable)
|
||||
return .Err;
|
||||
|
||||
TryC!(Linux.SdBusOpenUser(&mBus)); // Maybe keep the bus open while the program is running ?
|
||||
|
||||
Linux.DBusMsg* call = ?;
|
||||
|
|
|
@ -44,6 +44,33 @@ class Linux
|
|||
|
||||
public typealias DBusMsgHandler = function int32(DBusMsg *m, void *userdata, DBusErr *ret_error);
|
||||
|
||||
public static bool IsSystemdAvailable { get; private set; } = true;
|
||||
|
||||
[AlwaysInclude, StaticInitPriority(100)]
|
||||
static class AllowFail
|
||||
{
|
||||
public static this()
|
||||
{
|
||||
Runtime.AddErrorHandler(new => Handle);
|
||||
}
|
||||
|
||||
public static Runtime.ErrorHandlerResult Handle(Runtime.ErrorStage errorStage, Runtime.Error error)
|
||||
{
|
||||
if (errorStage == .PreFail)
|
||||
{
|
||||
if (var loadLibaryError = error as Runtime.LoadSharedLibraryError)
|
||||
{
|
||||
if (loadLibaryError.mPath == "libsystemd.so")
|
||||
{
|
||||
IsSystemdAvailable = false;
|
||||
return .Ignore;
|
||||
}
|
||||
}
|
||||
}
|
||||
return .ContinueFailure;
|
||||
}
|
||||
}
|
||||
|
||||
[Import("libsystemd.so"), LinkName("sd_bus_open_user")]
|
||||
public static extern c_int SdBusOpenUser(DBus **ret);
|
||||
[Import("libsystemd.so"), LinkName("sd_bus_open_system")]
|
||||
|
|
|
@ -972,6 +972,9 @@ namespace System
|
|||
|
||||
public void Append(char8* appendPtr, int length)
|
||||
{
|
||||
Debug.Assert(length >= 0);
|
||||
if (length <= 0)
|
||||
return;
|
||||
int newCurrentIndex = mLength + length;
|
||||
char8* ptr;
|
||||
if (newCurrentIndex > AllocSize)
|
||||
|
@ -996,6 +999,9 @@ namespace System
|
|||
|
||||
public void Append(char8[] arr, int idx, int length)
|
||||
{
|
||||
Debug.Assert(length >= 0);
|
||||
if (length <= 0)
|
||||
return;
|
||||
int newCurrentIndex = mLength + length;
|
||||
char8* ptr;
|
||||
if (newCurrentIndex > AllocSize)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue