Skip to content

Commit

Permalink
Multi monitor support
Browse files Browse the repository at this point in the history
Was testing this and it took my game from my larger monitor that I play on and moved it to my primary monitor.  This change checks the monitor that the game is currently running on and fullscreens it there instead of defaulting to 0,0 which is top left of the system's primary monitor.
  • Loading branch information
Stack-of-Pancakes committed Jan 13, 2014
1 parent c505384 commit 4bcd5fa
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Borderless.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,20 @@ private void RemoveBorder(String procName) //actually make it frameless
| WindowStyleFlags.ExtendedComposited)));


var bounds = Screen.PrimaryScreen.Bounds;
//Get the screen bounds from the screen the window is currently active on.
//If on multiple screens it will grab bounds from the screen it is most on.
//If not on any screen it grabs bounds from the screen closest
var bounds = Screen.FromHandle(pFoundWindow).Bounds;

if (!_borderlessWindows.Contains(pFoundWindow.ToInt32().ToString()))
{
Native.SetWindowPos(pFoundWindow, 0, 0, 0, bounds.Width, bounds.Height,
SWP_NOZORDER | SWP_SHOWWINDOW);
//Using bounds.X and bounds.Y instead of 0, 0 so it will orient the window
//on the screen it is currently occupying instead of using the primary screen
Native.SetWindowPos(pFoundWindow, 0, bounds.X, bounds.Y, bounds.Width, bounds.Height, SWP_NOZORDER | SWP_SHOWWINDOW);
_borderlessWindows.Add(pFoundWindow.ToInt32().ToString());
} //today I learn the definition of a hot fix



//no more outside window
// CheckNativeResult(() => Native.MoveWindow(pFoundWindow, 0, 0, bounds.Width, bounds.Height, true));
//resets window to main monito
Expand Down Expand Up @@ -326,4 +332,4 @@ private void TrayIconExit(object sender, EventArgs e)
Environment.Exit(0);
}
}
}
}

0 comments on commit 4bcd5fa

Please sign in to comment.