Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public interface IView : IViewProperties, IGLContextSource, IVkSurfaceSource, ID
/// </summary>
void Reset();

/// <summary>
/// Sets focus to current window.
/// </summary>
void Focus();

/// <summary>
/// Close this window.
/// </summary>
Expand Down Expand Up @@ -146,4 +151,4 @@ public interface IView : IViewProperties, IGLContextSource, IVkSurfaceSource, ID
/// <param name="onFrame">The callback to run each frame.</param>
void Run(Action onFrame);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ protected ViewImplementationBase(ViewOptions opts)
public abstract void ContinueEvents();
public abstract Vector2D<int> PointToClient(Vector2D<int> point);
public abstract Vector2D<int> PointToScreen(Vector2D<int> point);
public abstract void Focus();
public abstract void Close();
protected abstract void RegisterCallbacks();
protected abstract void UnregisterCallbacks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Silk.NET.Windowing.IView.Render -> System.Action<double>?
Silk.NET.Windowing.IView.Reset() -> void
Silk.NET.Windowing.IView.Resize -> System.Action<Silk.NET.Maths.Vector2D<int>>?
Silk.NET.Windowing.IView.Run(System.Action! onFrame) -> void
Silk.NET.Windowing.IView.Focus() -> void
Silk.NET.Windowing.IView.Time.get -> double
Silk.NET.Windowing.IView.Update -> System.Action<double>?
Silk.NET.Windowing.IViewProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Silk.NET.Windowing.IView.Render -> System.Action<double>?
Silk.NET.Windowing.IView.Reset() -> void
Silk.NET.Windowing.IView.Resize -> System.Action<Silk.NET.Maths.Vector2D<int>>?
Silk.NET.Windowing.IView.Run(System.Action! onFrame) -> void
Silk.NET.Windowing.IView.Focus() -> void
Silk.NET.Windowing.IView.Time.get -> double
Silk.NET.Windowing.IView.Update -> System.Action<double>?
Silk.NET.Windowing.IViewProperties
Expand Down
5 changes: 5 additions & 0 deletions src/Windowing/Silk.NET.Windowing.Glfw/GlfwWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,11 @@ public bool TryGetProcAddress(string proc, out nint addr, int? slot = default)
return ret;
}

public override void Focus()
{
_glfw.FocusWindow(_glfwWindow);
}

public override void Close()
{
Closing?.Invoke();
Expand Down
5 changes: 5 additions & 0 deletions src/Windowing/Silk.NET.Windowing.Sdl/SdlView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ internal void RemoveEvent(int index)
Reset();
}

public override void Focus()
{
Sdl.RaiseWindow(SdlWindow);
}

public override void Close()
{
Closing?.Invoke();
Expand Down