Skip to content

Commit 5fe05bb

Browse files
mayatskiyArugin
authored andcommitted
Added respective methods to IView and GLFW and SDL windows
1 parent 40a6e1f commit 5fe05bb

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/Windowing/Silk.NET.Windowing.Common/Interfaces/IView.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ public interface IView : IViewProperties, IGLContextSource, IVkSurfaceSource, ID
103103
/// </summary>
104104
void Reset();
105105

106+
/// <summary>
107+
/// Sets focus to current window.
108+
/// </summary>
109+
void SetFocus();
110+
106111
/// <summary>
107112
/// Close this window.
108113
/// </summary>

src/Windowing/Silk.NET.Windowing.Common/Internals/ViewImplementationBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ protected ViewImplementationBase(ViewOptions opts)
7171
public abstract void ContinueEvents();
7272
public abstract Vector2D<int> PointToClient(Vector2D<int> point);
7373
public abstract Vector2D<int> PointToScreen(Vector2D<int> point);
74+
public abstract void SetFocus();
7475
public abstract void Close();
7576
protected abstract void RegisterCallbacks();
7677
protected abstract void UnregisterCallbacks();

src/Windowing/Silk.NET.Windowing.Glfw/GlfwWindow.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,11 @@ public bool TryGetProcAddress(string proc, out nint addr, int? slot = default)
631631
return ret;
632632
}
633633

634+
public override void SetFocus()
635+
{
636+
_glfw.FocusWindow(_glfwWindow);
637+
}
638+
634639
public override void Close()
635640
{
636641
Closing?.Invoke();

src/Windowing/Silk.NET.Windowing.Sdl/SdlView.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ internal void RemoveEvent(int index)
283283
Reset();
284284
}
285285

286+
public override void SetFocus()
287+
{
288+
Sdl.RaiseWindow(SdlWindow);
289+
}
290+
286291
public override void Close()
287292
{
288293
Closing?.Invoke();

0 commit comments

Comments
 (0)