Skip to content

Commit

Permalink
random tweaks to mousehook and codepanerefactorrenamecommand
Browse files Browse the repository at this point in the history
  • Loading branch information
retailcoder committed Apr 21, 2016
1 parent 6791992 commit d30906f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions RetailCoder.VBE/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
using Rubberduck.UI.Command.MenuItems;
using Infralution.Localization.Wpf;
using Rubberduck.Common.Dispatch;
using Rubberduck.Common.Hotkeys;
using Rubberduck.VBEditor.VBEInterfaces.RubberduckCodePane;

namespace Rubberduck
{
Expand Down
3 changes: 2 additions & 1 deletion RetailCoder.VBE/Common/MouseHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void Attach()
_hookId = User32.SetWindowsHookEx(WindowsHook.MOUSE_LL, _callback, handle, 0);
if (_hookId == IntPtr.Zero)
{
IsAttached = false;
throw new Win32Exception();
}

Expand All @@ -86,7 +87,7 @@ public void Detach()
}

IsAttached = false;
if (!User32.UnhookWindowsHookEx(_hookId))
if (_hookId != IntPtr.Zero && !User32.UnhookWindowsHookEx(_hookId))
{
_hookId = IntPtr.Zero;
throw new Win32Exception();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public override void Execute(object parameter)
}
else
{
var selection = Vbe.ActiveCodePane.GetSelection();
target = _state.AllUserDeclarations.FindTarget(selection);
target = _state.FindSelectedDeclaration(Vbe.ActiveCodePane);
}

if (target == null)
Expand Down

0 comments on commit d30906f

Please sign in to comment.