internal static bool WindowIsFullscreenOnDisplay(EditorWindow editorWindow, string windowTitle, SystemDisplay display) { EWFDebugging.StartTimer("WindowIsFullscreenOnDisplay"); EWFDebugging.Log("Checking if window is fullscreen on display. " + (editorWindow == null ? "WindowTitle: " + (windowTitle == null ? "null" : windowTitle) : "EditorWindow: " + editorWindow.GetWindowTitle() + " Identifier: " + editorWindow.GetIdentifierTitle()) + "\n"); IntPtr windowHandle = GetProcessWindow(null, editorWindow); LogWin32Error("Error getting window handle."); if (windowHandle == IntPtr.Zero) { EWFDebugging.Log("Couldn't find window handle. Zero pointer.\n"); return(false); } Rect winPhysBounds = GetWindowPhysicalBounds(windowHandle); Rect displayPhysBounds = display.PhysicalBounds; float padding = 1; winPhysBounds.xMin -= padding; winPhysBounds.xMax += padding; winPhysBounds.yMin -= padding; winPhysBounds.yMax += padding; EWFDebugging.LogTime("WindowIsFullscreenOnDisplay", false); return(winPhysBounds.Contains(displayPhysBounds)); }
internal static Rect GetWindowPhysicalBounds(EditorWindow editorWindow) { EWFDebugging.Log("Getting editor window physical bounds. " + "EditorWindow: " + editorWindow.GetWindowTitle()); IntPtr windowHandle = GetProcessWindow(null, editorWindow); Rect winPhysBounds = GetWindowPhysicalBounds(windowHandle); return(winPhysBounds); }