2
0
Equbuxu 3 жил өмнө
parent
commit
1012381fd5

+ 6 - 4
PixiEditor/Helpers/GlobalMouseHook.cs

@@ -5,7 +5,8 @@ using System.Diagnostics.CodeAnalysis;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 using System.Windows;
 using System.Windows;
 using System.Windows.Input;
 using System.Windows.Input;
-
+using System.Windows.Threading;
+
 namespace PixiEditor.Helpers
 namespace PixiEditor.Helpers
 {
 {
     public delegate void MouseUpEventHandler(object sender, Point p, MouseButton button);
     public delegate void MouseUpEventHandler(object sender, Point p, MouseButton button);
@@ -90,8 +91,9 @@ namespace PixiEditor.Helpers
                     {
                     {
 
 
                         MouseButton button = wParam == WM_LBUTTONUP ? MouseButton.Left
                         MouseButton button = wParam == WM_LBUTTONUP ? MouseButton.Left
-                            : wParam == WM_MBUTTONUP ? MouseButton.Middle : MouseButton.Right;
-                        MouseUp.Invoke(null, new Point(mouseHookStruct.Pt.X, mouseHookStruct.Pt.Y), button);
+                            : wParam == WM_MBUTTONUP ? MouseButton.Middle : MouseButton.Right;
+                        Dispatcher.CurrentDispatcher.BeginInvoke(() =>
+                            MouseUp.Invoke(null, new Point(mouseHookStruct.Pt.X, mouseHookStruct.Pt.Y), button));
                     }
                     }
                 }
                 }
             }
             }
@@ -139,4 +141,4 @@ namespace PixiEditor.Helpers
             public IntPtr DwExtraInfo;
             public IntPtr DwExtraInfo;
         }
         }
     }
     }
-}
+}