# HG changeset patch
# User paulwerelds
# Date 1286174815 0
# Node ID 08635c9dac04dee416299fefada59091bf0d6876
# Parent 708f7aeddb30bb3e4a4e8cef830e7174ac987f43
Fixed an issue where the gadget would not be movable on an extra monitor positioned to the left of the primary monitor.
diff -r 708f7aeddb30 -r 08635c9dac04 GUI/GadgetWindow.cs
--- a/GUI/GadgetWindow.cs Sat Oct 02 20:03:59 2010 +0000
+++ b/GUI/GadgetWindow.cs Mon Oct 04 06:46:55 2010 +0000
@@ -123,8 +123,9 @@
message.Result = (IntPtr)HitResult.Caption;
if (HitTest != null) {
Point p = new Point(
- (int)((uint)message.LParam & 0xFFFF) - location.X,
- (int)(((uint)message.LParam >> 16) & 0xFFFF) - location.Y);
+ Macros.GET_X_LPARAM(message.LParam) - location.X,
+ Macros.GET_Y_LPARAM(message.LParam) - location.Y
+ );
HitTestEventArgs e = new HitTestEventArgs(p, HitResult.Caption);
HitTest(this, e);
message.Result = (IntPtr)e.HitResult;
@@ -421,6 +422,30 @@
DWMWA_LAST
}
+ ///
+ /// Some macros imported and converted from the Windows SDK
+ ///
+ 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));
+ }
+ }
+
+ ///
+ /// Imported native methods
+ ///
private static class NativeMethods {
private const string USER = "user32.dll";
private const string GDI = "gdi32.dll";