Support capturing rotated displays on Windows (#1602)

This commit is contained in:
ns6089
2023-09-13 17:34:26 +03:00
committed by GitHub
parent 9dc76e3748
commit e98d7577bb
7 changed files with 222 additions and 54 deletions

View File

@@ -461,6 +461,17 @@ namespace platf::dxgi {
width = desc.DesktopCoordinates.right - offset_x;
height = desc.DesktopCoordinates.bottom - offset_y;
display_rotation = desc.Rotation;
if (display_rotation == DXGI_MODE_ROTATION_ROTATE90 ||
display_rotation == DXGI_MODE_ROTATION_ROTATE270) {
width_before_rotation = height;
height_before_rotation = width;
}
else {
width_before_rotation = width;
height_before_rotation = height;
}
// left and bottom may be negative, yet absolute mouse coordinates start at 0x0
// Ensure offset starts at 0x0
offset_x -= GetSystemMetrics(SM_XVIRTUALSCREEN);