Compare commits
9 Commits
cd2e7140af
...
003952dfec
| Author | SHA1 | Date | |
|---|---|---|---|
| 003952dfec | |||
| 3190c22295 | |||
| 366404f251 | |||
| 484c8ce146 | |||
| c9f1a45f40 | |||
| 089346b296 | |||
| ac0ce8fa74 | |||
| 9331c35ab3 | |||
| 45f67c4d8c |
@@ -206,6 +206,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
// Create window
|
||||
var desc = CreateWindowSettings.Default;
|
||||
desc.Position = locationSS;
|
||||
Editor.Log($"contextmenu loc: {locationSS}, in parentloc: {location}");
|
||||
desc.StartPosition = WindowStartPosition.Manual;
|
||||
desc.Size = dpiSize;
|
||||
desc.Fullscreen = false;
|
||||
@@ -220,6 +221,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
desc.IsTopmost = true;
|
||||
desc.Type = WindowType.Popup;
|
||||
desc.Parent = parentWin.Window;
|
||||
desc.Title = "ContextMenu";
|
||||
desc.HasSizingFrame = false;
|
||||
OnWindowCreating(ref desc);
|
||||
_window = Platform.CreateWindow(ref desc);
|
||||
|
||||
@@ -2112,6 +2112,7 @@ bool LinuxPlatform::Init()
|
||||
DeviceId.D = (uint32)UnixCpu.ClockSpeed * UnixCpu.LogicalProcessorCount * UnixCpu.ProcessorCoreCount * UnixCpu.CacheLineSize;
|
||||
}
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
// Get user locale string
|
||||
setlocale(LC_ALL, "");
|
||||
const char* locale = setlocale(LC_CTYPE, NULL);
|
||||
@@ -2121,6 +2122,7 @@ bool LinuxPlatform::Init()
|
||||
UserLocale.Replace('_', '-');
|
||||
if (UserLocale == TEXT("C"))
|
||||
UserLocale = TEXT("en");
|
||||
#endif
|
||||
|
||||
// Get computer name string
|
||||
gethostname(buffer, UNIX_APP_BUFF_SIZE);
|
||||
@@ -2685,6 +2687,7 @@ void LinuxPlatform::Exit()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
int32 LinuxPlatform::GetDpi()
|
||||
{
|
||||
return SystemDpi;
|
||||
@@ -2694,6 +2697,7 @@ String LinuxPlatform::GetUserLocaleName()
|
||||
{
|
||||
return UserLocale;
|
||||
}
|
||||
#endif
|
||||
|
||||
String LinuxPlatform::GetComputerName()
|
||||
{
|
||||
@@ -2901,14 +2905,12 @@ bool LinuxPlatform::SetWorkingDirectory(const String& path)
|
||||
return chdir(StringAsANSI<>(*path).Get()) != 0;
|
||||
}
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
Window* LinuxPlatform::CreateWindow(const CreateWindowSettings& settings)
|
||||
{
|
||||
#if PLATFORM_SDL
|
||||
return New<SDLWindow>(settings);
|
||||
#else
|
||||
return New<LinuxWindow>(settings);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
|
||||
|
||||
@@ -122,8 +122,10 @@ public:
|
||||
static void Tick();
|
||||
static void BeforeExit();
|
||||
static void Exit();
|
||||
#if !PLATFORM_SDL
|
||||
static int32 GetDpi();
|
||||
static String GetUserLocaleName();
|
||||
#endif
|
||||
static String GetComputerName();
|
||||
static bool GetHasFocus();
|
||||
static bool CanOpenUrl(const StringView& url);
|
||||
@@ -138,7 +140,9 @@ public:
|
||||
static Guid GetUniqueDeviceId();
|
||||
static String GetWorkingDirectory();
|
||||
static bool SetWorkingDirectory(const String& path);
|
||||
#if !PLATFORM_SDL
|
||||
static Window* CreateWindow(const CreateWindowSettings& settings);
|
||||
#endif
|
||||
static void GetEnvironmentVariables(Dictionary<String, String, HeapAllocation>& result);
|
||||
static bool GetEnvironmentVariable(const String& name, String& value);
|
||||
static bool SetEnvironmentVariable(const String& name, const String& value);
|
||||
|
||||
@@ -483,7 +483,7 @@ bool SDLInput::HandleEvent(SDLWindow* window, SDL_Event& event)
|
||||
else
|
||||
{
|
||||
const Float2 mousePos = window->ClientToScreen({ event.motion.x, event.motion.y });
|
||||
//LOG(Info, "motion {},{}, mouse: {}", event.motion.x, event.motion.y, mousePos);
|
||||
//LOG(Info, "motion {},{}, mouse: {}, win: {}", event.motion.x, event.motion.y, mousePos, String(window->GetTitle()));
|
||||
Input::Mouse->OnMouseMove(mousePos, window);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <SDL3/SDL_revision.h>
|
||||
#include <SDL3/SDL_system.h>
|
||||
#include <SDL3/SDL_version.h>
|
||||
#include <SDL3/SDL_locale.h>
|
||||
|
||||
#if PLATFORM_LINUX
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
@@ -32,6 +33,7 @@ uint32 SDLPlatform::DraggedWindowId = 0;
|
||||
namespace
|
||||
{
|
||||
int32 SystemDpi = 96;
|
||||
String UserLocale("en");
|
||||
}
|
||||
|
||||
bool SDLPlatform::Init()
|
||||
@@ -41,6 +43,7 @@ bool SDLPlatform::Init()
|
||||
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "x11", SDL_HINT_OVERRIDE);
|
||||
else if (CommandLine::Options.Wayland)
|
||||
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
|
||||
//SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
|
||||
// If the hint is not present, SDL will prefer more stable X11 driver over Wayland
|
||||
#endif
|
||||
|
||||
@@ -68,6 +71,8 @@ bool SDLPlatform::Init()
|
||||
//SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1"); // Disables raw mouse input
|
||||
SDL_SetHint(SDL_HINT_WINDOWS_RAW_KEYBOARD, "1");
|
||||
|
||||
SDL_SetHint(SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY, "1");
|
||||
|
||||
// Disable SDL clipboard support
|
||||
SDL_SetEventEnabled(SDL_EVENT_CLIPBOARD_UPDATE, false);
|
||||
|
||||
@@ -81,6 +86,23 @@ bool SDLPlatform::Init()
|
||||
if (!SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD))
|
||||
Platform::Fatal(String::Format(TEXT("Failed to initialize SDL: {0}."), String(SDL_GetError())));
|
||||
|
||||
int localesCount = 0;
|
||||
auto locales = SDL_GetPreferredLocales(&localesCount);
|
||||
for (int i = 0; i < localesCount; i++)
|
||||
{
|
||||
auto language = StringAnsiView(locales[i]->language);
|
||||
auto country = StringAnsiView(locales[i]->country);
|
||||
if (language.StartsWith("en"))
|
||||
{
|
||||
if (country != nullptr)
|
||||
UserLocale = String::Format(TEXT("{0}-{1}"), String(language), String(locales[i]->country));
|
||||
else
|
||||
UserLocale = String(language);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_free(locales);
|
||||
|
||||
if (InitPlatform())
|
||||
return true;
|
||||
|
||||
@@ -226,6 +248,11 @@ int32 SDLPlatform::GetDpi()
|
||||
return SystemDpi;
|
||||
}
|
||||
|
||||
String SDLPlatform::GetUserLocaleName()
|
||||
{
|
||||
return UserLocale;
|
||||
}
|
||||
|
||||
void SDLPlatform::OpenUrl(const StringView& url)
|
||||
{
|
||||
StringAnsi urlStr(url);
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
static void SetHighDpiAwarenessEnabled(bool enable);
|
||||
static BatteryInfo GetBatteryInfo();
|
||||
static int32 GetDpi();
|
||||
static String GetUserLocaleName();
|
||||
static void OpenUrl(const StringView& url);
|
||||
static Float2 GetMousePosition();
|
||||
static void SetMousePosition(const Float2& pos);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#endif
|
||||
#elif PLATFORM_LINUX
|
||||
#include "Engine/Platform/Linux/IncludeX11.h"
|
||||
#define X11_WINDOW_POSITION_WORKAROUND 1
|
||||
#endif
|
||||
|
||||
#define DefaultDPI 96
|
||||
@@ -49,7 +50,9 @@ namespace
|
||||
void* GetNativeWindowPointer(SDL_Window* window);
|
||||
SDL_HitTestResult OnWindowHitTest(SDL_Window* win, const SDL_Point* area, void* data);
|
||||
Int2 GetSDLWindowPosition(const SDLWindow* window);
|
||||
void SetSDLWindowPosition(SDLWindow* window, const int x, const int y);
|
||||
void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition, bool clienttoscreen = true);
|
||||
void SetRelativeWindowPosition(const WindowType windowType, SDLWindow* parent, int32& xRel, int32& yRel);
|
||||
|
||||
class SDLDropFilesData : public IGuiData
|
||||
{
|
||||
@@ -105,6 +108,8 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
int32 windowHeight = clientHeight;
|
||||
_clientSize = Float2((float)clientWidth, (float)clientHeight);
|
||||
|
||||
|
||||
|
||||
if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
// The compositor seems to crash when something is rendered to the hidden popup window surface
|
||||
@@ -131,7 +136,6 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
flags |= SDL_WINDOW_ALWAYS_ON_TOP;
|
||||
if (_settings.SupportsTransparency)
|
||||
flags |= SDL_WINDOW_TRANSPARENT;
|
||||
//flags |= SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
||||
|
||||
// Disable parenting of child windows as those are always on top of the parent window and never show up in taskbar
|
||||
//if (_settings.Parent != nullptr && (_settings.Type != WindowType::Tooltip && _settings.Type != WindowType::Popup))
|
||||
@@ -146,10 +150,13 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
{
|
||||
if (win->IsForegroundWindow())
|
||||
{
|
||||
_settings.Parent = win;
|
||||
break;
|
||||
if (win->_settings.Type == WindowType::Tooltip || win->_settings.Type == WindowType::Popup)
|
||||
{
|
||||
auto focusedParent = win->_settings.Parent;
|
||||
while (focusedParent != nullptr)
|
||||
_settings.Parent = win;
|
||||
while (focusedParent != nullptr && (focusedParent->_settings.Type == WindowType::Tooltip || focusedParent->_settings.Type == WindowType::Popup))
|
||||
{
|
||||
if (focusedParent->_settings.Parent == nullptr)
|
||||
{
|
||||
@@ -157,7 +164,20 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
break;
|
||||
}
|
||||
focusedParent = focusedParent->_settings.Parent;
|
||||
//_settings.Parent = focusedParent;
|
||||
//break;
|
||||
}
|
||||
/*while (focusedParent != nullptr)
|
||||
{
|
||||
if (focusedParent->_settings.Parent == nullptr)
|
||||
{
|
||||
_settings.Parent = focusedParent;
|
||||
break;
|
||||
}
|
||||
focusedParent = focusedParent->_settings.Parent;
|
||||
//_settings.Parent = focusedParent;
|
||||
//break;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
_settings.Parent = win;
|
||||
@@ -169,48 +189,76 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
if (_settings.Parent == nullptr)
|
||||
_settings.Parent = Engine::MainWindow;
|
||||
}
|
||||
|
||||
// The SDL window position is always relative to the parent window
|
||||
//x = 5;
|
||||
//y = 5;
|
||||
Int2 oldpos(x, y);
|
||||
if (_settings.Parent != nullptr && SDLPlatform::UsesX11())
|
||||
{//(_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup)
|
||||
//if (_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup)
|
||||
else if (_settings.Parent != nullptr && _settings.Parent->_settings.Type != WindowType::Regular && (_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup))
|
||||
{
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(_settings.Parent);
|
||||
GetRelativeWindowPosition(_settings.Parent, parentPosition, false);
|
||||
//auto parentPosition = _settings.Parent->ClientToScreen(Float2::Zero);
|
||||
x -= parentPosition.X;
|
||||
y -= parentPosition.Y;
|
||||
auto parent = _settings.Parent->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
_settings.Parent = parent;
|
||||
if (_settings.Parent->_settings.Type == WindowType::Regular)
|
||||
break;
|
||||
parent = _settings.Parent->GetSettings().Parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_settings.Parent != nullptr)
|
||||
{//(_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup)
|
||||
if ((_settings.Type == WindowType::Tooltip || _settings.Type == WindowType::Popup))
|
||||
{
|
||||
if (_settings.Parent != nullptr && (_settings.Parent->GetSettings().Type == WindowType::Tooltip || _settings.Parent->GetSettings().Type == WindowType::Popup))
|
||||
{
|
||||
x += 0;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(Info, "{}x{}, parent: {}", x, y, _settings.Parent != nullptr ? _settings.Parent->GetTitle() : String("null"));
|
||||
|
||||
// The SDL window position is always relative to the parent window
|
||||
|
||||
Int2 oldpos(x, y);
|
||||
if (_settings.Parent != nullptr)
|
||||
{
|
||||
#if PLATFORM_WINDOWS
|
||||
auto parentPosition = _settings.Parent->ClientToScreen(Float2::Zero);
|
||||
x -= Math::TruncToInt(parentPosition.X);
|
||||
y -= Math::TruncToInt(parentPosition.Y);
|
||||
|
||||
auto parentType = _settings.Parent->GetSettings().Type;
|
||||
auto parentParent = _settings.Parent->GetSettings().Parent;
|
||||
if (parentParent != nullptr)
|
||||
{
|
||||
auto parentParentPosition = parentParent->ClientToScreen(Float2::Zero);
|
||||
x -= Math::TruncToInt(parentParentPosition.X);
|
||||
y -= Math::TruncToInt(parentParentPosition.Y);
|
||||
//if (parentType != WindowType::Popup && parentType != WindowType::Tooltip)
|
||||
{
|
||||
auto parentParentType = parentParent->GetSettings().Type;
|
||||
//if (parentParentType != WindowType::Popup && parentParentType != WindowType::Tooltip)
|
||||
{
|
||||
auto parentParentPosition = parentParent->ClientToScreen(Float2::Zero);
|
||||
x -= Math::TruncToInt(parentParentPosition.X);
|
||||
y -= Math::TruncToInt(parentParentPosition.Y);
|
||||
}
|
||||
}
|
||||
/*else
|
||||
{
|
||||
// submenu of context menu
|
||||
x += 0;
|
||||
}*/
|
||||
}
|
||||
#else
|
||||
SetRelativeWindowPosition(_settings.Type, _settings.Parent, x, y);
|
||||
#endif
|
||||
}
|
||||
if (SDLPlatform::UsesX11() && _settings.Parent != Engine::MainWindow)
|
||||
{
|
||||
if (_settings.Parent->GetSettings().Type == WindowType::Tooltip || _settings.Parent->GetSettings().Type == WindowType::Popup)
|
||||
/*if (_settings.Parent->GetSettings().Type == WindowType::Tooltip || _settings.Parent->GetSettings().Type == WindowType::Popup)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
*//*auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
x -= (int)monitorBounds.GetLeft();
|
||||
y -= (int)monitorBounds.GetTop();*/
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
Int2 oldpos2(x, y);
|
||||
@@ -240,7 +288,7 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
_handle = GetNativeWindowPointer(_window);
|
||||
ASSERT(_handle != nullptr);
|
||||
|
||||
SDL_SyncWindow(_window);
|
||||
//SDL_SyncWindow(_window);
|
||||
|
||||
#if PLATFORM_LINUX
|
||||
if (SDLPlatform::UsesWayland())
|
||||
@@ -252,20 +300,30 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
#endif
|
||||
|
||||
SDL_DisplayID display = SDL_GetDisplayForWindow(_window);
|
||||
_dpiScale = SDL_GetDisplayContentScale(display);
|
||||
auto displayDpi = SDL_GetDisplayContentScale(display);
|
||||
_dpiScale = SDL_GetWindowDisplayScale(_window);
|
||||
_dpi = (int)(_dpiScale * DefaultDPI);
|
||||
|
||||
SDL_SetWindowMinimumSize(_window, (int)_settings.MinimumSize.X, (int)_settings.MinimumSize.Y);
|
||||
SDL_SetWindowMaximumSize(_window, (int)_settings.MaximumSize.X, (int)_settings.MaximumSize.Y);
|
||||
|
||||
SDL_Rect rect;
|
||||
/*if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
SDL_SyncWindow(_window);
|
||||
Int2 scaledSize = Int2(clientWidth * _dpiScale, clientHeight * _dpiScale);
|
||||
SDL_SetWindowSize(_window, scaledSize.X, scaledSize.Y);
|
||||
SDL_SyncWindow(_window);
|
||||
}*/
|
||||
SDL_SyncWindow(_window);
|
||||
SDL_Rect rect, rect2;
|
||||
SDL_GetWindowPosition(_window, &rect.x, &rect.y);
|
||||
SDL_GetWindowSizeInPixels(_window, &rect.w, &rect.h);
|
||||
SDL_GetWindowSize(_window, &rect2.w, &rect2.h);
|
||||
_cachedClientRectangle = Rectangle((float)rect.x, (float)rect.y, (float)rect.w, (float)rect.h);
|
||||
|
||||
Int2 newpos = GetClientPosition();
|
||||
//Int2 newposclient = GetClientPosition();
|
||||
LOG(Info, "new window at {}, input {}, expected: {}", newpos, oldpos, oldpos2);
|
||||
Int2 newposclient = GetSDLWindowPosition(this);
|
||||
LOG(Info, "new window at {}, input {}, expected: {}", newposclient, oldpos, oldpos2);
|
||||
//ASSERT(newpos == oldpos || newpos == oldpos2);
|
||||
|
||||
/*oldpos = newpos;
|
||||
@@ -543,7 +601,7 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
// X11 doesn't report any mouse events when mouse is over the caption area, send a simulated event instead...
|
||||
Float2 mousePosition;
|
||||
auto buttons = SDL_GetGlobalMouseState(&mousePosition.X, &mousePosition.Y);
|
||||
if ((buttons & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0)
|
||||
if ((buttons & SDL_BUTTON_MASK(SDL_BUTTON_LEFT)) != 0)
|
||||
SDLPlatform::CheckWindowDragging(this, WindowHitCodes::Caption);
|
||||
}
|
||||
#endif
|
||||
@@ -681,15 +739,15 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED:
|
||||
{
|
||||
SDL_DisplayID display = SDL_GetDisplayForWindow(_window);
|
||||
float scale = SDL_GetDisplayContentScale(display);
|
||||
if (scale > 0.0f)
|
||||
float scale = SDL_GetWindowDisplayScale(_window);
|
||||
if (scale > 0.0f && _dpiScale != scale)
|
||||
{
|
||||
float oldScale = _dpiScale;
|
||||
_dpiScale = scale;
|
||||
_dpi = (int)(_dpiScale * DefaultDPI);
|
||||
|
||||
int w = (int)(_cachedClientRectangle.GetWidth() * (scale / oldScale));
|
||||
int h = (int)(_cachedClientRectangle.GetHeight() * (scale / oldScale));
|
||||
_cachedClientRectangle.Size = Float2(w, h);
|
||||
SDL_SetWindowSize(_window, w, h);
|
||||
// TODO: Recalculate fonts
|
||||
}
|
||||
@@ -930,8 +988,28 @@ void SDLWindow::BringToFront(bool force)
|
||||
|
||||
void SDLWindow::SetClientBounds(const Rectangle& clientArea)
|
||||
{
|
||||
SDL_SetWindowPosition(_window, (int)clientArea.GetLeft(), (int)clientArea.GetTop());
|
||||
SDL_SetWindowSize(_window, (int)clientArea.GetWidth(), (int)clientArea.GetHeight());
|
||||
int oldX, oldY;
|
||||
int oldW, oldH;
|
||||
SDL_GetWindowPosition(_window, &oldX, &oldY);
|
||||
SDL_GetWindowSizeInPixels(_window, &oldW, &oldH);
|
||||
|
||||
int newX = (int)clientArea.GetLeft();
|
||||
int newY = (int)clientArea.GetTop();
|
||||
int newW = (int)clientArea.GetWidth();
|
||||
int newH = (int)clientArea.GetHeight();
|
||||
|
||||
//if (newX != oldX || newY != oldY)
|
||||
SetSDLWindowPosition(this, newX, newY);
|
||||
SDL_SetWindowSize(_window, newW, newH);
|
||||
|
||||
LOG(Info, "SetClientBounds changed from ({},{} {}x{}) to ({},{} {}x{})", oldX, oldY, oldW, oldH,
|
||||
(int)clientArea.GetLeft(), (int)clientArea.GetTop(), (int)clientArea.GetWidth(), (int)clientArea.GetHeight());
|
||||
|
||||
SDL_GetWindowPosition(_window, &oldX, &oldY);
|
||||
SDL_GetWindowSizeInPixels(_window, &oldW, &oldH);
|
||||
|
||||
LOG(Info, "- verify: actual ({},{} {}x{}) req ({},{} {}x{})", oldX, oldY, oldW, oldH,
|
||||
(int)clientArea.GetLeft(), (int)clientArea.GetTop(), (int)clientArea.GetWidth(), (int)clientArea.GetHeight());
|
||||
}
|
||||
|
||||
Int2 GetSDLWindowPosition(const SDLWindow* window)
|
||||
@@ -941,11 +1019,20 @@ Int2 GetSDLWindowPosition(const SDLWindow* window)
|
||||
#if PLATFORM_LINUX
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
#if X11_WINDOW_POSITION_WORKAROUND
|
||||
if (window->GetSettings().Type == WindowType::Tooltip || window->GetSettings().Type == WindowType::Popup)
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(window->GetSettings().Parent);
|
||||
auto parent = window->GetSettings().Parent;
|
||||
while (parent->GetSettings().Parent != nullptr)
|
||||
{
|
||||
Int2 rootParentPosition = GetSDLWindowPosition(parent);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
position += rootParentPosition;
|
||||
parent = parent->GetSettings().Parent;
|
||||
}
|
||||
Int2 rootParentPosition = GetSDLWindowPosition(parent);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
position += parentPosition;
|
||||
position += rootParentPosition;
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position += Int2(monitorBounds.GetTopLeft());
|
||||
//auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
@@ -956,11 +1043,82 @@ Int2 GetSDLWindowPosition(const SDLWindow* window)
|
||||
//auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position -= Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
// Wayland doesn't support reporting window position in screen-space
|
||||
/*auto parent = window->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
Int2 parentPosition;// = GetSDLWindowPosition(parent);
|
||||
SDL_GetWindowPosition(parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
position += parentPosition;
|
||||
parent = parent->GetSettings().Parent;
|
||||
}*/
|
||||
//Int2 rootParentPosition = GetSDLWindowPosition(parent);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
//position += rootParentPosition;
|
||||
}
|
||||
#endif
|
||||
return position;
|
||||
}
|
||||
|
||||
void SetSDLWindowPosition(SDLWindow* window, const int x, const int y)
|
||||
{
|
||||
#if PLATFORM_LINUX
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
#if X11_WINDOW_POSITION_WORKAROUND
|
||||
if (window->GetSettings().Type == WindowType::Tooltip || window->GetSettings().Type == WindowType::Popup)
|
||||
{
|
||||
Int2 position(x, y);
|
||||
auto parent = window->GetSettings().Parent;
|
||||
while (parent->GetSettings().Parent != nullptr)
|
||||
{
|
||||
Int2 rootParentPosition = GetSDLWindowPosition(parent);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
position -= rootParentPosition;
|
||||
parent = parent->GetSettings().Parent;
|
||||
}
|
||||
Int2 rootParentPosition = GetSDLWindowPosition(parent);
|
||||
//SDL_GetWindowPosition(window->GetSettings().Parent->GetSDLWindow(), &parentPosition.X, &parentPosition.Y);
|
||||
position -= rootParentPosition;
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position += Int2(monitorBounds.GetTopLeft());
|
||||
//auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position += Int2(monitorBounds.GetTopLeft());
|
||||
|
||||
SDL_SetWindowPosition(window->GetSDLWindow(), position.X, position.Y);
|
||||
|
||||
SDL_SyncWindow(window->GetSDLWindow());
|
||||
|
||||
Int2 newpos;
|
||||
Int2 newpos2 = GetSDLWindowPosition(window);
|
||||
SDL_GetWindowPosition(window->GetSDLWindow(), &newpos.X, &newpos.Y);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//position -= Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
int oldX, oldY;
|
||||
SDL_GetWindowPosition(window->GetSDLWindow(), &oldX, &oldY);
|
||||
if (x == oldX && y == oldY)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
SDL_SetWindowPosition(window->GetSDLWindow(), x, y);
|
||||
}
|
||||
|
||||
void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition, bool clienttoscreen)
|
||||
{
|
||||
// The relative positioning of windows are very inconsistent in different platforms.
|
||||
@@ -977,6 +1135,7 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
//clienttoscreen = false;
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
#if false
|
||||
// This is correct for ClientToScreen (mouse position transformation)
|
||||
if (clienttoscreen && window->GetSettings().Type != WindowType::Tooltip && window->GetSettings().Type != WindowType::Popup)
|
||||
return;
|
||||
@@ -999,10 +1158,11 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
Int2 parentPosition = GetSDLWindowPosition(parent);
|
||||
relativePosition += parentPosition;
|
||||
}*/
|
||||
#endif
|
||||
}
|
||||
else if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
SDLWindow* parent = window->GetSettings().Parent;
|
||||
/*SDLWindow* parent = window->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
if (parent->GetSettings().Parent == nullptr)
|
||||
@@ -1023,7 +1183,7 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
}
|
||||
else
|
||||
relativePosition = parentPosition;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -1058,7 +1218,7 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
}
|
||||
}
|
||||
|
||||
void SetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition)
|
||||
void SetRelativeWindowPosition(const WindowType windowType, SDLWindow* theParent, int32& xRel, int32& yRel)
|
||||
{
|
||||
// The relative positioning of windows are very inconsistent in different platforms.
|
||||
// On Windows and X11: The child position is relative to parent windows only for tooltip and popup windows.
|
||||
@@ -1073,16 +1233,17 @@ void SetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition)
|
||||
#if PLATFORM_LINUX
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
if (window->GetSettings().Type != WindowType::Tooltip && window->GetSettings().Type != WindowType::Popup)
|
||||
if (windowType != WindowType::Tooltip && windowType != WindowType::Popup)
|
||||
return;
|
||||
|
||||
SDLWindow* parent = window->GetSettings().Parent;
|
||||
SDLWindow* parent = theParent;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
if (parent->GetSettings().Type != WindowType::Tooltip && parent->GetSettings().Type != WindowType::Popup)
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(parent);
|
||||
relativePosition -= parentPosition;
|
||||
xRel -= parentPosition.X;
|
||||
yRel -= parentPosition.Y;
|
||||
break;
|
||||
}
|
||||
//if (parent->GetSettings().Parent == nullptr || (parent->GetSettings().Type != WindowType::Tooltip && parent->GetSettings().Type != WindowType::Popup))
|
||||
@@ -1092,27 +1253,53 @@ void SetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition)
|
||||
}
|
||||
else if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
SDLWindow* parent = window->GetSettings().Parent;
|
||||
while (parent != nullptr)
|
||||
SDLWindow* parent = theParent;
|
||||
/*while (parent != nullptr)
|
||||
{
|
||||
if (parent->GetSettings().Parent == nullptr)
|
||||
break;
|
||||
parent = parent->GetSettings().Parent;
|
||||
}
|
||||
}*/
|
||||
if (parent != nullptr)
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(parent);
|
||||
//Int2 parentPosition = GetSDLWindowPosition(parent);
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
relativePosition += parentPosition;
|
||||
/*relativePosition += parentPosition;
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
if (window->GetSettings().Type == WindowType::Tooltip || window->GetSettings().Type == WindowType::Popup)
|
||||
relativePosition += Int2(monitorBounds.GetTopLeft());
|
||||
relativePosition += Int2(monitorBounds.GetTopLeft());*/
|
||||
//relativePosition += Int2(monitorBounds.GetTopLeft());
|
||||
//relativePosition += Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
else
|
||||
relativePosition -= parentPosition;
|
||||
{
|
||||
//relativePosition -= parentPosition;
|
||||
auto parentPosition = parent->ClientToScreen(Float2::Zero);
|
||||
xRel -= Math::TruncToInt(parentPosition.X);
|
||||
yRel -= Math::TruncToInt(parentPosition.Y);
|
||||
|
||||
auto parentType = parent->GetSettings().Type;
|
||||
auto parentParent = parent->GetSettings().Parent;
|
||||
if (parentParent != nullptr)
|
||||
{
|
||||
//if (parentType != WindowType::Popup && parentType != WindowType::Tooltip)
|
||||
{
|
||||
auto parentParentType = parentParent->GetSettings().Type;
|
||||
//if (parentParentType != WindowType::Popup && parentParentType != WindowType::Tooltip)
|
||||
{
|
||||
auto parentParentPosition = parentParent->ClientToScreen(Float2::Zero);
|
||||
xRel -= Math::TruncToInt(parentParentPosition.X);
|
||||
yRel -= Math::TruncToInt(parentParentPosition.Y);
|
||||
}
|
||||
}
|
||||
/*else
|
||||
{
|
||||
// submenu of context menu
|
||||
x += 0;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1122,16 +1309,18 @@ void SetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition)
|
||||
SDLWindow* parent;
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
parent = (window->GetSettings().Type == WindowType::Tooltip || window->GetSettings().Type == WindowType::Popup) ? window->GetSettings().Parent : window->GetSettings().Parent;
|
||||
parent = (windowType == WindowType::Tooltip || windowType == WindowType::Popup) ? theParent : theParent;
|
||||
//auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//relativePosition -= Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
else
|
||||
parent = (window->GetSettings().Type == WindowType::Tooltip || window->GetSettings().Type == WindowType::Popup) ? window->GetSettings().Parent : nullptr;
|
||||
parent = (windowType == WindowType::Tooltip || windowType == WindowType::Popup) ? theParent : nullptr;
|
||||
while (parent != nullptr)
|
||||
{
|
||||
Int2 parentPosition = GetSDLWindowPosition(parent);
|
||||
relativePosition += (parent->GetSettings().Type == WindowType::Tooltip || parent->GetSettings().Type == WindowType::Popup) ? parentPosition : -parentPosition;
|
||||
Int2 rel = (parent->GetSettings().Type == WindowType::Tooltip || parent->GetSettings().Type == WindowType::Popup) ? parentPosition : -parentPosition;
|
||||
xRel += rel.X;
|
||||
yRel += rel.Y;
|
||||
auto monitorBounds = Platform::GetMonitorBounds(Float2::Minimum);
|
||||
//relativePosition += Int2(monitorBounds.GetTopLeft());
|
||||
//relativePosition += parentPosition;
|
||||
@@ -1151,7 +1340,7 @@ void SDLWindow::SetPosition(const Float2& position)
|
||||
// The position is relative to the parent window
|
||||
Int2 relativePosition(static_cast<int>(position.X), static_cast<int>(position.Y));
|
||||
relativePosition += topLeftBorder;
|
||||
SetRelativeWindowPosition(this, relativePosition);
|
||||
SetRelativeWindowPosition(GetSettings().Type, GetSettings().Parent, relativePosition.X, relativePosition.Y);
|
||||
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
@@ -1159,7 +1348,7 @@ void SDLWindow::SetPosition(const Float2& position)
|
||||
relativePosition += Int2(monitorBounds.GetTopLeft());
|
||||
}
|
||||
|
||||
SDL_SetWindowPosition(_window, relativePosition.X, relativePosition.Y);
|
||||
SetSDLWindowPosition(this, relativePosition.X, relativePosition.Y);
|
||||
SDL_SyncWindow(_window);
|
||||
|
||||
Int2 newPos;
|
||||
@@ -1174,7 +1363,7 @@ void SDLWindow::SetPosition(const Float2& position)
|
||||
|
||||
void SDLWindow::SetClientPosition(const Float2& position)
|
||||
{
|
||||
SDL_SetWindowPosition(_window, static_cast<int>(position.X), static_cast<int>(position.Y));
|
||||
SetSDLWindowPosition(this, static_cast<int>(position.X), static_cast<int>(position.Y));
|
||||
}
|
||||
|
||||
void SDLWindow::SetIsFullscreen(bool isFullscreen)
|
||||
|
||||
@@ -669,11 +669,13 @@ bool WindowsPlatform::Init()
|
||||
DWORD tmp;
|
||||
Char buffer[256];
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
// Get user locale string
|
||||
if (GetUserDefaultLocaleName(buffer, LOCALE_NAME_MAX_LENGTH))
|
||||
{
|
||||
UserLocale = String(buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get computer name string
|
||||
if (GetComputerNameW(buffer, &tmp))
|
||||
@@ -822,6 +824,7 @@ BatteryInfo WindowsPlatform::GetBatteryInfo()
|
||||
return info;
|
||||
}
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
int32 WindowsPlatform::GetDpi()
|
||||
{
|
||||
return SystemDpi;
|
||||
@@ -831,6 +834,7 @@ String WindowsPlatform::GetUserLocaleName()
|
||||
{
|
||||
return UserLocale;
|
||||
}
|
||||
#endif
|
||||
|
||||
String WindowsPlatform::GetComputerName()
|
||||
{
|
||||
@@ -1201,12 +1205,10 @@ int32 WindowsPlatform::CreateProcess(CreateProcessSettings& settings)
|
||||
}
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
|
||||
Window* WindowsPlatform::CreateWindow(const CreateWindowSettings& settings)
|
||||
{
|
||||
return New<WindowsWindow>(settings);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void* WindowsPlatform::LoadLibrary(const Char* filename)
|
||||
|
||||
@@ -63,8 +63,10 @@ public:
|
||||
#endif
|
||||
static void SetHighDpiAwarenessEnabled(bool enable);
|
||||
static BatteryInfo GetBatteryInfo();
|
||||
#if !PLATFORM_SDL
|
||||
static int32 GetDpi();
|
||||
static String GetUserLocaleName();
|
||||
#endif
|
||||
static String GetComputerName();
|
||||
static bool GetHasFocus();
|
||||
static bool CanOpenUrl(const StringView& url);
|
||||
@@ -78,7 +80,9 @@ public:
|
||||
static bool GetEnvironmentVariable(const String& name, String& value);
|
||||
static bool SetEnvironmentVariable(const String& name, const String& value);
|
||||
static int32 CreateProcess(CreateProcessSettings& settings);
|
||||
#if !PLATFORM_SDL
|
||||
static Window* CreateWindow(const CreateWindowSettings& settings);
|
||||
#endif
|
||||
static void* LoadLibrary(const Char* filename);
|
||||
#if CRASH_LOG_ENABLE
|
||||
static Array<StackFrame, HeapAllocation> GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
|
||||
|
||||
@@ -82,15 +82,13 @@ namespace FlaxEngine.GUI
|
||||
_showTarget = target;
|
||||
//WrapPosition(ref locationSS);
|
||||
WrapPosition(ref mousePos, 10);
|
||||
locationSS = mousePos + new Float2(15, 10);
|
||||
var ppp = Input.MouseScreenPosition;
|
||||
//locationSS = new Float2(5, 5);
|
||||
var bef = locationSS;
|
||||
locationSS = mousePos;
|
||||
|
||||
// Create window
|
||||
var desc = CreateWindowSettings.Default;
|
||||
desc.StartPosition = WindowStartPosition.Manual;
|
||||
desc.Position = locationSS;
|
||||
Editor.Log($"tooltip pos: {Input.MouseScreenPosition}, in parentloc: {location}");
|
||||
desc.Size = dpiSize;
|
||||
desc.Fullscreen = false;
|
||||
desc.HasBorder = false;
|
||||
@@ -103,8 +101,10 @@ namespace FlaxEngine.GUI
|
||||
desc.AllowDragAndDrop = false;
|
||||
desc.IsTopmost = true;
|
||||
desc.Type = WindowType.Tooltip;
|
||||
desc.Title = "Tooltip";
|
||||
desc.HasSizingFrame = false;
|
||||
desc.ShowAfterFirstPaint = true;
|
||||
desc.Parent = parentWin.RootWindow.Window;
|
||||
_window = Platform.CreateWindow(ref desc);
|
||||
if (_window == null)
|
||||
throw new InvalidOperationException("Failed to create tooltip window.");
|
||||
@@ -114,9 +114,6 @@ namespace FlaxEngine.GUI
|
||||
Visible = true;
|
||||
_window.Show();
|
||||
_showTarget.OnTooltipShown(this);
|
||||
|
||||
var aff = _window.Position;
|
||||
Editor.Log($"tooltip startpos: before: {bef}, after {aff}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,19 +226,13 @@ namespace FlaxEngine.GUI
|
||||
// Auto hide if mouse leaves control area
|
||||
Hide();
|
||||
}
|
||||
else
|
||||
else //if (false)
|
||||
{
|
||||
// Position tooltip when mouse moves
|
||||
var ppp = Input.MouseScreenPosition;
|
||||
var bef = _window.Position;
|
||||
WrapPosition(ref mousePos, 10);
|
||||
mousePos += new Float2(15, 10);
|
||||
//mousePos = new Float2(5, 5);
|
||||
|
||||
Editor.Log($"tooltip newpos: {Input.MouseScreenPosition}, in parentloc: {location}");
|
||||
if (_window)
|
||||
_window.Position = mousePos;
|
||||
var aff = _window.Position;
|
||||
Editor.Log($"tooltip updatepos: before: {bef}, new {mousePos}, after {aff}");
|
||||
}
|
||||
|
||||
base.Update(deltaTime);
|
||||
|
||||
BIN
Source/Platforms/Linux/Binaries/ThirdParty/x64/libSDL3.a
(Stored with Git LFS)
vendored
Normal file
BIN
Source/Platforms/Linux/Binaries/ThirdParty/x64/libSDL3.a
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
9
Source/ThirdParty/SDL/SDL3/SDL_audio.h
vendored
9
Source/ThirdParty/SDL/SDL3/SDL_audio.h
vendored
@@ -958,7 +958,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
|
||||
* \sa SDL_UnbindAudioStream
|
||||
* \sa SDL_GetAudioStreamDevice
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream * const *streams, int num_streams);
|
||||
|
||||
/**
|
||||
* Bind a single audio stream to an audio device.
|
||||
@@ -990,7 +990,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SD
|
||||
*
|
||||
* Unbinding a stream that isn't bound to a device is a legal no-op.
|
||||
*
|
||||
* \param streams an array of audio streams to unbind.
|
||||
* \param streams an array of audio streams to unbind. Can be NULL or contain
|
||||
* NULL.
|
||||
* \param num_streams number streams listed in the `streams` array.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
@@ -999,7 +1000,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SD
|
||||
*
|
||||
* \sa SDL_BindAudioStreams
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, int num_streams);
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream * const *streams, int num_streams);
|
||||
|
||||
/**
|
||||
* Unbind a single audio stream from its audio device.
|
||||
@@ -1007,7 +1008,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **stream
|
||||
* This is a convenience function, equivalent to calling
|
||||
* `SDL_UnbindAudioStreams(&stream, 1)`.
|
||||
*
|
||||
* \param stream an audio stream to unbind from a device.
|
||||
* \param stream an audio stream to unbind from a device. Can be NULL.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
|
||||
4
Source/ThirdParty/SDL/SDL3/SDL_dialog.h
vendored
4
Source/ThirdParty/SDL/SDL3/SDL_dialog.h
vendored
@@ -94,6 +94,10 @@ typedef struct SDL_DialogFileFilter
|
||||
* no filter was selected or if the platform or method doesn't support
|
||||
* fetching the selected filter.
|
||||
*
|
||||
* In Android, the `filelist` are `content://` URIs. They should be opened
|
||||
* using SDL_IOFromFile() with appropriate modes. This applies both to open
|
||||
* and save file dialog.
|
||||
*
|
||||
* \param userdata an app-provided pointer, for the callback's use.
|
||||
* \param filelist the file(s) chosen by the user.
|
||||
* \param filter index of the selected filter.
|
||||
|
||||
6
Source/ThirdParty/SDL/SDL3/SDL_gpu.h
vendored
6
Source/ThirdParty/SDL/SDL3/SDL_gpu.h
vendored
@@ -1518,6 +1518,8 @@ typedef struct SDL_GPUVertexAttribute
|
||||
* \since This struct is available since SDL 3.1.3
|
||||
*
|
||||
* \sa SDL_GPUGraphicsPipelineCreateInfo
|
||||
* \sa SDL_GPUVertexBufferDescription
|
||||
* \sa SDL_GPUVertexAttribute
|
||||
*/
|
||||
typedef struct SDL_GPUVertexInputState
|
||||
{
|
||||
@@ -1597,6 +1599,10 @@ typedef struct SDL_GPUShaderCreateInfo
|
||||
* \since This struct is available since SDL 3.1.3
|
||||
*
|
||||
* \sa SDL_CreateGPUTexture
|
||||
* \sa SDL_GPUTextureType
|
||||
* \sa SDL_GPUTextureFormat
|
||||
* \sa SDL_GPUTextureUsageFlags
|
||||
* \sa SDL_GPUSampleCount
|
||||
*/
|
||||
typedef struct SDL_GPUTextureCreateInfo
|
||||
{
|
||||
|
||||
4
Source/ThirdParty/SDL/SDL3/SDL_hints.h
vendored
4
Source/ThirdParty/SDL/SDL3/SDL_hints.h
vendored
@@ -2775,6 +2775,10 @@ extern "C" {
|
||||
* - "1": SDL will send a quit event when the last window is requesting to
|
||||
* close. (default)
|
||||
*
|
||||
* If there is at least one active system tray icon, SDL_EVENT_QUIT will
|
||||
* instead be sent when both the last window will be closed and the last tray
|
||||
* icon will be destroyed.
|
||||
*
|
||||
* This hint can be set anytime.
|
||||
*
|
||||
* \since This hint is available since SDL 3.1.3.
|
||||
|
||||
20
Source/ThirdParty/SDL/SDL3/SDL_revision.h
vendored
20
Source/ThirdParty/SDL/SDL3/SDL_revision.h
vendored
@@ -11,19 +11,19 @@
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_revision.h
|
||||
*
|
||||
* Header file containing the SDL revision.
|
||||
*/
|
||||
* \file SDL_revision.h
|
||||
*
|
||||
* Header file containing the SDL revision.
|
||||
*/
|
||||
|
||||
#ifndef SDL_revision_h_
|
||||
#define SDL_revision_h_
|
||||
@@ -31,9 +31,9 @@
|
||||
/* #undef SDL_VENDOR_INFO */
|
||||
|
||||
#ifdef SDL_VENDOR_INFO
|
||||
#define SDL_REVISION "SDL-40f9fd8 (" SDL_VENDOR_INFO ")"
|
||||
#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-509-g8cc4735d74 (" SDL_VENDOR_INFO ")"
|
||||
#else
|
||||
#define SDL_REVISION "SDL-40f9fd8"
|
||||
#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-509-g8cc4735d74"
|
||||
#endif
|
||||
|
||||
#endif /* SDL_revision_h_ */
|
||||
|
||||
5
Source/ThirdParty/SDL/SDL3/SDL_stdinc.h
vendored
5
Source/ThirdParty/SDL/SDL3/SDL_stdinc.h
vendored
@@ -45,6 +45,11 @@
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#if defined(__has_include) && !defined(SDL_INCLUDE_STDBOOL_H)
|
||||
#if __has_include(<stdbool.h>)
|
||||
#define SDL_INCLUDE_STDBOOL_H
|
||||
#endif
|
||||
#endif
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||
(defined(_MSC_VER) && (_MSC_VER >= 1910 /* Visual Studio 2017 */)) || \
|
||||
defined(SDL_INCLUDE_STDBOOL_H)
|
||||
|
||||
14
Source/ThirdParty/SDL/SDL3/SDL_tray.h
vendored
14
Source/ThirdParty/SDL/SDL3/SDL_tray.h
vendored
@@ -102,8 +102,8 @@ typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry);
|
||||
* Using tray icons require the video subsystem.
|
||||
*
|
||||
* \param icon a surface to be used as icon. May be NULL.
|
||||
* \param tooltip a tooltip to be displayed when the mouse hovers the icon.
|
||||
* Not supported on all platforms. May be NULL.
|
||||
* \param tooltip a tooltip to be displayed when the mouse hovers the icon in
|
||||
* UTF-8 encoding. Not supported on all platforms. May be NULL.
|
||||
* \returns The newly created system tray icon.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
@@ -130,7 +130,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *ic
|
||||
* Updates the system tray icon's tooltip.
|
||||
*
|
||||
* \param tray the tray icon to be updated.
|
||||
* \param tooltip the new tooltip. May be NULL.
|
||||
* \param tooltip the new tooltip in UTF-8 encoding. May be NULL.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
@@ -262,8 +262,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry);
|
||||
* \param menu the menu to append the entry to.
|
||||
* \param pos the desired position for the new entry. Entries at or following
|
||||
* this place will be moved. If pos is -1, the entry is appended.
|
||||
* \param label the text to be displayed on the entry, or NULL for a
|
||||
* separator.
|
||||
* \param label the text to be displayed on the entry, in UTF-8 encoding, or
|
||||
* NULL for a separator.
|
||||
* \param flags a combination of flags, some of which are mandatory.
|
||||
* \returns the newly created entry, or NULL if pos is out of bounds.
|
||||
*
|
||||
@@ -285,7 +285,7 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *m
|
||||
* label. The function will silently fail if that happens.
|
||||
*
|
||||
* \param entry the entry to be updated.
|
||||
* \param label the new label for the entry.
|
||||
* \param label the new label for the entry in UTF-8 encoding.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
@@ -301,7 +301,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, con
|
||||
* If the returned value is NULL, the entry is a separator.
|
||||
*
|
||||
* \param entry the entry to be read.
|
||||
* \returns the label of the entry.
|
||||
* \returns the label of the entry in UTF-8 encoding.
|
||||
*
|
||||
* \since This function is available since SDL 3.2.0.
|
||||
*
|
||||
|
||||
@@ -88,8 +88,8 @@ namespace Flax.Deps.Dependencies
|
||||
Path.Combine(root, "include", "SDL3"),
|
||||
};
|
||||
|
||||
CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL.git", new DateTime(2024, 12, 26));
|
||||
GitResetToCommit(root, "578509c326f6bcc25fba7b71ebb439a165808bc5");
|
||||
CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL.git", new DateTime(2024, 12, 29));
|
||||
GitResetToCommit(root, "8cc4735d74a1ce89c5fceb48b021872c8c563174");
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
@@ -134,8 +134,9 @@ namespace Flax.Deps.Dependencies
|
||||
directoriesToCopy.Add(Path.Combine(buildDir, "include", "SDL3"));
|
||||
|
||||
int concurrency = Math.Min(Math.Max(1, (int)(Environment.ProcessorCount * Configuration.ConcurrencyProcessorScale)), Configuration.MaxConcurrency);
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DCMAKE_BUILD_TYPE=DEBUG -DSDL_SHARED={(!buildStatic ? "ON" : "OFF")} -DSDL_STATIC={(buildStatic ? "ON" : "OFF")} -DCMAKE_POSITION_INDEPENDENT_CODE=ON " + string.Join(" ", configs));
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=\"{buildDir}\" -DSDL_SHARED={(!buildStatic ? "ON" : "OFF")} -DSDL_STATIC={(buildStatic ? "ON" : "OFF")} -DCMAKE_POSITION_INDEPENDENT_CODE=ON " + string.Join(" ", configs));
|
||||
BuildCmake(buildDir, configuration, new Dictionary<string, string>() { {"CMAKE_BUILD_PARALLEL_LEVEL", concurrency.ToString()} });
|
||||
Utilities.Run("cmake", $"--build . --target install --config {configuration}", null, buildDir, Utilities.RunOptions.DefaultTool);
|
||||
|
||||
// Copy binaries
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
|
||||
Reference in New Issue
Block a user