Skip to content

Commit db31fe5

Browse files
mayatskiyArugin
authored andcommitted
Added respective methods to IView and GLFW and SDL windows
1 parent 2f07bf5 commit db31fe5

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
@@ -677,6 +677,11 @@ public bool TryGetProcAddress(string proc, out nint addr, int? slot = default)
677677
return ret;
678678
}
679679

680+
public override void SetFocus()
681+
{
682+
_glfw.FocusWindow(_glfwWindow);
683+
}
684+
680685
public override void Close()
681686
{
682687
Closing?.Invoke();

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,11 @@ internal void RemoveEvent(int index)
313313
Reset();
314314
}
315315

316+
public override void SetFocus()
317+
{
318+
Sdl.RaiseWindow(SdlWindow);
319+
}
320+
316321
public override void Close()
317322
{
318323
Closing?.Invoke();

0 commit comments

Comments
 (0)