REVIEWED: GetCurrentMonitor()
#3472
This commit is contained in:
parent
01c264123d
commit
b4865588f8
1 changed files with 12 additions and 19 deletions
|
@ -751,6 +751,11 @@ int GetCurrentMonitor(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
// In case the window is between two monitors, we use below logic
|
||||
// to try to detect the "current monitor" for that window, note that
|
||||
// this is probably an overengineered solution for a very side case
|
||||
// trying to match SDL behaviour
|
||||
|
||||
int closestDist = 0x7FFFFFFF;
|
||||
|
||||
// Window center position
|
||||
|
@ -786,24 +791,12 @@ int GetCurrentMonitor(void)
|
|||
}
|
||||
|
||||
int xclosest = wcx;
|
||||
if (wcx < mx)
|
||||
{
|
||||
xclosest = mx;
|
||||
}
|
||||
else if (wcx > right)
|
||||
{
|
||||
xclosest = right;
|
||||
}
|
||||
if (wcx < mx) xclosest = mx;
|
||||
else if (wcx > right) xclosest = right;
|
||||
|
||||
int yclosest = wcy;
|
||||
if (wcy < my)
|
||||
{
|
||||
yclosest = my;
|
||||
}
|
||||
else if (wcy > bottom)
|
||||
{
|
||||
yclosest = bottom;
|
||||
}
|
||||
if (wcy < my) yclosest = my;
|
||||
else if (wcy > bottom) yclosest = bottom;
|
||||
|
||||
int dx = wcx - xclosest;
|
||||
int dy = wcy - yclosest;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue