Skip to content

Commit

Permalink
Merge pull request #9 from Stack-of-Pancakes/patch-1
Browse files Browse the repository at this point in the history
Fullscreen'd to wrong monitor
  • Loading branch information
Andrew Sampson committed Jan 14, 2014
2 parents e4d0371 + 4bcd5fa commit af52d8a
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 af52d8a

Please sign in to comment.