Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mouse click effect capability for screen recording #7622

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
adhere to coding guidelines - removing underscore from fields
  • Loading branch information
Vertygo committed Oct 13, 2024
commit 30cb81df5c8e9081e87712bbab4e9d23a0c91d9c
1 change: 0 additions & 1 deletion ShareX.HelpersLib/Input/MouseClickEffectForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace ShareX.HelpersLib
// transparent form where mouse click effect will be drawn
public class MouseClickEffectForm : LayeredForm
{

protected override CreateParams CreateParams
{
get
Expand Down
14 changes: 7 additions & 7 deletions ShareX.HelpersLib/Input/MouseHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ namespace ShareX.HelpersLib
{
public class MouseHook : IDisposable
{
private HookProc _proc;
private static IntPtr _hookID = IntPtr.Zero;
private HookProc proc;
private static IntPtr hookID = IntPtr.Zero;

public delegate void MouseEventHandler(MouseEventInfo eventInfo);
public event MouseEventHandler OnMouseEvent;

public MouseHook()
{
_proc = HookCallback;
_hookID = SetHook(_proc); // Set up global mouse hook
proc = HookCallback;
hookID = SetHook(proc); // Set up global mouse hook
}

~MouseHook()
Expand Down Expand Up @@ -53,13 +53,13 @@ private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
break;
}
}
return NativeMethods.CallNextHookEx(_hookID, nCode, wParam, lParam);

return NativeMethods.CallNextHookEx(hookID, nCode, wParam, lParam);
}

public void Dispose()
{
NativeMethods.UnhookWindowsHookEx(_hookID); // Clean up hook on exit
NativeMethods.UnhookWindowsHookEx(hookID); // Clean up hook on exit
}
}
}