private static void GetSystemExtImpl(IntPtr nativeDisplay, out int w, out int h)
        {
            var manager = instance;

            if (manager.m_mode == DisplayAPIControlMode.FromEditor)
            {
                var view = manager.m_views[(int)nativeDisplay];

                if (view == null)
                {
                    w = 0;
                    h = 0;
                }
                else
                {
                    w = (int)view.position.width;
                    h = (int)view.position.height;
                }
            }
            else
            {
                w = (int)EditorDisplayUtility.GetDisplayWidth((int)nativeDisplay);
                h = (int)EditorDisplayUtility.GetDisplayHeight((int)nativeDisplay);
            }
        }
        private static void GetRenderingExtImpl(IntPtr nativeDisplay, out int w, out int h)
        {
            var manager = instance;

            if (manager.m_mode == DisplayAPIControlMode.FromEditor)
            {
                var view = manager.m_views[(int)nativeDisplay];

                if (view == null)
                {
                    w = 0;
                    h = 0;
                }
                else
                {
                    w = (int)view.targetSize.x;
                    h = (int)view.targetSize.y;
                }
            }
            else
            {
                w = (int)EditorDisplayUtility.GetDisplayWidth((int)nativeDisplay);
                h = (int)EditorDisplayUtility.GetDisplayHeight((int)nativeDisplay);
            }
        }
        private void UpdateAssociatedPlayModeView()
        {
            for (var i = 0; i < m_maxDisplays; ++i)
            {
                var view = PlayModeView.GetAssociatedViewForTargetDisplay(i);
                if (m_views[i] == view)
                {
                    continue;
                }

                m_views[i] = view;
                if (view != null)
                {
                    EditorDisplayUtility.AddVirtualDisplay(i, (int)view.targetSize.x, (int)view.targetSize.y);
                }
                else
                {
                    EditorDisplayUtility.RemoveVirtualDisplay(i);
                }
            }

            UpdateDisplayList(false);
        }
        private void UpdateDisplayList(bool recreate)
        {
            recreate |= m_mode != EditorFullscreenController.DisplayAPIMode;
            m_mode    = EditorFullscreenController.DisplayAPIMode;

            if (EditorFullscreenController.DisplayAPIMode == DisplayAPIControlMode.FromEditor)
            {
                var previousDisplayCount = m_displayCount;
                for (var i = m_maxDisplays - 1; i >= 0; --i)
                {
                    if (m_views[i] != null)
                    {
                        m_displayCount = i + 1;
                        recreate      |= m_displayCount != previousDisplayCount;
                        break;
                    }
                }
            }
            else
            {
                var nDisplays = EditorDisplayUtility.GetNumberOfConnectedDisplays();
                recreate      |= m_displayCount != nDisplays;
                m_displayCount = nDisplays;
            }

            if (recreate)
            {
                var displayList = new IntPtr[m_displayCount];
                for (var i = 0; i < m_displayCount; ++i)
                {
                    displayList[i] = new IntPtr(i);
                }

                Display.RecreateDisplayList(displayList);
            }
        }