Remove Game.HasInputFocus
This commit is contained in:
@@ -51,7 +51,6 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static Renderer Renderer;
|
public static Renderer Renderer;
|
||||||
public static Sound Sound;
|
public static Sound Sound;
|
||||||
public static bool HasInputFocus = false;
|
|
||||||
|
|
||||||
public static string EngineVersion { get; private set; }
|
public static string EngineVersion { get; private set; }
|
||||||
public static LocalPlayerProfile LocalPlayerProfile;
|
public static LocalPlayerProfile LocalPlayerProfile;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ namespace OpenRA
|
|||||||
Size SurfaceSize { get; }
|
Size SurfaceSize { get; }
|
||||||
int DisplayCount { get; }
|
int DisplayCount { get; }
|
||||||
int CurrentDisplay { get; }
|
int CurrentDisplay { get; }
|
||||||
|
bool HasInputFocus { get; }
|
||||||
|
|
||||||
event Action<float, float, float, float> OnWindowScaleChanged;
|
event Action<float, float, float, float> OnWindowScaleChanged;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,15 @@ namespace OpenRA
|
|||||||
public RgbaColorRenderer RgbaColorRenderer { get; private set; }
|
public RgbaColorRenderer RgbaColorRenderer { get; private set; }
|
||||||
public SpriteRenderer SpriteRenderer { get; private set; }
|
public SpriteRenderer SpriteRenderer { get; private set; }
|
||||||
public RgbaSpriteRenderer RgbaSpriteRenderer { get; private set; }
|
public RgbaSpriteRenderer RgbaSpriteRenderer { get; private set; }
|
||||||
|
|
||||||
|
public bool WindowHasInputFocus
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Window.HasInputFocus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IReadOnlyDictionary<string, SpriteFont> Fonts;
|
public IReadOnlyDictionary<string, SpriteFont> Fonts;
|
||||||
|
|
||||||
internal IPlatformWindow Window { get; private set; }
|
internal IPlatformWindow Window { get; private set; }
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
else if (!isStandardScrolling)
|
else if (!isStandardScrolling)
|
||||||
{
|
{
|
||||||
edgeDirections = ScrollDirection.None;
|
edgeDirections = ScrollDirection.None;
|
||||||
if (Game.Settings.Game.ViewportEdgeScroll && Game.HasInputFocus)
|
if (Game.Settings.Game.ViewportEdgeScroll && Game.Renderer.WindowHasInputFocus)
|
||||||
edgeDirections = CheckForDirections();
|
edgeDirections = CheckForDirections();
|
||||||
|
|
||||||
if (keyboardDirections != ScrollDirection.None || edgeDirections != ScrollDirection.None)
|
if (keyboardDirections != ScrollDirection.None || edgeDirections != ScrollDirection.None)
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ namespace OpenRA.Platforms.Default
|
|||||||
switch (e.window.windowEvent)
|
switch (e.window.windowEvent)
|
||||||
{
|
{
|
||||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
Game.HasInputFocus = false;
|
device.HasInputFocus = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
Game.HasInputFocus = true;
|
device.HasInputFocus = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Triggered when moving between displays with different DPI settings
|
// Triggered when moving between displays with different DPI settings
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ namespace OpenRA.Platforms.Default
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasInputFocus { get; internal set; }
|
||||||
|
|
||||||
public event Action<float, float, float, float> OnWindowScaleChanged = (oldNative, oldEffective, newNative, newEffective) => { };
|
public event Action<float, float, float, float> OnWindowScaleChanged = (oldNative, oldEffective, newNative, newEffective) => { };
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
@@ -221,11 +223,11 @@ namespace OpenRA.Platforms.Default
|
|||||||
switch (e.window.windowEvent)
|
switch (e.window.windowEvent)
|
||||||
{
|
{
|
||||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
Game.HasInputFocus = false;
|
HasInputFocus = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
Game.HasInputFocus = true;
|
HasInputFocus = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user