Make IWindow implementations internal

Actually public members that were only in `SDL2Window` are now properly exposed in `IWindow`.
This commit is contained in:
Susko3
2023-07-01 19:00:20 +02:00
parent 19cbb8f4a6
commit 269dc246a1
13 changed files with 32 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ using osuTK.Graphics;
namespace osu.Framework.Android
{
public class AndroidGameWindow : OsuTKWindow
internal class AndroidGameWindow : OsuTKWindow
{
private readonly AndroidGameView view;

View File

@@ -12,7 +12,7 @@ using UIKit;
namespace osu.Framework.iOS
{
public class IOSWindow : SDL2Window
internal class IOSWindow : SDL2Window
{
private UIWindow? window;

View File

@@ -6,7 +6,7 @@ using osu.Framework.Platform;
namespace osu.Framework.Input
{
public class SDL2WindowTextInput : TextInputSource
internal class SDL2WindowTextInput : TextInputSource
{
private readonly SDL2Window window;

View File

@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
@@ -71,6 +72,11 @@ namespace osu.Framework.Platform
/// </summary>
event Action? KeymapChanged;
/// <summary>
/// Invoked when the user drops a file into the window.
/// </summary>
public event Action<string>? DragDrop;
/// <summary>
/// Whether the OS cursor is currently contained within the game window.
/// </summary>
@@ -175,6 +181,11 @@ namespace osu.Framework.Platform
/// </summary>
bool Focused { get; }
/// <summary>
/// Sets the window icon to the provided <paramref name="imageStream"/>.
/// </summary>
public void SetIconFromStream(Stream imageStream);
/// <summary>
/// Convert a screen based coordinate to local window space.
/// </summary>

View File

@@ -12,7 +12,7 @@ namespace osu.Framework.Platform.MacOS
/// <summary>
/// macOS-specific subclass of <see cref="SDL2Window"/>.
/// </summary>
public class MacOSWindow : SDL2DesktopWindow
internal class MacOSWindow : SDL2DesktopWindow
{
private static readonly IntPtr sel_hasprecisescrollingdeltas = Selector.Get("hasPreciseScrollingDeltas");
private static readonly IntPtr sel_scrollingdeltax = Selector.Get("scrollingDeltaX");

View File

@@ -11,7 +11,7 @@ using osuTK.Graphics.ES30;
namespace osu.Framework.Platform
{
public class OsuTKGraphicsSurface : IGraphicsSurface, IOpenGLGraphicsSurface
internal class OsuTKGraphicsSurface : IGraphicsSurface, IOpenGLGraphicsSurface
{
private readonly OsuTKWindow window;

View File

@@ -13,6 +13,7 @@ using osuTK.Platform;
using osuTK.Input;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
@@ -22,7 +23,7 @@ using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
namespace osu.Framework.Platform
{
public abstract class OsuTKWindow : IWindow, IGameWindow
internal abstract class OsuTKWindow : IWindow, IGameWindow
{
private readonly IGraphicsSurface graphicsSurface;
IGraphicsSurface IWindow.GraphicsSurface => graphicsSurface;
@@ -61,6 +62,9 @@ namespace osu.Framework.Platform
/// <inheritdoc cref="IWindow.KeymapChanged"/>
public event Action KeymapChanged { add { } remove { } }
/// <inheritdoc cref="IWindow.DragDrop"/>
public event Action<string> DragDrop { add { } remove { } }
/// <summary>
/// Invoked when any key has been pressed.
/// </summary>
@@ -410,6 +414,9 @@ namespace osu.Framework.Platform
public void Close() => OsuTKGameWindow.Close();
public void ProcessEvents() => OsuTKGameWindow.ProcessEvents();
public void SetIconFromStream(Stream imageStream) => throw new InvalidOperationException($@"{nameof(SetIconFromStream)} is not supported.");
public Point PointToClient(Point point) => OsuTKGameWindow.PointToClient(point);
public Point PointToScreen(Point point) => OsuTKGameWindow.PointToScreen(point);

View File

@@ -13,7 +13,7 @@ using SDL2;
namespace osu.Framework.Platform.SDL2
{
public class SDL2GraphicsSurface : IGraphicsSurface, IOpenGLGraphicsSurface, IMetalGraphicsSurface, ILinuxGraphicsSurface
internal class SDL2GraphicsSurface : IGraphicsSurface, IOpenGLGraphicsSurface, IMetalGraphicsSurface, ILinuxGraphicsSurface
{
private readonly SDL2Window window;

View File

@@ -5,7 +5,7 @@ using SDL2;
namespace osu.Framework.Platform
{
public class SDL2DesktopWindow : SDL2Window
internal class SDL2DesktopWindow : SDL2Window
{
public SDL2DesktopWindow(GraphicsSurfaceType surfaceType)
: base(surfaceType)

View File

@@ -24,7 +24,7 @@ namespace osu.Framework.Platform
/// <summary>
/// Default implementation of a window, using SDL for windowing and graphics support.
/// </summary>
public abstract partial class SDL2Window : IWindow
internal abstract partial class SDL2Window : IWindow
{
internal IntPtr SDLWindowHandle { get; private set; } = IntPtr.Zero;
@@ -542,11 +542,11 @@ namespace osu.Framework.Platform
#endregion
public void SetIconFromStream(Stream stream)
public void SetIconFromStream(Stream imageStream)
{
using (var ms = new MemoryStream())
{
stream.CopyTo(ms);
imageStream.CopyTo(ms);
ms.Position = 0;
var imageInfo = Image.Identify(ms);

View File

@@ -20,7 +20,7 @@ using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
namespace osu.Framework.Platform
{
public partial class SDL2Window
internal partial class SDL2Window
{
private void setupInput(FrameworkConfigManager config)
{

View File

@@ -17,7 +17,7 @@ using SDL2;
namespace osu.Framework.Platform
{
public partial class SDL2Window
internal partial class SDL2Window
{
private void setupWindowing(FrameworkConfigManager config)
{

View File

@@ -15,7 +15,7 @@ using Icon = osu.Framework.Platform.Windows.Native.Icon;
namespace osu.Framework.Platform.Windows
{
[SupportedOSPlatform("windows")]
public class WindowsWindow : SDL2DesktopWindow
internal class WindowsWindow : SDL2DesktopWindow
{
private const int seticon_message = 0x0080;
private const int icon_big = 1;