mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-15 03:20:30 +00:00
Remove HasFlagFast
This commit is contained in:
@@ -2,7 +2,6 @@ M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use obj
|
||||
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
|
||||
M:System.Enum.HasFlag(System.Enum);Use osu.Framework.Extensions.EnumExtensions.HasFlagFast<T>() instead.
|
||||
F:System.UriKind.RelativeOrAbsolute;Incompatible results when run on mono (see https://www.mono-project.com/docs/faq/known-issues/urikind-relativeorabsolute/). Use Validation.TryParseUri(string, out Uri?) instead.
|
||||
M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks.
|
||||
M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty.
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
|
||||
namespace osu.Framework.Benchmarks
|
||||
{
|
||||
[MemoryDiagnoser]
|
||||
public class BenchmarkEnum
|
||||
{
|
||||
[Benchmark]
|
||||
public bool HasFlag()
|
||||
{
|
||||
#pragma warning disable RS0030 // (banned API)
|
||||
return (FlagsEnum.Flag2 | FlagsEnum.Flag3).HasFlag(FlagsEnum.Flag2);
|
||||
#pragma warning restore RS0030
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public bool BitwiseAnd()
|
||||
{
|
||||
return ((FlagsEnum.Flag2 | FlagsEnum.Flag3) & FlagsEnum.Flag2) > 0;
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public bool HasFlagFast()
|
||||
{
|
||||
return (FlagsEnum.Flag2 | FlagsEnum.Flag3).HasFlagFast(FlagsEnum.Flag2);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum FlagsEnum
|
||||
{
|
||||
Flag1 = 1,
|
||||
Flag2 = 2,
|
||||
Flag3 = 4,
|
||||
Flag4 = 8
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -51,10 +50,10 @@ namespace osu.Framework.Tests.Visual.Containers
|
||||
|
||||
private void addBoxAssert(OverrideTestContainer container)
|
||||
{
|
||||
bool leftOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlagFast(Edges.Left);
|
||||
bool topOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlagFast(Edges.Top);
|
||||
bool rightOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlagFast(Edges.Right);
|
||||
bool bottomOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlagFast(Edges.Bottom);
|
||||
bool leftOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlag(Edges.Left);
|
||||
bool topOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlag(Edges.Top);
|
||||
bool rightOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlag(Edges.Right);
|
||||
bool bottomOverridden = container.SafeAreaContainer.SafeAreaOverrideEdges.HasFlag(Edges.Bottom);
|
||||
|
||||
AddAssert($"\"{container.Name}\" overrides correctly", () =>
|
||||
leftOverridden == container.SafeAreaContainer.Padding.Left < 0
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -85,7 +84,7 @@ namespace osu.Framework.Tests.Visual.Drawables
|
||||
Anchor = anchor,
|
||||
Origin = anchor,
|
||||
Size = new Vector2(10),
|
||||
Position = new Vector2(anchor.HasFlagFast(Anchor.x0) ? -5 : 5, anchor.HasFlagFast(Anchor.y0) ? -5 : 5),
|
||||
Position = new Vector2(anchor.HasFlag(Anchor.x0) ? -5 : 5, anchor.HasFlag(Anchor.y0) ? -5 : 5),
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -118,7 +117,7 @@ namespace osu.Framework.Tests.Visual.Drawables
|
||||
Anchor = anchor,
|
||||
Origin = anchor,
|
||||
Size = new Vector2(10),
|
||||
Position = new Vector2(anchor.HasFlagFast(Anchor.x0) ? -20 : 20, anchor.HasFlagFast(Anchor.y0) ? -20 : 20),
|
||||
Position = new Vector2(anchor.HasFlag(Anchor.x0) ? -20 : 20, anchor.HasFlag(Anchor.y0) ? -20 : 20),
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
@@ -200,14 +199,14 @@ namespace osu.Framework.Tests.Visual.UserInterface
|
||||
{
|
||||
box.Anchor = anchor;
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.x0))
|
||||
if (anchor.HasFlag(Anchor.x0))
|
||||
box.X -= contextMenuContainer.CurrentMenu.DrawWidth + 10;
|
||||
else if (anchor.HasFlagFast(Anchor.x2))
|
||||
else if (anchor.HasFlag(Anchor.x2))
|
||||
box.X += 10;
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.y0))
|
||||
if (anchor.HasFlag(Anchor.y0))
|
||||
box.Y -= contextMenuContainer.CurrentMenu.DrawHeight + 10;
|
||||
else if (anchor.HasFlagFast(Anchor.y2))
|
||||
else if (anchor.HasFlag(Anchor.y2))
|
||||
box.Y += 10;
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using ManagedBass;
|
||||
using ManagedBass.Mix;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Statistics;
|
||||
|
||||
namespace osu.Framework.Audio.Mixing.Bass
|
||||
@@ -159,7 +158,7 @@ namespace osu.Framework.Audio.Mixing.Bass
|
||||
|
||||
// The channel is always in a playing state unless stopped or stalled as it's a decoding channel. Retrieve the true playing state from the mixer channel.
|
||||
if (state == PlaybackState.Playing)
|
||||
state = BassMix.ChannelFlags(channel.Handle, BassFlags.Default, BassFlags.Default).HasFlagFast(BassFlags.MixerChanPause) ? PlaybackState.Paused : state;
|
||||
state = BassMix.ChannelFlags(channel.Handle, BassFlags.Default, BassFlags.Default).HasFlag(BassFlags.MixerChanPause) ? PlaybackState.Paused : state;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osuTK;
|
||||
@@ -22,9 +21,9 @@ namespace osu.Framework.Extensions
|
||||
if (anchor == Anchor.Custom)
|
||||
throw new ArgumentException($"{nameof(Anchor.Custom)} is not supported.", nameof(anchor));
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.x0) || anchor.HasFlagFast(Anchor.x2))
|
||||
if (anchor.HasFlag(Anchor.x0) || anchor.HasFlag(Anchor.x2))
|
||||
anchor ^= Anchor.x0 | Anchor.x2;
|
||||
if (anchor.HasFlagFast(Anchor.y0) || anchor.HasFlagFast(Anchor.y2))
|
||||
if (anchor.HasFlag(Anchor.y0) || anchor.HasFlag(Anchor.y2))
|
||||
anchor ^= Anchor.y0 | Anchor.y2;
|
||||
|
||||
return anchor;
|
||||
@@ -40,18 +39,18 @@ namespace osu.Framework.Extensions
|
||||
|
||||
Vector2 position = new Vector2();
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.x0))
|
||||
if (anchor.HasFlag(Anchor.x0))
|
||||
position.X = quad.TopLeft.X;
|
||||
else if (anchor.HasFlagFast(Anchor.x1))
|
||||
else if (anchor.HasFlag(Anchor.x1))
|
||||
position.X = quad.Centre.X;
|
||||
else if (anchor.HasFlagFast(Anchor.x2))
|
||||
else if (anchor.HasFlag(Anchor.x2))
|
||||
position.X = quad.BottomRight.X;
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.y0))
|
||||
if (anchor.HasFlag(Anchor.y0))
|
||||
position.Y = quad.TopLeft.Y;
|
||||
else if (anchor.HasFlagFast(Anchor.y1))
|
||||
else if (anchor.HasFlag(Anchor.y1))
|
||||
position.Y = quad.Centre.Y;
|
||||
else if (anchor.HasFlagFast(Anchor.y2))
|
||||
else if (anchor.HasFlag(Anchor.y2))
|
||||
position.Y = quad.BottomRight.Y;
|
||||
|
||||
return position;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Utils;
|
||||
|
||||
@@ -55,48 +54,5 @@ namespace osu.Framework.Extensions.EnumExtensions
|
||||
throw new ArgumentException($"Not all values of {typeof(T)} have {nameof(OrderAttribute)} specified.");
|
||||
});
|
||||
}
|
||||
|
||||
#pragma warning disable RS0030 // (banned API)
|
||||
/// <summary>
|
||||
/// A fast alternative functionally equivalent to <see cref="Enum.HasFlag"/>, eliminating boxing in all scenarios.
|
||||
/// </summary>
|
||||
/// <param name="enumValue">The enum to check.</param>
|
||||
/// <param name="flag">The flag to check for.</param>
|
||||
#pragma warning restore RS0030
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe bool HasFlagFast<T>(this T enumValue, T flag) where T : unmanaged, Enum
|
||||
{
|
||||
// Note: Using a switch statement would eliminate inlining.
|
||||
|
||||
if (sizeof(T) == 1)
|
||||
{
|
||||
byte value1 = Unsafe.As<T, byte>(ref enumValue);
|
||||
byte value2 = Unsafe.As<T, byte>(ref flag);
|
||||
return (value1 & value2) == value2;
|
||||
}
|
||||
|
||||
if (sizeof(T) == 2)
|
||||
{
|
||||
short value1 = Unsafe.As<T, short>(ref enumValue);
|
||||
short value2 = Unsafe.As<T, short>(ref flag);
|
||||
return (value1 & value2) == value2;
|
||||
}
|
||||
|
||||
if (sizeof(T) == 4)
|
||||
{
|
||||
int value1 = Unsafe.As<T, int>(ref enumValue);
|
||||
int value2 = Unsafe.As<T, int>(ref flag);
|
||||
return (value1 & value2) == value2;
|
||||
}
|
||||
|
||||
if (sizeof(T) == 8)
|
||||
{
|
||||
long value1 = Unsafe.As<T, long>(ref enumValue);
|
||||
long value2 = Unsafe.As<T, long>(ref flag);
|
||||
return (value1 & value2) == value2;
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Invalid enum type provided: {typeof(T)}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
|
||||
namespace osu.Framework.Extensions
|
||||
{
|
||||
@@ -43,7 +42,7 @@ namespace osu.Framework.Extensions
|
||||
private static bool isWaitingValid(Task task)
|
||||
{
|
||||
// In the case the task has been started with the LongRunning flag, it will not be in the TPL thread pool and we can allow waiting regardless.
|
||||
if (task.CreationOptions.HasFlagFast(TaskCreationOptions.LongRunning))
|
||||
if (task.CreationOptions.HasFlag(TaskCreationOptions.LongRunning))
|
||||
return true;
|
||||
|
||||
// Otherwise only allow waiting from a non-TPL thread pool thread.
|
||||
|
||||
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Audio;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osuTK;
|
||||
@@ -41,8 +40,8 @@ namespace osu.Framework.Graphics.Containers
|
||||
set
|
||||
{
|
||||
base.Size = new Vector2(
|
||||
RelativeSizeAxes.HasFlagFast(Axes.X) ? 1 : value.X,
|
||||
RelativeSizeAxes.HasFlagFast(Axes.Y) ? 1 : value.Y);
|
||||
RelativeSizeAxes.HasFlag(Axes.X) ? 1 : value.X,
|
||||
RelativeSizeAxes.HasFlag(Axes.Y) ? 1 : value.Y);
|
||||
|
||||
container.Size = value;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ using osu.Framework.Statistics;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Extensions.ExceptionExtensions;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
@@ -723,9 +722,9 @@ namespace osu.Framework.Graphics.Containers
|
||||
{
|
||||
var state = checkChildLife(internalChildren[i]);
|
||||
|
||||
anyAliveChanged |= state.HasFlagFast(ChildLifeStateChange.MadeAlive) || state.HasFlagFast(ChildLifeStateChange.MadeDead);
|
||||
anyAliveChanged |= state.HasFlag(ChildLifeStateChange.MadeAlive) || state.HasFlag(ChildLifeStateChange.MadeDead);
|
||||
|
||||
if (state.HasFlagFast(ChildLifeStateChange.Removed))
|
||||
if (state.HasFlag(ChildLifeStateChange.Removed))
|
||||
i--;
|
||||
}
|
||||
|
||||
@@ -1840,7 +1839,7 @@ namespace osu.Framework.Graphics.Containers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!isComputingChildrenSizeDependencies && AutoSizeAxes.HasFlagFast(Axes.X))
|
||||
if (!isComputingChildrenSizeDependencies && AutoSizeAxes.HasFlag(Axes.X))
|
||||
updateChildrenSizeDependencies();
|
||||
return base.Width;
|
||||
}
|
||||
@@ -1858,7 +1857,7 @@ namespace osu.Framework.Graphics.Containers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!isComputingChildrenSizeDependencies && AutoSizeAxes.HasFlagFast(Axes.Y))
|
||||
if (!isComputingChildrenSizeDependencies && AutoSizeAxes.HasFlag(Axes.Y))
|
||||
updateChildrenSizeDependencies();
|
||||
return base.Height;
|
||||
}
|
||||
@@ -1914,16 +1913,16 @@ namespace osu.Framework.Graphics.Containers
|
||||
|
||||
Vector2 cBound = c.RequiredParentSizeToFit;
|
||||
|
||||
if (!c.BypassAutoSizeAxes.HasFlagFast(Axes.X))
|
||||
if (!c.BypassAutoSizeAxes.HasFlag(Axes.X))
|
||||
maxBoundSize.X = Math.Max(maxBoundSize.X, cBound.X);
|
||||
|
||||
if (!c.BypassAutoSizeAxes.HasFlagFast(Axes.Y))
|
||||
if (!c.BypassAutoSizeAxes.HasFlag(Axes.Y))
|
||||
maxBoundSize.Y = Math.Max(maxBoundSize.Y, cBound.Y);
|
||||
}
|
||||
|
||||
if (!AutoSizeAxes.HasFlagFast(Axes.X))
|
||||
if (!AutoSizeAxes.HasFlag(Axes.X))
|
||||
maxBoundSize.X = DrawSize.X;
|
||||
if (!AutoSizeAxes.HasFlagFast(Axes.Y))
|
||||
if (!AutoSizeAxes.HasFlag(Axes.Y))
|
||||
maxBoundSize.Y = DrawSize.Y;
|
||||
|
||||
return new Vector2(maxBoundSize.X, maxBoundSize.Y);
|
||||
@@ -1943,8 +1942,8 @@ namespace osu.Framework.Graphics.Containers
|
||||
Vector2 b = computeAutoSize() + Padding.Total;
|
||||
|
||||
autoSizeResizeTo(new Vector2(
|
||||
AutoSizeAxes.HasFlagFast(Axes.X) ? b.X : base.Width,
|
||||
AutoSizeAxes.HasFlagFast(Axes.Y) ? b.Y : base.Height
|
||||
AutoSizeAxes.HasFlag(Axes.X) ? b.X : base.Width,
|
||||
AutoSizeAxes.HasFlag(Axes.Y) ? b.Y : base.Height
|
||||
), AutoSizeDuration, AutoSizeEasing);
|
||||
|
||||
//note that this is called before autoSize becomes valid. may be something to consider down the line.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
using osuTK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
|
||||
namespace osu.Framework.Graphics.Containers
|
||||
{
|
||||
@@ -42,13 +41,13 @@ namespace osu.Framework.Graphics.Containers
|
||||
|
||||
// For anchor/origin positioning to be preserved correctly,
|
||||
// relatively sized axes must be lifted to the wrapping container.
|
||||
if (container.RelativeSizeAxes.HasFlagFast(Axes.X))
|
||||
if (container.RelativeSizeAxes.HasFlag(Axes.X))
|
||||
{
|
||||
container.Width = drawable.Width;
|
||||
drawable.Width = 1;
|
||||
}
|
||||
|
||||
if (container.RelativeSizeAxes.HasFlagFast(Axes.Y))
|
||||
if (container.RelativeSizeAxes.HasFlag(Axes.Y))
|
||||
{
|
||||
container.Height = drawable.Height;
|
||||
drawable.Height = 1;
|
||||
|
||||
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Utils;
|
||||
using osuTK;
|
||||
|
||||
@@ -89,9 +88,9 @@ namespace osu.Framework.Graphics.Containers
|
||||
private Vector2 spacingFactor(Drawable c)
|
||||
{
|
||||
Vector2 result = c.RelativeOriginPosition;
|
||||
if (c.Anchor.HasFlagFast(Anchor.x2))
|
||||
if (c.Anchor.HasFlag(Anchor.x2))
|
||||
result.X = 1 - result.X;
|
||||
if (c.Anchor.HasFlagFast(Anchor.y2))
|
||||
if (c.Anchor.HasFlag(Anchor.y2))
|
||||
result.Y = 1 - result.Y;
|
||||
return result;
|
||||
}
|
||||
@@ -106,8 +105,8 @@ namespace osu.Framework.Graphics.Containers
|
||||
|
||||
// If we are autosize and haven't specified a maximum size, we should allow infinite expansion.
|
||||
// If we are inheriting then we need to use the parent size (our ActualSize).
|
||||
max.X = AutoSizeAxes.HasFlagFast(Axes.X) ? float.MaxValue : s.X;
|
||||
max.Y = AutoSizeAxes.HasFlagFast(Axes.Y) ? float.MaxValue : s.Y;
|
||||
max.X = AutoSizeAxes.HasFlag(Axes.X) ? float.MaxValue : s.X;
|
||||
max.Y = AutoSizeAxes.HasFlag(Axes.Y) ? float.MaxValue : s.Y;
|
||||
}
|
||||
|
||||
var children = FlowingChildren.ToArray();
|
||||
@@ -270,17 +269,17 @@ namespace osu.Framework.Graphics.Containers
|
||||
}
|
||||
|
||||
var layoutPosition = layoutPositions[i];
|
||||
if (c.Anchor.HasFlagFast(Anchor.x1))
|
||||
if (c.Anchor.HasFlag(Anchor.x1))
|
||||
// Begin flow at centre of row
|
||||
layoutPosition.X += rowOffsetsToMiddle[rowIndices[i]];
|
||||
else if (c.Anchor.HasFlagFast(Anchor.x2))
|
||||
else if (c.Anchor.HasFlag(Anchor.x2))
|
||||
// Flow right-to-left
|
||||
layoutPosition.X = -layoutPosition.X;
|
||||
|
||||
if (c.Anchor.HasFlagFast(Anchor.y1))
|
||||
if (c.Anchor.HasFlag(Anchor.y1))
|
||||
// Begin flow at centre of total height
|
||||
layoutPosition.Y -= height / 2;
|
||||
else if (c.Anchor.HasFlagFast(Anchor.y2))
|
||||
else if (c.Anchor.HasFlag(Anchor.y2))
|
||||
// Flow bottom-to-top
|
||||
layoutPosition.Y = -layoutPosition.Y;
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Layout;
|
||||
using osuTK;
|
||||
|
||||
@@ -284,7 +283,7 @@ namespace osu.Framework.Graphics.Containers
|
||||
for (int r = 0; r < cellRows; r++)
|
||||
{
|
||||
var cell = Content[r]?[i];
|
||||
if (cell == null || cell.RelativeSizeAxes.HasFlagFast(axis))
|
||||
if (cell == null || cell.RelativeSizeAxes.HasFlag(axis))
|
||||
continue;
|
||||
|
||||
size = Math.Max(size, getCellWidth(cell));
|
||||
@@ -296,7 +295,7 @@ namespace osu.Framework.Graphics.Containers
|
||||
for (int c = 0; c < cellColumns; c++)
|
||||
{
|
||||
var cell = Content[i]?[c];
|
||||
if (cell == null || cell.RelativeSizeAxes.HasFlagFast(axis))
|
||||
if (cell == null || cell.RelativeSizeAxes.HasFlag(axis))
|
||||
continue;
|
||||
|
||||
size = Math.Max(size, getCellHeight(cell));
|
||||
|
||||
@@ -13,7 +13,6 @@ using Markdig.Syntax;
|
||||
using Markdig.Syntax.Inlines;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Containers.Markdown.Footnotes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
@@ -41,7 +40,7 @@ namespace osu.Framework.Graphics.Containers.Markdown
|
||||
get => base.AutoSizeAxes;
|
||||
set
|
||||
{
|
||||
if (value.HasFlagFast(Axes.X))
|
||||
if (value.HasFlag(Axes.X))
|
||||
throw new ArgumentException($"{nameof(MarkdownContainer)} does not support an {nameof(AutoSizeAxes)} of {value}");
|
||||
|
||||
base.AutoSizeAxes = value;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Layout;
|
||||
using osuTK;
|
||||
@@ -82,10 +81,10 @@ namespace osu.Framework.Graphics.Containers
|
||||
|
||||
return new MarginPadding
|
||||
{
|
||||
Left = SafeAreaOverrideEdges.HasFlagFast(Edges.Left) ? nonSafeLocalSpace.TopLeft.X : Math.Clamp(localTopLeft.X, 0, absDrawSize.X),
|
||||
Right = SafeAreaOverrideEdges.HasFlagFast(Edges.Right) ? DrawRectangle.BottomRight.X - nonSafeLocalSpace.BottomRight.X : Math.Clamp(absDrawSize.X - localBottomRight.X, 0, absDrawSize.X),
|
||||
Top = SafeAreaOverrideEdges.HasFlagFast(Edges.Top) ? nonSafeLocalSpace.TopLeft.Y : Math.Clamp(localTopLeft.Y, 0, absDrawSize.Y),
|
||||
Bottom = SafeAreaOverrideEdges.HasFlagFast(Edges.Bottom) ? DrawRectangle.BottomRight.Y - nonSafeLocalSpace.BottomRight.Y : Math.Clamp(absDrawSize.Y - localBottomRight.Y, 0, absDrawSize.Y)
|
||||
Left = SafeAreaOverrideEdges.HasFlag(Edges.Left) ? nonSafeLocalSpace.TopLeft.X : Math.Clamp(localTopLeft.X, 0, absDrawSize.X),
|
||||
Right = SafeAreaOverrideEdges.HasFlag(Edges.Right) ? DrawRectangle.BottomRight.X - nonSafeLocalSpace.BottomRight.X : Math.Clamp(absDrawSize.X - localBottomRight.X, 0, absDrawSize.X),
|
||||
Top = SafeAreaOverrideEdges.HasFlag(Edges.Top) ? nonSafeLocalSpace.TopLeft.Y : Math.Clamp(localTopLeft.Y, 0, absDrawSize.Y),
|
||||
Bottom = SafeAreaOverrideEdges.HasFlag(Edges.Bottom) ? DrawRectangle.BottomRight.Y - nonSafeLocalSpace.BottomRight.Y : Math.Clamp(absDrawSize.Y - localBottomRight.Y, 0, absDrawSize.Y)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
@@ -207,7 +206,7 @@ namespace osu.Framework.Graphics.Containers
|
||||
{
|
||||
// FillFlowContainer will reverse the ordering of right-anchored words such that the (previously) first word would be
|
||||
// the right-most word, whereas it should still be flowed left-to-right. This is achieved by reversing the comparator.
|
||||
if (TextAnchor.HasFlagFast(Anchor.x2))
|
||||
if (TextAnchor.HasFlag(Anchor.x2))
|
||||
return base.Compare(y, x);
|
||||
|
||||
return base.Compare(x, y);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
@@ -157,18 +156,18 @@ namespace osu.Framework.Graphics.Cursor
|
||||
|
||||
// left anchor = area to the left of the quad, right anchor = area to the right of the quad.
|
||||
// for horizontal centre assume we have the whole quad width to work with.
|
||||
if (anchor.HasFlagFast(Anchor.x0))
|
||||
if (anchor.HasFlag(Anchor.x0))
|
||||
availableSize.X = MathF.Max(0, targetLocalQuad.TopLeft.X);
|
||||
else if (anchor.HasFlagFast(Anchor.x2))
|
||||
else if (anchor.HasFlag(Anchor.x2))
|
||||
availableSize.X = MathF.Max(0, DrawWidth - targetLocalQuad.BottomRight.X);
|
||||
else
|
||||
availableSize.X = DrawWidth;
|
||||
|
||||
// top anchor = area above quad, bottom anchor = area below quad.
|
||||
// for vertical centre assume we have the whole quad height to work with.
|
||||
if (anchor.HasFlagFast(Anchor.y0))
|
||||
if (anchor.HasFlag(Anchor.y0))
|
||||
availableSize.Y = MathF.Max(0, targetLocalQuad.TopLeft.Y);
|
||||
else if (anchor.HasFlagFast(Anchor.y2))
|
||||
else if (anchor.HasFlag(Anchor.y2))
|
||||
availableSize.Y = MathF.Max(0, DrawHeight - targetLocalQuad.BottomRight.Y);
|
||||
else
|
||||
availableSize.Y = DrawHeight;
|
||||
|
||||
@@ -28,7 +28,6 @@ using System.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.States;
|
||||
@@ -683,10 +682,10 @@ namespace osu.Framework.Graphics
|
||||
{
|
||||
offset = Parent.RelativeChildOffset;
|
||||
|
||||
if (!RelativePositionAxes.HasFlagFast(Axes.X))
|
||||
if (!RelativePositionAxes.HasFlag(Axes.X))
|
||||
offset.X = 0;
|
||||
|
||||
if (!RelativePositionAxes.HasFlagFast(Axes.Y))
|
||||
if (!RelativePositionAxes.HasFlag(Axes.Y))
|
||||
offset.Y = 0;
|
||||
}
|
||||
|
||||
@@ -812,8 +811,8 @@ namespace osu.Framework.Graphics
|
||||
|
||||
relativeSizeAxes = value;
|
||||
|
||||
if (relativeSizeAxes.HasFlagFast(Axes.X) && Width == 0) Width = 1;
|
||||
if (relativeSizeAxes.HasFlagFast(Axes.Y) && Height == 0) Height = 1;
|
||||
if (relativeSizeAxes.HasFlag(Axes.X) && Width == 0) Width = 1;
|
||||
if (relativeSizeAxes.HasFlag(Axes.Y) && Height == 0) Height = 1;
|
||||
|
||||
updateBypassAutoSizeAxes();
|
||||
|
||||
@@ -907,9 +906,9 @@ namespace osu.Framework.Graphics
|
||||
{
|
||||
Vector2 conversion = relativeToAbsoluteFactor;
|
||||
|
||||
if (relativeAxes.HasFlagFast(Axes.X))
|
||||
if (relativeAxes.HasFlag(Axes.X))
|
||||
v.X *= conversion.X;
|
||||
if (relativeAxes.HasFlagFast(Axes.Y))
|
||||
if (relativeAxes.HasFlag(Axes.Y))
|
||||
v.Y *= conversion.Y;
|
||||
|
||||
// FillMode only makes sense if both axes are relatively sized as the general rule
|
||||
@@ -1137,14 +1136,14 @@ namespace osu.Framework.Graphics
|
||||
throw new InvalidOperationException(@"Can not obtain relative origin position for custom origins.");
|
||||
|
||||
Vector2 result = Vector2.Zero;
|
||||
if (origin.HasFlagFast(Anchor.x1))
|
||||
if (origin.HasFlag(Anchor.x1))
|
||||
result.X = 0.5f;
|
||||
else if (origin.HasFlagFast(Anchor.x2))
|
||||
else if (origin.HasFlag(Anchor.x2))
|
||||
result.X = 1;
|
||||
|
||||
if (origin.HasFlagFast(Anchor.y1))
|
||||
if (origin.HasFlag(Anchor.y1))
|
||||
result.Y = 0.5f;
|
||||
else if (origin.HasFlagFast(Anchor.y2))
|
||||
else if (origin.HasFlag(Anchor.y2))
|
||||
result.Y = 1;
|
||||
|
||||
return result;
|
||||
@@ -1225,14 +1224,14 @@ namespace osu.Framework.Graphics
|
||||
return customRelativeAnchorPosition;
|
||||
|
||||
Vector2 result = Vector2.Zero;
|
||||
if (anchor.HasFlagFast(Anchor.x1))
|
||||
if (anchor.HasFlag(Anchor.x1))
|
||||
result.X = 0.5f;
|
||||
else if (anchor.HasFlagFast(Anchor.x2))
|
||||
else if (anchor.HasFlag(Anchor.x2))
|
||||
result.X = 1;
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.y1))
|
||||
if (anchor.HasFlag(Anchor.y1))
|
||||
result.Y = 0.5f;
|
||||
else if (anchor.HasFlagFast(Anchor.y2))
|
||||
else if (anchor.HasFlag(Anchor.y2))
|
||||
result.Y = 1;
|
||||
|
||||
return result;
|
||||
@@ -1270,14 +1269,14 @@ namespace osu.Framework.Graphics
|
||||
{
|
||||
Vector2 result = Vector2.Zero;
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.x1))
|
||||
if (anchor.HasFlag(Anchor.x1))
|
||||
result.X = size.X / 2f;
|
||||
else if (anchor.HasFlagFast(Anchor.x2))
|
||||
else if (anchor.HasFlag(Anchor.x2))
|
||||
result.X = size.X;
|
||||
|
||||
if (anchor.HasFlagFast(Anchor.y1))
|
||||
if (anchor.HasFlag(Anchor.y1))
|
||||
result.Y = size.Y / 2f;
|
||||
else if (anchor.HasFlagFast(Anchor.y2))
|
||||
else if (anchor.HasFlag(Anchor.y2))
|
||||
result.Y = size.Y;
|
||||
|
||||
return result;
|
||||
|
||||
@@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shaders;
|
||||
using osu.Framework.Allocation;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Layout;
|
||||
using osuTK.Graphics;
|
||||
@@ -118,7 +117,7 @@ namespace osu.Framework.Graphics.Lines
|
||||
{
|
||||
get
|
||||
{
|
||||
if (AutoSizeAxes.HasFlagFast(Axes.X))
|
||||
if (AutoSizeAxes.HasFlag(Axes.X))
|
||||
return base.Width = vertexBounds.Width;
|
||||
|
||||
return base.Width;
|
||||
@@ -136,7 +135,7 @@ namespace osu.Framework.Graphics.Lines
|
||||
{
|
||||
get
|
||||
{
|
||||
if (AutoSizeAxes.HasFlagFast(Axes.Y))
|
||||
if (AutoSizeAxes.HasFlag(Axes.Y))
|
||||
return base.Height = vertexBounds.Height;
|
||||
|
||||
return base.Height;
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.OpenGL.Buffers;
|
||||
using osu.Framework.Graphics.OpenGL.Textures;
|
||||
using osu.Framework.Graphics.OpenGL.Batches;
|
||||
@@ -325,10 +324,10 @@ namespace osu.Framework.Graphics.OpenGL
|
||||
|
||||
protected override void SetBlendMaskImplementation(BlendingMask blendingMask)
|
||||
{
|
||||
GL.ColorMask(blendingMask.HasFlagFast(BlendingMask.Red),
|
||||
blendingMask.HasFlagFast(BlendingMask.Green),
|
||||
blendingMask.HasFlagFast(BlendingMask.Blue),
|
||||
blendingMask.HasFlagFast(BlendingMask.Alpha));
|
||||
GL.ColorMask(blendingMask.HasFlag(BlendingMask.Red),
|
||||
blendingMask.HasFlag(BlendingMask.Green),
|
||||
blendingMask.HasFlag(BlendingMask.Blue),
|
||||
blendingMask.HasFlag(BlendingMask.Alpha));
|
||||
}
|
||||
|
||||
protected override void SetViewportImplementation(RectangleI viewport) => GL.Viewport(viewport.Left, viewport.Top, viewport.Width, viewport.Height);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Layout;
|
||||
|
||||
@@ -118,7 +117,7 @@ namespace osu.Framework.Graphics.Pooling
|
||||
|
||||
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
|
||||
{
|
||||
if (source != InvalidationSource.Child && invalidation.HasFlagFast(Invalidation.Parent))
|
||||
if (source != InvalidationSource.Child && invalidation.HasFlag(Invalidation.Parent))
|
||||
{
|
||||
if (IsInUse && Parent == null)
|
||||
Return();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Graphics.Visualisation;
|
||||
@@ -96,8 +95,8 @@ namespace osu.Framework.Graphics.Textures
|
||||
if (relativeSizeAxes != Axes.None)
|
||||
{
|
||||
Vector2 scale = new Vector2(
|
||||
relativeSizeAxes.HasFlagFast(Axes.X) ? Width : 1,
|
||||
relativeSizeAxes.HasFlagFast(Axes.Y) ? Height : 1
|
||||
relativeSizeAxes.HasFlag(Axes.X) ? Width : 1,
|
||||
relativeSizeAxes.HasFlag(Axes.Y) ? Height : 1
|
||||
);
|
||||
cropRectangle *= scale;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osuTK;
|
||||
|
||||
@@ -25,7 +24,7 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
{
|
||||
base.AnchorUpdated(anchor);
|
||||
|
||||
bool isCenteredAnchor = anchor.HasFlagFast(Anchor.x1) || anchor.HasFlagFast(Anchor.y1);
|
||||
bool isCenteredAnchor = anchor.HasFlag(Anchor.x1) || anchor.HasFlag(Anchor.y1);
|
||||
Body.Margin = new MarginPadding(isCenteredAnchor ? 10 : 3);
|
||||
Arrow.Size = new Vector2(isCenteredAnchor ? 12 : 15);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Platform;
|
||||
using osuTK;
|
||||
@@ -206,7 +205,7 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
{
|
||||
foreach (var dir in path.GetDirectories().OrderBy(d => d.Name))
|
||||
{
|
||||
if (ShowHiddenItems.Value || !dir.Attributes.HasFlagFast(FileAttributes.Hidden))
|
||||
if (ShowHiddenItems.Value || !dir.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
items.Add(CreateDirectoryItem(dir));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.IO;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
|
||||
namespace osu.Framework.Graphics.UserInterface
|
||||
{
|
||||
@@ -27,7 +26,7 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
|
||||
try
|
||||
{
|
||||
bool isHidden = directory?.Attributes.HasFlagFast(FileAttributes.Hidden) == true;
|
||||
bool isHidden = directory?.Attributes.HasFlag(FileAttributes.Hidden) == true;
|
||||
|
||||
// On Windows, system drives are returned with `System | Hidden | Directory` file attributes,
|
||||
// but the expectation is that they shouldn't be shown in a hidden state.
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Input.Events;
|
||||
|
||||
namespace osu.Framework.Graphics.UserInterface
|
||||
@@ -49,7 +48,7 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
|
||||
foreach (var file in files.OrderBy(d => d.Name))
|
||||
{
|
||||
if (ShowHiddenItems.Value || !file.Attributes.HasFlagFast(FileAttributes.Hidden))
|
||||
if (ShowHiddenItems.Value || !file.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
items.Add(CreateFileItem(file));
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
|
||||
try
|
||||
{
|
||||
if (File?.Attributes.HasFlagFast(FileAttributes.Hidden) == true)
|
||||
if (File?.Attributes.HasFlag(FileAttributes.Hidden) == true)
|
||||
ApplyHiddenState();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
|
||||
@@ -7,7 +7,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osuTK.Graphics;
|
||||
@@ -498,8 +497,8 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
height = Math.Min(MaxHeight, height);
|
||||
|
||||
// Regardless of the above result, if we are relative-sizing, just use the stored width/height
|
||||
width = RelativeSizeAxes.HasFlagFast(Axes.X) ? Width : width;
|
||||
height = RelativeSizeAxes.HasFlagFast(Axes.Y) ? Height : height;
|
||||
width = RelativeSizeAxes.HasFlag(Axes.X) ? Width : width;
|
||||
height = RelativeSizeAxes.HasFlag(Axes.Y) ? Height : height;
|
||||
|
||||
if (State == MenuState.Closed && Direction == Direction.Horizontal)
|
||||
width = 0;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -185,7 +184,7 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
get => Body.Width;
|
||||
set
|
||||
{
|
||||
if (Body.AutoSizeAxes.HasFlagFast(Axes.X))
|
||||
if (Body.AutoSizeAxes.HasFlag(Axes.X))
|
||||
Body.AutoSizeAxes &= ~Axes.X;
|
||||
|
||||
Body.Width = value;
|
||||
@@ -197,7 +196,7 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
get => Body.Height;
|
||||
set
|
||||
{
|
||||
if (Body.AutoSizeAxes.HasFlagFast(Axes.Y))
|
||||
if (Body.AutoSizeAxes.HasFlag(Axes.Y))
|
||||
Body.AutoSizeAxes &= ~Axes.Y;
|
||||
|
||||
Body.Height = value;
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
@@ -172,8 +171,8 @@ namespace osu.Framework.Graphics.UserInterface
|
||||
|
||||
AddInternal(Dropdown);
|
||||
|
||||
Trace.Assert(Dropdown.Header.Anchor.HasFlagFast(Anchor.x2), $@"The {nameof(Dropdown)} implementation should use a right-based anchor inside a TabControl.");
|
||||
Trace.Assert(!Dropdown.Header.RelativeSizeAxes.HasFlagFast(Axes.X), $@"The {nameof(Dropdown)} implementation's header should have a specific size.");
|
||||
Trace.Assert(Dropdown.Header.Anchor.HasFlag(Anchor.x2), $@"The {nameof(Dropdown)} implementation should use a right-based anchor inside a TabControl.");
|
||||
Trace.Assert(!Dropdown.Header.RelativeSizeAxes.HasFlag(Axes.X), $@"The {nameof(Dropdown)} implementation's header should have a specific size.");
|
||||
}
|
||||
|
||||
AddInternal(TabContainer = CreateTabFlow());
|
||||
|
||||
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
@@ -106,10 +105,10 @@ namespace osu.Framework.Graphics.Veldrid
|
||||
{
|
||||
ColorWriteMask writeMask = ColorWriteMask.None;
|
||||
|
||||
if (mask.HasFlagFast(BlendingMask.Red)) writeMask |= ColorWriteMask.Red;
|
||||
if (mask.HasFlagFast(BlendingMask.Green)) writeMask |= ColorWriteMask.Green;
|
||||
if (mask.HasFlagFast(BlendingMask.Blue)) writeMask |= ColorWriteMask.Blue;
|
||||
if (mask.HasFlagFast(BlendingMask.Alpha)) writeMask |= ColorWriteMask.Alpha;
|
||||
if (mask.HasFlag(BlendingMask.Red)) writeMask |= ColorWriteMask.Red;
|
||||
if (mask.HasFlag(BlendingMask.Green)) writeMask |= ColorWriteMask.Green;
|
||||
if (mask.HasFlag(BlendingMask.Blue)) writeMask |= ColorWriteMask.Blue;
|
||||
if (mask.HasFlag(BlendingMask.Alpha)) writeMask |= ColorWriteMask.Alpha;
|
||||
|
||||
return writeMask;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
@@ -796,7 +795,7 @@ namespace osu.Framework.Graphics.Video
|
||||
{
|
||||
var hwVideoDecoder = hwDeviceType.ToHardwareVideoDecoder();
|
||||
|
||||
if (!hwVideoDecoder.HasValue || !targetHwDecoders.HasFlagFast(hwVideoDecoder.Value))
|
||||
if (!hwVideoDecoder.HasValue || !targetHwDecoders.HasFlag(hwVideoDecoder.Value))
|
||||
continue;
|
||||
|
||||
codecs.Add((codec, hwDeviceType));
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Input.StateChanges;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Statistics;
|
||||
@@ -58,7 +57,7 @@ namespace osu.Framework.Input.Handlers.Mouse
|
||||
/// <summary>
|
||||
/// Whether the application should be handling the cursor.
|
||||
/// </summary>
|
||||
private bool cursorCaptured => isActive.Value && (window.CursorInWindow.Value || window.CursorState.HasFlagFast(CursorState.Confined));
|
||||
private bool cursorCaptured => isActive.Value && (window.CursorInWindow.Value || window.CursorState.HasFlag(CursorState.Confined));
|
||||
|
||||
/// <summary>
|
||||
/// Whether the last position (as reported by <see cref="FeedbackMousePositionChange"/>)
|
||||
@@ -164,7 +163,7 @@ namespace osu.Framework.Input.Handlers.Mouse
|
||||
|
||||
// handle the case where relative / raw input is active, but the cursor may have exited the window
|
||||
// bounds and is not intended to be confined.
|
||||
if (!window.CursorState.HasFlagFast(CursorState.Confined) && positionOutsideWindow && !previousPositionOutsideWindow)
|
||||
if (!window.CursorState.HasFlag(CursorState.Confined) && positionOutsideWindow && !previousPositionOutsideWindow)
|
||||
{
|
||||
// setting relative mode to false will allow the window manager to take control until the next
|
||||
// updateRelativeMode() call succeeds (likely from the cursor returning inside the window).
|
||||
@@ -194,7 +193,7 @@ namespace osu.Framework.Input.Handlers.Mouse
|
||||
// relative mode only works when the window is active and the cursor is contained. aka the OS cursor isn't being displayed outside the window.
|
||||
&& cursorCaptured
|
||||
// relative mode shouldn't ever be enabled if the framework or a consumer has chosen not to hide the cursor.
|
||||
&& window.CursorState.HasFlagFast(CursorState.Hidden);
|
||||
&& window.CursorState.HasFlag(CursorState.Hidden);
|
||||
|
||||
if (!window.RelativeMouseMode)
|
||||
transferLastPositionToHostCursor();
|
||||
|
||||
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
@@ -211,7 +210,7 @@ namespace osu.Framework.Input
|
||||
|
||||
private void draggedDrawableInvalidated(Drawable drawable, Invalidation invalidation)
|
||||
{
|
||||
if (invalidation.HasFlagFast(Invalidation.Parent))
|
||||
if (invalidation.HasFlag(Invalidation.Parent))
|
||||
{
|
||||
// end drag if no longer rooted.
|
||||
if (!drawable.IsRootedAt(InputManager))
|
||||
|
||||
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Immutable;
|
||||
using System.Drawing;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Input.Handlers;
|
||||
using osu.Framework.Input.StateChanges;
|
||||
using osu.Framework.Input.StateChanges.Events;
|
||||
@@ -45,7 +44,7 @@ namespace osu.Framework.Input
|
||||
var clientSize = Host.Window.ClientSize;
|
||||
var windowRect = new RectangleF(0, 0, clientSize.Width, clientSize.Height);
|
||||
|
||||
if (Host.Window.CursorState.HasFlagFast(CursorState.Confined))
|
||||
if (Host.Window.CursorState.HasFlag(CursorState.Confined))
|
||||
{
|
||||
cursorConfineRect = Host.Window.CursorConfineRect ?? windowRect;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
@@ -21,7 +20,7 @@ namespace osu.Framework.Platform.SDL2
|
||||
{
|
||||
// Apple devices don't have the notion of NumLock (they have a Clear key instead).
|
||||
// treat them as if they always have NumLock on (the numpad always performs its primary actions).
|
||||
bool numLockOn = sdlKeysym.mod.HasFlagFast(SDL_Keymod.KMOD_NUM) || RuntimeInfo.IsApple;
|
||||
bool numLockOn = sdlKeysym.mod.HasFlag(SDL_Keymod.KMOD_NUM) || RuntimeInfo.IsApple;
|
||||
|
||||
switch (sdlKeysym.scancode)
|
||||
{
|
||||
@@ -864,17 +863,17 @@ namespace osu.Framework.Platform.SDL2
|
||||
|
||||
public static WindowState ToWindowState(this SDL_WindowFlags windowFlags)
|
||||
{
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP) ||
|
||||
windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_BORDERLESS))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP) ||
|
||||
windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_BORDERLESS))
|
||||
return WindowState.FullscreenBorderless;
|
||||
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
return WindowState.Minimised;
|
||||
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_FULLSCREEN))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_FULLSCREEN))
|
||||
return WindowState.Fullscreen;
|
||||
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_MAXIMIZED))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_MAXIMIZED))
|
||||
return WindowState.Maximised;
|
||||
|
||||
return WindowState.Normal;
|
||||
|
||||
@@ -8,7 +8,6 @@ using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Extensions.ImageExtensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Threading;
|
||||
@@ -163,7 +162,7 @@ namespace osu.Framework.Platform.SDL2
|
||||
return wmInfo;
|
||||
}
|
||||
|
||||
public bool CapsLockPressed => SDL_GetModState().HasFlagFast(SDL_Keymod.KMOD_CAPS);
|
||||
public bool CapsLockPressed => SDL_GetModState().HasFlag(SDL_Keymod.KMOD_CAPS);
|
||||
|
||||
// references must be kept to avoid GC, see https://stackoverflow.com/a/6193914
|
||||
|
||||
@@ -204,7 +203,7 @@ namespace osu.Framework.Platform.SDL2
|
||||
|
||||
CursorStateBindable.ValueChanged += evt =>
|
||||
{
|
||||
updateCursorVisibility(!evt.NewValue.HasFlagFast(CursorState.Hidden));
|
||||
updateCursorVisibility(!evt.NewValue.HasFlag(CursorState.Hidden));
|
||||
updateCursorConfinement();
|
||||
};
|
||||
|
||||
@@ -407,7 +406,7 @@ namespace osu.Framework.Platform.SDL2
|
||||
{
|
||||
var flags = (SDL_WindowFlags)SDL_GetWindowFlags(SDLWindowHandle);
|
||||
|
||||
if (flags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
if (flags.HasFlag(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
SDL_RestoreWindow(SDLWindowHandle);
|
||||
|
||||
SDL_RaiseWindow(SDLWindowHandle);
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.States;
|
||||
@@ -44,7 +43,7 @@ namespace osu.Framework.Platform.SDL2
|
||||
if (relativeMouseMode == value)
|
||||
return;
|
||||
|
||||
if (value && !CursorState.HasFlagFast(CursorState.Hidden))
|
||||
if (value && !CursorState.HasFlag(CursorState.Hidden))
|
||||
throw new InvalidOperationException($"Cannot set {nameof(RelativeMouseMode)} to true when the cursor is not hidden via {nameof(CursorState)}.");
|
||||
|
||||
relativeMouseMode = value;
|
||||
@@ -102,7 +101,7 @@ namespace osu.Framework.Platform.SDL2
|
||||
/// </summary>
|
||||
private void updateCursorConfinement()
|
||||
{
|
||||
bool confined = CursorState.HasFlagFast(CursorState.Confined);
|
||||
bool confined = CursorState.HasFlag(CursorState.Confined);
|
||||
|
||||
ScheduleCommand(() => SDL_SetWindowGrab(SDLWindowHandle, confined ? SDL_bool.SDL_TRUE : SDL_bool.SDL_FALSE));
|
||||
|
||||
@@ -164,11 +163,11 @@ namespace osu.Framework.Platform.SDL2
|
||||
// the outer if just optimises for the common case that there are no buttons to release.
|
||||
if (buttonsToRelease != SDLButtonMask.None)
|
||||
{
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.Left)) MouseUp?.Invoke(MouseButton.Left);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.Middle)) MouseUp?.Invoke(MouseButton.Middle);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.Right)) MouseUp?.Invoke(MouseButton.Right);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.X1)) MouseUp?.Invoke(MouseButton.Button1);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.X2)) MouseUp?.Invoke(MouseButton.Button2);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.Left)) MouseUp?.Invoke(MouseButton.Left);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.Middle)) MouseUp?.Invoke(MouseButton.Middle);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.Right)) MouseUp?.Invoke(MouseButton.Right);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.X1)) MouseUp?.Invoke(MouseButton.Button1);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.X2)) MouseUp?.Invoke(MouseButton.Button2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Drawing;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
@@ -19,7 +18,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
{
|
||||
// Apple devices don't have the notion of NumLock (they have a Clear key instead).
|
||||
// treat them as if they always have NumLock on (the numpad always performs its primary actions).
|
||||
bool numLockOn = sdlKeysym.mod.HasFlagFast(SDL_Keymod.SDL_KMOD_NUM) || RuntimeInfo.IsApple;
|
||||
bool numLockOn = sdlKeysym.mod.HasFlag(SDL_Keymod.SDL_KMOD_NUM) || RuntimeInfo.IsApple;
|
||||
|
||||
switch (sdlKeysym.scancode)
|
||||
{
|
||||
@@ -865,16 +864,16 @@ namespace osu.Framework.Platform.SDL3
|
||||
|
||||
public static WindowState ToWindowState(this SDL_WindowFlags windowFlags)
|
||||
{
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_BORDERLESS))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_BORDERLESS))
|
||||
return WindowState.FullscreenBorderless;
|
||||
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
return WindowState.Minimised;
|
||||
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_FULLSCREEN))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_FULLSCREEN))
|
||||
return WindowState.Fullscreen;
|
||||
|
||||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_MAXIMIZED))
|
||||
if (windowFlags.HasFlag(SDL_WindowFlags.SDL_WINDOW_MAXIMIZED))
|
||||
return WindowState.Maximised;
|
||||
|
||||
return WindowState.Normal;
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.Runtime.Versioning;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Extensions.ImageExtensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Threading;
|
||||
@@ -143,7 +142,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
[SupportedOSPlatform("android")]
|
||||
public virtual IntPtr SurfaceHandle => throw new PlatformNotSupportedException();
|
||||
|
||||
public bool CapsLockPressed => SDL_GetModState().HasFlagFast(SDL_Keymod.SDL_KMOD_CAPS);
|
||||
public bool CapsLockPressed => SDL_GetModState().HasFlag(SDL_Keymod.SDL_KMOD_CAPS);
|
||||
|
||||
/// <summary>
|
||||
/// Represents a handle to this <see cref="SDL3Window"/> instance, used for unmanaged callbacks.
|
||||
@@ -174,7 +173,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
|
||||
CursorStateBindable.ValueChanged += evt =>
|
||||
{
|
||||
updateCursorVisibility(!evt.NewValue.HasFlagFast(CursorState.Hidden));
|
||||
updateCursorVisibility(!evt.NewValue.HasFlag(CursorState.Hidden));
|
||||
updateCursorConfinement();
|
||||
};
|
||||
|
||||
@@ -374,7 +373,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
{
|
||||
var flags = SDL_GetWindowFlags(SDLWindowHandle);
|
||||
|
||||
if (flags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
if (flags.HasFlag(SDL_WindowFlags.SDL_WINDOW_MINIMIZED))
|
||||
SDL_RestoreWindow(SDLWindowHandle);
|
||||
|
||||
SDL_RaiseWindow(SDLWindowHandle);
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.States;
|
||||
@@ -45,7 +44,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
if (relativeMouseMode == value)
|
||||
return;
|
||||
|
||||
if (value && !CursorState.HasFlagFast(CursorState.Hidden))
|
||||
if (value && !CursorState.HasFlag(CursorState.Hidden))
|
||||
throw new InvalidOperationException($"Cannot set {nameof(RelativeMouseMode)} to true when the cursor is not hidden via {nameof(CursorState)}.");
|
||||
|
||||
relativeMouseMode = value;
|
||||
@@ -109,7 +108,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
/// </summary>
|
||||
private unsafe void updateCursorConfinement()
|
||||
{
|
||||
bool confined = CursorState.HasFlagFast(CursorState.Confined);
|
||||
bool confined = CursorState.HasFlag(CursorState.Confined);
|
||||
|
||||
ScheduleCommand(() => SDL_SetWindowMouseGrab(SDLWindowHandle, confined ? SDL_bool.SDL_TRUE : SDL_bool.SDL_FALSE));
|
||||
|
||||
@@ -175,11 +174,11 @@ namespace osu.Framework.Platform.SDL3
|
||||
// the outer if just optimises for the common case that there are no buttons to release.
|
||||
if (buttonsToRelease != 0)
|
||||
{
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.SDL_BUTTON_LMASK)) MouseUp?.Invoke(MouseButton.Left);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.SDL_BUTTON_MMASK)) MouseUp?.Invoke(MouseButton.Middle);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.SDL_BUTTON_RMASK)) MouseUp?.Invoke(MouseButton.Right);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.SDL_BUTTON_X1MASK)) MouseUp?.Invoke(MouseButton.Button1);
|
||||
if (buttonsToRelease.HasFlagFast(SDLButtonMask.SDL_BUTTON_X2MASK)) MouseUp?.Invoke(MouseButton.Button2);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.SDL_BUTTON_LMASK)) MouseUp?.Invoke(MouseButton.Left);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.SDL_BUTTON_MMASK)) MouseUp?.Invoke(MouseButton.Middle);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.SDL_BUTTON_RMASK)) MouseUp?.Invoke(MouseButton.Right);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.SDL_BUTTON_X1MASK)) MouseUp?.Invoke(MouseButton.Button1);
|
||||
if (buttonsToRelease.HasFlag(SDLButtonMask.SDL_BUTTON_X2MASK)) MouseUp?.Invoke(MouseButton.Button2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
|
||||
namespace osu.Framework.Platform.Windows.Native
|
||||
{
|
||||
@@ -140,7 +139,7 @@ namespace osu.Framework.Platform.Windows.Native
|
||||
{
|
||||
size = -1;
|
||||
|
||||
if (!lParam.HasFlagFast(compositionString))
|
||||
if (!lParam.HasFlag(compositionString))
|
||||
return false;
|
||||
|
||||
size = ImmGetCompositionString(handle, compositionString, null, 0);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Input.StateChanges;
|
||||
using osu.Framework.Platform.Windows.Native;
|
||||
using osu.Framework.Statistics;
|
||||
@@ -92,9 +91,9 @@ namespace osu.Framework.Platform.Windows
|
||||
var position = new Vector2(mouse.LastX, mouse.LastY);
|
||||
float sensitivity = (float)Sensitivity.Value;
|
||||
|
||||
if (mouse.Flags.HasFlagFast(RawMouseFlags.MoveAbsolute))
|
||||
if (mouse.Flags.HasFlag(RawMouseFlags.MoveAbsolute))
|
||||
{
|
||||
var screenRect = mouse.Flags.HasFlagFast(RawMouseFlags.VirtualDesktop) ? Native.Input.VirtualScreenRect : new Rectangle(window.Position, window.ClientSize);
|
||||
var screenRect = mouse.Flags.HasFlag(RawMouseFlags.VirtualDesktop) ? Native.Input.VirtualScreenRect : new Rectangle(window.Position, window.ClientSize);
|
||||
|
||||
Vector2 screenSize = new Vector2(screenRect.Width, screenRect.Height);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user