Exemple #1
0
        /// <summary>
        /// Returns a rect covering all the screen, except for the taskbar.
        /// This is the Rect that works best with Mac OS X, although the dock must be set to auto hide for it to work.
        /// </summary>
        /// <param name="window">The window that will be used as reference for calulating border error.</param>
        /// <param name="mouseScreen">Should we get the rect on the screen where the mouse pointer is?</param>
        public static Rect GetWorkAreaRect(Object window, bool mouseScreen)
        {
            if (!window)
            {
                return(GetWorkAreaRect(mouseScreen));
            }

            if (window is EditorWindow)
            {
                window = window.GetFieldValue <Object>("m_Parent").GetPropertyValue <Object>("window");
            }

            return(window.InvokeMethod <Rect>("FitWindowRectToScreen", new Rect(Vector2.zero, Vector2.one * 100000f), true, mouseScreen));
        }