Skip to content

Commit

Permalink
Fix multi-monitor window centering
Browse files Browse the repository at this point in the history
  • Loading branch information
Speak2Erase committed Jul 5, 2024
1 parent 23c151b commit cf71fdd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/eventthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,16 @@ void EventThread::process(RGSSThreadData &rtData)
rtData.rqWindowAdjust.clear();
break;

case REQUEST_WINCENTER :
rc = SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(win), &dm);
if (!rc)
SDL_SetWindowPosition(win,
(dm.w / 2) - (winW / 2),
(dm.h / 2) - (winH / 2));
rtData.rqWindowAdjust.clear();
case REQUEST_WINCENTER : {
rc = SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(win), &dm);
SDL_Rect rect;
SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(win), &rect);
if (!rc)
SDL_SetWindowPosition(win,
rect.x + (dm.w / 2) - (winW / 2),
rect.y + (dm.h / 2) - (winH / 2));
rtData.rqWindowAdjust.clear();
}
break;

case REQUEST_WINRENAME :
Expand Down

0 comments on commit cf71fdd

Please sign in to comment.