internal static bool IsRectModeSupported(RectSourceMode mode) { switch (mode) { case RectSourceMode.Display1: case RectSourceMode.Display2: case RectSourceMode.Display3: case RectSourceMode.Display4: case RectSourceMode.Display5: case RectSourceMode.Display6: case RectSourceMode.Display7: case RectSourceMode.Display8: case RectSourceMode.Span: case RectSourceMode.WindowDisplay: return(FullscreenUtility.IsWindows); case RectSourceMode.MainDisplay: case RectSourceMode.AtMousePosition: return(true); case RectSourceMode.Custom: // Custom rect is not supported on Linux // since we're using native fullscreen return(!FullscreenUtility.IsLinux); default: return(false); } }
/// <summary>Returns a fullscreen rect</summary> /// <param name="mode">The mode that will be used to retrieve the rect.</param> /// <param name="targetWindow">The window that will be set fullscreen.</param> public static Rect GetFullscreenRect(RectSourceMode mode, ScriptableObject targetWindow = null) { if (targetWindow != null && !targetWindow.IsOfType(typeof(EditorWindow)) && !targetWindow.IsOfType(Types.View)) { throw new ArgumentException("Target window must be of type EditorWindow or View or null", "targetWindow"); } if (CustomRectCallback != null) { var rect = new Rect(); var shouldUse = CustomRectCallback(mode, out rect); if (shouldUse) { return(rect); } } switch (mode) { case RectSourceMode.MainDisplay: return(GetMainDisplayRect()); case RectSourceMode.WindowDisplay: if (targetWindow == null || !FullscreenUtility.IsWindows) { return(GetMainDisplayRect()); } var views = new ViewPyramid(targetWindow); var rect = views.Container.GetPropertyValue <Rect>("position"); return(GetDisplayBoundsAtPoint(rect.center)); case RectSourceMode.AtMousePosition: return(FullscreenUtility.IsWindows ? GetDisplayBoundsAtPoint(FullscreenUtility.MousePosition) : GetWorkAreaRect(true)); case RectSourceMode.Span: return(FullscreenUtility.IsWindows ? GetVirtualScreenBounds() : GetWorkAreaRect(true)); case RectSourceMode.Custom: return(GetCustomUserRect()); default: Logger.Warning("Invalid fullscreen mode, please fix this by changing the rect source mode in preferences."); return(new Rect(Vector2.zero, Vector2.one * 300f)); } }
internal static bool IsRectModeSupported(RectSourceMode mode) { switch (mode) { case RectSourceMode.Span: case RectSourceMode.WindowDisplay: return(FullscreenUtility.IsWindows); case RectSourceMode.Custom: case RectSourceMode.MainDisplay: case RectSourceMode.AtMousePosition: return(true); default: return(false); } }
internal static bool IsRectModeSupported(RectSourceMode mode) { switch (mode) { case RectSourceMode.VirtualSpace: case RectSourceMode.AtMousePosition: return(WindowsEditor); case RectSourceMode.CustomRect: case RectSourceMode.PrimaryScreen: case RectSourceMode.WorkArea: return(WindowsEditor || OSXEditor || LinuxEditor); default: return(false); } }