diff --git a/DMCompiler/DM/DMValueType.cs b/DMCompiler/DM/DMValueType.cs
index cc3237e87b..e522c70911 100644
--- a/DMCompiler/DM/DMValueType.cs
+++ b/DMCompiler/DM/DMValueType.cs
@@ -3,10 +3,6 @@
namespace DMCompiler.DM;
-// If you are modifying this, you must also modify OpenDreamShared.Dream.DreamValueType !!
-// Unfortunately the client needs this and it can't reference DMCompiler due to the sandbox
-
-
///
/// Allows for more complex things than DMValueType does, such as supporting type paths
///
diff --git a/OpenDreamClient/Interface/Controls/ControlWindow.cs b/OpenDreamClient/Interface/Controls/ControlWindow.cs
index ea29a7358d..e76c4907c7 100644
--- a/OpenDreamClient/Interface/Controls/ControlWindow.cs
+++ b/OpenDreamClient/Interface/Controls/ControlWindow.cs
@@ -33,6 +33,10 @@ public ControlWindow(WindowDescriptor windowDescriptor) : base(windowDescriptor,
IoCManager.InjectDependencies(this);
}
+ public IClydeWindow? GetClydeWindow() {
+ return _myWindow.osWindow is null ? _myWindow.clydeWindow : _myWindow.osWindow.ClydeWindow;
+ }
+
protected override void UpdateElementDescriptor() {
// Don't call base.UpdateElementDescriptor();
diff --git a/OpenDreamClient/Interface/DebugWindows/MacrosWindow.cs b/OpenDreamClient/Interface/DebugWindows/MacrosWindow.cs
index c320f978b6..51afec74f9 100644
--- a/OpenDreamClient/Interface/DebugWindows/MacrosWindow.cs
+++ b/OpenDreamClient/Interface/DebugWindows/MacrosWindow.cs
@@ -43,8 +43,8 @@ private GridContainer CreateMacroTable(InterfaceMacroSet macroSet) {
foreach (var macro in macroSet.Macros.Values) {
var idText = macro.Id;
- if (macro.ElementDescriptor.Name.Value != idText.Value)
- idText.Value += $" ({macro.ElementDescriptor.Name.AsRaw()})";
+ if (macro.ElementDescriptor.Id.Value != idText.Value)
+ idText.Value += $" ({macro.ElementDescriptor.Id.AsRaw()})";
var idLabel = new Label { Text = idText.AsRaw() };
var commandLabel = new Label { Text = macro.Command };
diff --git a/OpenDreamClient/Interface/DreamInterfaceManager.cs b/OpenDreamClient/Interface/DreamInterfaceManager.cs
index ae8afe1f38..a23820b775 100644
--- a/OpenDreamClient/Interface/DreamInterfaceManager.cs
+++ b/OpenDreamClient/Interface/DreamInterfaceManager.cs
@@ -22,6 +22,7 @@
using SixLabors.ImageSharp;
using System.Linq;
using OpenDreamShared.Common.DM;
+using Robust.Shared.Map;
namespace OpenDreamClient.Interface;
@@ -56,6 +57,7 @@ internal sealed class DreamInterfaceManager : IDreamInterfaceManager {
public Dictionary Windows { get; } = new();
public Dictionary Menus { get; } = new();
public Dictionary MacroSets { get; } = new();
+ private Dictionary ClydeWindowIdToControl { get; } = new();
public ViewRange View {
get => _view;
@@ -125,6 +127,7 @@ public void Initialize() {
_netManager.RegisterNetMessage(RxLoadInterface);
_netManager.RegisterNetMessage();
_netManager.RegisterNetMessage(RxUpdateClientInfo);
+ _clyde.OnWindowFocused += OnWindowFocused;
}
private void RxUpdateStatPanels(MsgUpdateStatPanels message) {
@@ -915,6 +918,24 @@ private void LoadInterface(InterfaceDescriptor descriptor) {
LayoutContainer.SetAnchorBottom(DefaultWindow.UIElement, 1);
_uiManager.StateRoot.AddChild(DefaultWindow.UIElement);
+
+ if (DefaultWindow.GetClydeWindow() is { } clydeWindow) {
+ ClydeWindowIdToControl.Add(clydeWindow.Id, DefaultWindow);
+ }
+ }
+
+ private void OnWindowFocused(WindowFocusedEventArgs args) {
+ if(ClydeWindowIdToControl.TryGetValue(args.Window.Id, out var controlWindow)){
+ _sawmill.Debug($"window id {controlWindow.Id} was {(args.Focused ? "focused" : "defocused")}");
+ WindowDescriptor descriptor = (WindowDescriptor) controlWindow.ElementDescriptor;
+ descriptor.Focus = new DMFPropertyBool(args.Focused);
+ if(args.Focused && MacroSets.TryGetValue(descriptor.Macro.AsRaw(), out var windowMacroSet)){
+ _sawmill.Debug($"Activating macroset {descriptor.Macro}");
+ windowMacroSet.SetActive();
+ }
+ }
+ else
+ _sawmill.Debug($"window id was not found (probably a modal) but was {(args.Focused ? "focused" : "defocused")}");
}
private void LoadDescriptor(ElementDescriptor descriptor) {
@@ -937,6 +958,10 @@ private void LoadDescriptor(ElementDescriptor descriptor) {
DefaultWindow = window;
}
+ if (window.GetClydeWindow() is { } clydeWindow) {
+ ClydeWindowIdToControl.Add(clydeWindow.Id, window);
+ }
+
break;
}
}
diff --git a/OpenDreamClient/Interface/InterfaceMacro.cs b/OpenDreamClient/Interface/InterfaceMacro.cs
index be94c0a168..76accd076a 100644
--- a/OpenDreamClient/Interface/InterfaceMacro.cs
+++ b/OpenDreamClient/Interface/InterfaceMacro.cs
@@ -25,7 +25,7 @@ public InterfaceMacroSet(MacroSetDescriptor descriptor, IEntitySystemManager ent
_entitySystemManager = entitySystemManager;
_uiManager = uiManager;
- _inputContextName = $"{InputContextPrefix}{ElementDescriptor.Name}";
+ _inputContextName = $"{InputContextPrefix}{ElementDescriptor.Id}";
if (inputManager.Contexts.TryGetContext(_inputContextName, out var existingContext)) {
_inputContext = existingContext;
} else {
@@ -45,7 +45,7 @@ public override void AddChild(ElementDescriptor descriptor) {
}
public void SetActive() {
- _inputManager.Contexts.SetActiveContext($"{InputContextPrefix}{ElementDescriptor.Name}");
+ _inputManager.Contexts.SetActiveContext($"{InputContextPrefix}{ElementDescriptor.Id}");
}
}
diff --git a/OpenDreamShared/Dream/MutableAppearance.cs b/OpenDreamShared/Dream/MutableAppearance.cs
index 76c853cb03..8d011e761c 100644
--- a/OpenDreamShared/Dream/MutableAppearance.cs
+++ b/OpenDreamShared/Dream/MutableAppearance.cs
@@ -308,6 +308,8 @@ public void SetColor(string color) {
if (!ColorHelpers.TryParseColor(color, out Color)) {
Color = Color.White;
}
+
+ Alpha = (byte)(Color.A * 255);
}
///