Merge remote-tracking branch 'origin/master' into sdl_platform

This commit is contained in:
2025-12-15 19:03:05 +02:00
60 changed files with 481 additions and 110 deletions

View File

@@ -52,6 +52,7 @@ Array<User*, FixedAllocation<8>> PlatformBase::Users;
Delegate<User*> PlatformBase::UserAdded;
Delegate<User*> PlatformBase::UserRemoved;
void* OutOfMemoryBuffer = nullptr;
volatile int64 FatalReporting = 0;
const Char* ToString(NetworkConnectionType value)
{
@@ -330,11 +331,20 @@ int32 PlatformBase::GetCacheLineSize()
void PlatformBase::Fatal(const StringView& msg, void* context, FatalErrorType error)
{
// Let only one thread to report the error (and wait for it to end to have valid log before crash)
RETRY:
if (Platform::InterlockedCompareExchange(&FatalReporting, 1, 0) != 0)
{
Platform::Sleep(1);
goto RETRY;
}
// Check if is already during fatal state
if (Engine::FatalError != FatalErrorType::None)
{
// Just send one more error to the log and back
LOG(Error, "Error after fatal error: {0}", msg);
Platform::AtomicStore(&FatalReporting, 0);
return;
}
@@ -453,6 +463,8 @@ void PlatformBase::Fatal(const StringView& msg, void* context, FatalErrorType er
}
#endif
Platform::AtomicStore(&FatalReporting, 0);
// Show error message
if (Engine::ReportCrash.IsBinded())
Engine::ReportCrash(msg, context);

View File

@@ -18,6 +18,7 @@
#include "Engine/Graphics/PixelFormatSampler.h"
#include "Engine/Graphics/Textures/TextureData.h"
#include "IncludeX11.h"
#include "ThirdParty/X11/Xutil.h"
// ICCCM
#define WM_NormalState 1L // window normal state
@@ -178,6 +179,20 @@ LinuxWindow::LinuxWindow(const CreateWindowSettings& settings)
X11::XSetTransientForHint(display, window, (X11::Window)((LinuxWindow*)settings.Parent)->GetNativePtr());
}
// Provides class hint for WMs like Hyprland to hook onto and apply window rules
X11::XClassHint* classHint = X11::XAllocClassHint();
if (classHint)
{
const char* className = settings.IsRegularWindow ? "FlexEditor" : "FlaxPopup";
classHint->res_name = const_cast<char*>(className);
classHint->res_class = const_cast<char*>(className);
X11::XSetClassHint(display, window, classHint);
XFree(classHint);
}
_dpi = Platform::GetDpi();
_dpiScale = (float)_dpi / (float)DefaultDPI;