From 77572fa5b7170e776ae8a9d0aab6a0a679f13e08 Mon Sep 17 00:00:00 2001 From: siegrest <179900@ttu.ee> Date: Thu, 15 Feb 2018 15:07:06 +0200 Subject: [PATCH] Fix mouse stutter at program start --- Pricer/MainWindow.xaml.cs | 2 +- Pricer/Settings.cs | 2 +- Pricer/hooks/MouseHook.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Pricer/MainWindow.xaml.cs b/Pricer/MainWindow.xaml.cs index 608d6f0..53ae19e 100644 --- a/Pricer/MainWindow.xaml.cs +++ b/Pricer/MainWindow.xaml.cs @@ -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(); @@ -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; diff --git a/Pricer/Settings.cs b/Pricer/Settings.cs index 6e3ba03..d3fcebb 100644 --- a/Pricer/Settings.cs +++ b/Pricer/Settings.cs @@ -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 diff --git a/Pricer/hooks/MouseHook.cs b/Pricer/hooks/MouseHook.cs index f0edfbb..074eac3 100644 --- a/Pricer/hooks/MouseHook.cs +++ b/Pricer/hooks/MouseHook.cs @@ -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) {