Windows 8: fix for capturing when a fullscreen app is visible, this didn't go away, when having multiple monitors.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2456 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-02-03 16:26:04 +00:00
parent 7ba6a57b4a
commit 141da5e724
2 changed files with 40 additions and 17 deletions

View file

@ -639,18 +639,6 @@ namespace GreenshotPlugin.Core {
/// Gets/Sets whether the window is maximised or not.
/// </summary>
public bool Maximised {
get {
return User32.IsZoomed(this.hWnd);
}
set {
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero);
}
}
/// <summary>
/// Gets whether the window is visible.
/// </summary>
public bool Visible {
get {
if (isApp) {
Rectangle windowRectangle = WindowRectangle;
@ -670,14 +658,42 @@ namespace GreenshotPlugin.Core {
}
}
}
} else {
// Not Fullscreen -> Than it's visible!
return true;
}
}
}
return false;
}
return User32.IsZoomed(this.hWnd);
}
set {
if (value) {
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero);
} else {
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
}
}
}
/// <summary>
/// This doesn't work as good as is should, but does move the App out of the way...
/// </summary>
public void HideApp() {
User32.ShowWindow(Handle, ShowWindowCommand.Hide);
}
/// <summary>
/// Gets whether the window is visible.
/// </summary>
public bool Visible {
get {
if (isApp) {
Rectangle windowRectangle = WindowRectangle;
foreach (Screen screen in Screen.AllScreens) {
if (screen.Bounds.Contains(windowRectangle)) {
return true;
}
}
}
if (isAppLauncher) {
return IsAppLauncherVisible;
}
@ -744,7 +760,7 @@ namespace GreenshotPlugin.Core {
GetWindowRect(out windowRect);
}
if (!HasParent && this.Maximised) {
if (!HasParent && (!isApp && Maximised)) {
Size size = Size.Empty;
GetBorderSize(out size);
windowRect = new Rectangle(windowRect.X + size.Width, windowRect.Y + size.Height, windowRect.Width - (2 * size.Width), windowRect.Height - (2 * size.Height));
@ -1656,7 +1672,7 @@ namespace GreenshotPlugin.Core {
/// </summary>
/// <returns></returns>
public static WindowDetails GetAppLauncher() {
IntPtr appLauncher = User32.FindWindow("ImmersiveLauncher", null);
IntPtr appLauncher = User32.FindWindow(METRO_APPLAUNCHER_CLASS, null);
if (appLauncher != IntPtr.Zero) {
return new WindowDetails (appLauncher);
}