diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index c6a5fa90c..6721c2f40 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -64,6 +64,7 @@ END TEMPLATE-->
### New features
* Add a BoundUserInterfaceMessageReceivedEvent that will be raised whenever a BoundUserInterfaceMessage is received regardless of validation.
+* Added WindowGetMonitor API for getting the current IClydeMonitor.
### Bugfixes
diff --git a/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs b/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
index 62cb3cdb4..8c190263b 100644
--- a/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
+++ b/Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
@@ -290,6 +290,14 @@ public void SetWindowMonitor(IClydeMonitor monitor)
_windowing!.WindowSetMonitor(_mainWindow!, monitor);
}
+ public IClydeMonitor? GetWindowMonitor()
+ {
+ DebugTools.AssertNotNull(_windowing);
+ DebugTools.AssertNotNull(_mainWindow);
+
+ return _windowing!.WindowGetMonitor(_mainWindow!);
+ }
+
public void RequestWindowAttention()
{
DebugTools.AssertNotNull(_windowing);
diff --git a/Robust.Client/Graphics/Clyde/ClydeHeadless.cs b/Robust.Client/Graphics/Clyde/ClydeHeadless.cs
index 093527e6b..32e9c4eca 100644
--- a/Robust.Client/Graphics/Clyde/ClydeHeadless.cs
+++ b/Robust.Client/Graphics/Clyde/ClydeHeadless.cs
@@ -116,6 +116,11 @@ public void SetWindowMonitor(IClydeMonitor monitor)
// Nada.
}
+ public IClydeMonitor? GetWindowMonitor()
+ {
+ return null;
+ }
+
public void RequestWindowAttention()
{
// Nada.
diff --git a/Robust.Client/Graphics/Clyde/Windowing/IWindowingImpl.cs b/Robust.Client/Graphics/Clyde/Windowing/IWindowingImpl.cs
index 34b5eae6d..ad1b38abd 100644
--- a/Robust.Client/Graphics/Clyde/Windowing/IWindowingImpl.cs
+++ b/Robust.Client/Graphics/Clyde/Windowing/IWindowingImpl.cs
@@ -39,6 +39,7 @@ private interface IWindowingImpl
void WindowDestroy(WindowReg reg);
void WindowSetTitle(WindowReg window, string title);
void WindowSetMonitor(WindowReg window, IClydeMonitor monitor);
+ IClydeMonitor? WindowGetMonitor(WindowReg window);
void WindowSetSize(WindowReg window, Vector2i size);
void WindowSetVisible(WindowReg window, bool visible);
void WindowRequestAttention(WindowReg window);
diff --git a/Robust.Client/Graphics/Clyde/Windowing/Sdl3.Window.cs b/Robust.Client/Graphics/Clyde/Windowing/Sdl3.Window.cs
index dd1220321..5fb51414a 100644
--- a/Robust.Client/Graphics/Clyde/Windowing/Sdl3.Window.cs
+++ b/Robust.Client/Graphics/Clyde/Windowing/Sdl3.Window.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
@@ -426,6 +427,13 @@ public void WindowSetMonitor(WindowReg window, IClydeMonitor monitor)
_sawmill.Warning("WindowSetMonitor not implemented on SDL3");
}
+ public IClydeMonitor? WindowGetMonitor(WindowReg window)
+ {
+ var displayId = SDL.SDL_GetDisplayForWindow(WinPtr(window));
+ var monitorId = GetMonitorIdFromDisplayId(displayId);
+ return _clyde._monitorHandles.GetValueOrDefault(monitorId);
+ }
+
public void WindowSetSize(WindowReg window, Vector2i size)
{
SendCmd(new CmdWinSetSize { Window = WinPtr(window), W = size.X, H = size.Y });
diff --git a/Robust.Client/Graphics/IClyde.cs b/Robust.Client/Graphics/IClyde.cs
index 66bdfef42..2f920cd93 100644
--- a/Robust.Client/Graphics/IClyde.cs
+++ b/Robust.Client/Graphics/IClyde.cs
@@ -37,6 +37,11 @@ public interface IClyde
void SetWindowTitle(string title);
void SetWindowMonitor(IClydeMonitor monitor);
+ ///
+ /// Gets the monitor the main game window is currently on.
+ ///
+ IClydeMonitor? GetWindowMonitor();
+
///
/// This is the magic method to make the game window ping you in the task bar.
///