minor changes/bug fixes

master
Zaafar Ahmed 5 years ago
parent aa8e806fcf
commit 2ea4e5115c
  1. 1
      ClickableTransparentOverlay/HookController.cs
  2. 7
      ClickableTransparentOverlay/NativeMethods.cs
  3. 4
      ClickableTransparentOverlay/Overlay.cs
  4. 1
      DriverProgram/DriverProgram.csproj

@ -117,6 +117,7 @@ namespace ClickableTransparentOverlay
this.myHook.MouseWheelExt -= this.HookMouseWheelExt; this.myHook.MouseWheelExt -= this.HookMouseWheelExt;
this.myHook.Dispose(); this.myHook.Dispose();
this.messages.Clear();
} }
/// <summary> /// <summary>

@ -26,15 +26,12 @@ namespace ClickableTransparentOverlay
/// <param name="handle"> /// <param name="handle">
/// Veldrid window handle in IntPtr format. /// Veldrid window handle in IntPtr format.
/// </param> /// </param>
/// <param name="size"> public static void EnableTransparent(IntPtr handle)
/// Size of the SDL2Window.
/// </param>
public static void EnableTransparent(IntPtr handle, Rectangle size)
{ {
IntPtr windowLong = GetWindowLongPtr(handle, GWL_EXSTYLE); IntPtr windowLong = GetWindowLongPtr(handle, GWL_EXSTYLE);
windowLong = new IntPtr(windowLong.ToInt64() | WS_EX_LAYERED | WS_EX_TRANSPARENT); windowLong = new IntPtr(windowLong.ToInt64() | WS_EX_LAYERED | WS_EX_TRANSPARENT);
SetWindowLongPtr(handle, GWL_EXSTYLE, windowLong); SetWindowLongPtr(handle, GWL_EXSTYLE, windowLong);
Margins margins = Margins.FromRectangle(size); Margins margins = Margins.FromRectangle(new Rectangle(-1, -1, -1, -1));
DwmExtendFrameIntoClientArea(handle, ref margins); DwmExtendFrameIntoClientArea(handle, ref margins);
} }

@ -76,7 +76,7 @@ namespace ClickableTransparentOverlay
graphicsDevice = VeldridStartup.CreateGraphicsDevice(window, new GraphicsDeviceOptions(true, null, true), GraphicsBackend.Direct3D11); graphicsDevice = VeldridStartup.CreateGraphicsDevice(window, new GraphicsDeviceOptions(true, null, true), GraphicsBackend.Direct3D11);
// graphicsDevice = VeldridStartup.CreateDefaultD3D11GraphicsDevice(new GraphicsDeviceOptions(true, null, true), window); // graphicsDevice = VeldridStartup.CreateDefaultD3D11GraphicsDevice(new GraphicsDeviceOptions(true, null, true), window);
NativeMethods.EnableTransparent(window.Handle, new System.Drawing.Rectangle(window.X, window.Y, window.Width, window.Height)); NativeMethods.EnableTransparent(window.Handle);
window.Resized += () => window.Resized += () =>
{ {
graphicsDevice.MainSwapchain.Resize((uint)window.Width, (uint)window.Height); graphicsDevice.MainSwapchain.Resize((uint)window.Width, (uint)window.Height);
@ -151,7 +151,7 @@ namespace ClickableTransparentOverlay
// TODO: move following two lines to _window.Moved // TODO: move following two lines to _window.Moved
hookController.UpdateWindowPosition(x, y); hookController.UpdateWindowPosition(x, y);
NativeMethods.EnableTransparent(window.Handle, new System.Drawing.Rectangle(x, y, width, height)); NativeMethods.EnableTransparent(window.Handle);
requireResize = true; requireResize = true;
} }

@ -44,6 +44,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>

Loading…
Cancel
Save