Skip to content

Commit

Permalink
Fixes bug HearthSim#1191 (overlay window appearing in alt-tab switcher)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpedigo committed Aug 20, 2015
1 parent 84f2fae commit 27f1222
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Hearthstone Deck Tracker/Utility/User32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public enum MouseEventFlags : uint
Wheel = 0x00000800
}

private const int WsExTransparent = 0x00000020;
public const int WsExTransparent = 0x00000020;
public const int WsExToolWindow = 0x00000080;
private const int GwlExstyle = (-20);
public const int SwRestore = 9;
private static DateTime _lastCheck;
Expand Down Expand Up @@ -66,10 +67,10 @@ public enum MouseEventFlags : uint
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

public static void SetWindowExTransparent(IntPtr hwnd)
public static void SetWindowExStyle(IntPtr hwnd, int style)
{
var extendedStyle = GetWindowLong(hwnd, GwlExstyle);
SetWindowLong(hwnd, GwlExstyle, extendedStyle | WsExTransparent);
SetWindowLong(hwnd, GwlExstyle, extendedStyle | style);
}

public static bool IsHearthstoneInForeground()
Expand Down
2 changes: 1 addition & 1 deletion Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private void ReSizePosLists()
private void Window_SourceInitialized_1(object sender, EventArgs e)
{
var hwnd = new WindowInteropHelper(this).Handle;
User32.SetWindowExTransparent(hwnd);
User32.SetWindowExStyle(hwnd, User32.WsExTransparent | User32.WsExToolWindow);
}

public void Update(bool refresh)
Expand Down

0 comments on commit 27f1222

Please sign in to comment.