Use SDL_WINDOWPOS_CENTERED_DISPLAY() to fix incorrect positioning on multi-display system on macOS
This commit is contained in:
parent
3bfe87d516
commit
587d783955
1 changed files with 2 additions and 6 deletions
|
|
@ -581,16 +581,11 @@ void Session::getWindowDimensions(int& x, int& y,
|
||||||
if (SDL_GetDisplayUsableBounds(displayIndex, &usableBounds) == 0) {
|
if (SDL_GetDisplayUsableBounds(displayIndex, &usableBounds) == 0) {
|
||||||
width = usableBounds.w;
|
width = usableBounds.w;
|
||||||
height = usableBounds.h;
|
height = usableBounds.h;
|
||||||
x = usableBounds.x;
|
|
||||||
y = usableBounds.y;
|
|
||||||
|
|
||||||
if (m_Window != nullptr) {
|
if (m_Window != nullptr) {
|
||||||
int top, left, bottom, right;
|
int top, left, bottom, right;
|
||||||
|
|
||||||
if (SDL_GetWindowBordersSize(m_Window, &top, &left, &bottom, &right) == 0) {
|
if (SDL_GetWindowBordersSize(m_Window, &top, &left, &bottom, &right) == 0) {
|
||||||
x += left;
|
|
||||||
y += top;
|
|
||||||
|
|
||||||
width -= left + right;
|
width -= left + right;
|
||||||
height -= top + bottom;
|
height -= top + bottom;
|
||||||
}
|
}
|
||||||
|
|
@ -615,8 +610,9 @@ void Session::getWindowDimensions(int& x, int& y,
|
||||||
|
|
||||||
width = m_StreamConfig.width;
|
width = m_StreamConfig.width;
|
||||||
height = m_StreamConfig.height;
|
height = m_StreamConfig.height;
|
||||||
x = y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x = y = SDL_WINDOWPOS_CENTERED_DISPLAY(displayIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::updateOptimalWindowDisplayMode()
|
void Session::updateOptimalWindowDisplayMode()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue