Skip to content

Commit

Permalink
Fix mouse stutter at program start
Browse files Browse the repository at this point in the history
  • Loading branch information
siegrest committed Feb 15, 2018
1 parent 0c4e915 commit 77572fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Pricer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public MainWindow() {
eventHandler_clip = new EventHandler(Event_clipboard);
ClipboardNotification.ClipboardUpdate += eventHandler_clip;
MouseHook.MouseAction += eventHandler_mouse;
MouseHook.Start();

// Initialize the UI components
InitializeComponent();
Expand Down Expand Up @@ -296,6 +295,7 @@ private void Button_Run_Click(object sender, RoutedEventArgs e) {
Button_Run.Content = "Pause";
Settings.flag_run = true;
Log("Service started", 0);
MouseHook.Start();
} else {
Button_Run.Content = "Run";
Settings.flag_run = false;
Expand Down
2 changes: 1 addition & 1 deletion Pricer/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Pricer {
public static class Settings {
public static string[] sourceList = { "Poe.ovh", "Poe.ninja" };
public static string[] priceMethods = { "Mean", "Median", "Mode" };
public const string programTitle = "Item pricer v1.0.0";
public const string programTitle = "Item pricer v1.0.2";
public const string activeWindowTitle = "Path of Exile";

// Situational flags
Expand Down
2 changes: 1 addition & 1 deletion Pricer/hooks/MouseHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class MouseHook {
private static IntPtr _hookID = IntPtr.Zero;
private const int WH_MOUSE_LL = 14;

public static void Start() { _hookID = SetHook(_proc); }
public static void Start() { if (_hookID == IntPtr.Zero) _hookID = SetHook(_proc); }
public static void Stop() { UnhookWindowsHookEx(_hookID); }

private static IntPtr SetHook(LowLevelMouseProc proc) {
Expand Down

0 comments on commit 77572fa

Please sign in to comment.