mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 00:56:19 +02:00
Handle window close commands and interaction logic improvements
This commit is contained in:
@@ -222,10 +222,14 @@ public sealed class Window(string title, int processId, int id, IRenderSource re
|
|||||||
dragOffset = new Point(pointerPosition.X - Position.X, pointerPosition.Y - Position.Y);
|
dragOffset = new Point(pointerPosition.X - Position.X, pointerPosition.Y - Position.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentInteraction != InteractionMode.None || inBounds)
|
||||||
|
{
|
||||||
if (currentInteraction != InteractionMode.None)
|
if (currentInteraction != InteractionMode.None)
|
||||||
{
|
{
|
||||||
interactionStartBounds = new Rectangle(Position, Size);
|
interactionStartBounds = new Rectangle(Position, Size);
|
||||||
interactionStartPointer = pointerPosition;
|
interactionStartPointer = pointerPosition;
|
||||||
|
}
|
||||||
|
|
||||||
WindowManager.FocusWindow(this);
|
WindowManager.FocusWindow(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,12 +123,27 @@ public static class WindowManager
|
|||||||
|
|
||||||
public static void CloseWindowsForProcess(int processId)
|
public static void CloseWindowsForProcess(int processId)
|
||||||
{
|
{
|
||||||
|
List<Window> windowsToClose = new();
|
||||||
lock (windowsLock)
|
lock (windowsLock)
|
||||||
{
|
{
|
||||||
|
if (windows.TryGetValue(processId, out var processWindows))
|
||||||
|
{
|
||||||
|
windowsToClose.AddRange(processWindows);
|
||||||
windows.Remove(processId);
|
windows.Remove(processId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (windowsToClose.Count > 0)
|
||||||
|
{
|
||||||
|
List<RenderCommand> closeCommands = new();
|
||||||
|
foreach (var window in windowsToClose)
|
||||||
|
{
|
||||||
|
closeCommands.Add(new RenderCommand { WindowId = window.Id, ElementId = window.Id, ElementType = "WindowClose", Position = window.Position, Properties = new Dictionary<string, object?>() });
|
||||||
|
}
|
||||||
|
renderSource.Render(closeCommands);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void FocusWindow(Window? window)
|
public static void FocusWindow(Window? window)
|
||||||
{
|
{
|
||||||
if (focusedWindow == window)
|
if (focusedWindow == window)
|
||||||
|
|||||||
Reference in New Issue
Block a user