mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-01 23:05:19 +00:00
Fixed an issue where the gadget would not be movable on an extra monitor positioned to the left of the primary monitor.
This commit is contained in:
@@ -123,8 +123,9 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
message.Result = (IntPtr)HitResult.Caption;
|
message.Result = (IntPtr)HitResult.Caption;
|
||||||
if (HitTest != null) {
|
if (HitTest != null) {
|
||||||
Point p = new Point(
|
Point p = new Point(
|
||||||
(int)((uint)message.LParam & 0xFFFF) - location.X,
|
Macros.GET_X_LPARAM(message.LParam) - location.X,
|
||||||
(int)(((uint)message.LParam >> 16) & 0xFFFF) - location.Y);
|
Macros.GET_Y_LPARAM(message.LParam) - location.Y
|
||||||
|
);
|
||||||
HitTestEventArgs e = new HitTestEventArgs(p, HitResult.Caption);
|
HitTestEventArgs e = new HitTestEventArgs(p, HitResult.Caption);
|
||||||
HitTest(this, e);
|
HitTest(this, e);
|
||||||
message.Result = (IntPtr)e.HitResult;
|
message.Result = (IntPtr)e.HitResult;
|
||||||
@@ -421,6 +422,30 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
DWMWA_LAST
|
DWMWA_LAST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Some macros imported and converted from the Windows SDK
|
||||||
|
/// </summary>
|
||||||
|
private static class Macros {
|
||||||
|
public static UInt16 LOWORD(IntPtr l) {
|
||||||
|
return ((UInt16) (((UInt64) (l)) & 0xffff));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UInt16 HIWORD(IntPtr l) {
|
||||||
|
return ((UInt16) ((((UInt64) (l)) >> 16) & 0xffff));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GET_X_LPARAM(IntPtr lp) {
|
||||||
|
return ((int) (short) LOWORD(lp));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GET_Y_LPARAM(IntPtr lp) {
|
||||||
|
return ((int) (short) HIWORD(lp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Imported native methods
|
||||||
|
/// </summary>
|
||||||
private static class NativeMethods {
|
private static class NativeMethods {
|
||||||
private const string USER = "user32.dll";
|
private const string USER = "user32.dll";
|
||||||
private const string GDI = "gdi32.dll";
|
private const string GDI = "gdi32.dll";
|
||||||
|
Reference in New Issue
Block a user