Fix an issue where EditorWindowCapture workspaces would resize their content on hover if the window opens on a monitor with DPI scaling that does not match the main monitor
Testing status
Tested on my work machine which has one monitor at 100% and the main at 150%. The content does not appear correctly if you move the window, but I was unable to find a workaround for that.
Technical risk
Low--minor change that affects only EditorWindowCapture workspaces
Comments to reviewers
This was tricky. It appears that anytime the window gets an event, it changes the global DPI scale factor, which causes EditorGUIUtility.PointsToPixels to return a different result. I couldn't find a way to get the specific window's DPI, and didn't want to go too deep down this rabbit hole. This solution works as long as you don't move the 2D window, which is unlikely to happen. These Capture Windows also don't gracefully handle window resizing, which would be an improvement worth considering, at which point we could revisit handling DPI dynamically.
Purpose of this PR
Fix an issue where EditorWindowCapture workspaces would resize their content on hover if the window opens on a monitor with DPI scaling that does not match the main monitor
Testing status
Tested on my work machine which has one monitor at 100% and the main at 150%. The content does not appear correctly if you move the window, but I was unable to find a workaround for that.
Technical risk
Low--minor change that affects only EditorWindowCapture workspaces
Comments to reviewers
This was tricky. It appears that anytime the window gets an event, it changes the global DPI scale factor, which causes
EditorGUIUtility.PointsToPixels
to return a different result. I couldn't find a way to get the specific window's DPI, and didn't want to go too deep down this rabbit hole. This solution works as long as you don't move the 2D window, which is unlikely to happen. These Capture Windows also don't gracefully handle window resizing, which would be an improvement worth considering, at which point we could revisit handling DPI dynamically.