@copylee/dsh-computer-use 0.13.1 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/helper/Capture.cs +38 -3
- package/helper/Native.cs +10 -0
- package/helper/Overlay.cs +322 -122
- package/helper/Program.cs +5 -2
- package/helper/Uia.cs +198 -5
- package/lib/index.js +2701 -2341
- package/lib/types/computer.d.ts +35 -10
- package/lib/types/overlay.d.ts +25 -1
- package/lib/types/prompt.d.ts +3 -1
- package/lib/types/tools.d.ts +2 -0
- package/lib/types/ui-diff.d.ts +15 -6
- package/package.json +1 -1
package/helper/Overlay.cs
CHANGED
|
@@ -376,12 +376,23 @@ namespace DshComputerUse
|
|
|
376
376
|
static int keyBurstCount;
|
|
377
377
|
static volatile bool visible;
|
|
378
378
|
static volatile bool paused;
|
|
379
|
+
static volatile bool petWaiting;
|
|
380
|
+
public static volatile bool SkipWaitRequested;
|
|
379
381
|
static volatile bool clickTargetEnabled = true;
|
|
380
|
-
static
|
|
382
|
+
static volatile bool customCursorActive;
|
|
383
|
+
static string cursorBadge = "DSH";
|
|
381
384
|
static LayeredForm markForm;
|
|
382
385
|
static DateTime markExpiresAt = DateTime.MinValue;
|
|
383
386
|
static bool markActive;
|
|
384
387
|
static bool markIsResting;
|
|
388
|
+
static float cachedMarkScale;
|
|
389
|
+
static bool cachedMarkFlipX, cachedMarkFlipY, cachedMarkRipple, cachedMarkArrow;
|
|
390
|
+
static string cachedMarkText = "";
|
|
391
|
+
static Color cachedMarkColor = Color.Empty;
|
|
392
|
+
static int cachedMarkCx, cachedMarkCy;
|
|
393
|
+
static bool hasCachedMarkBitmap;
|
|
394
|
+
static volatile int latestMouseX, latestMouseY;
|
|
395
|
+
static int mouseMovePending;
|
|
385
396
|
static int lastTyping = int.MinValue / 2;
|
|
386
397
|
static int lastEmit;
|
|
387
398
|
static readonly object RectLock = new object();
|
|
@@ -473,10 +484,14 @@ namespace DshComputerUse
|
|
|
473
484
|
if (reqSize == "compact" || reqSize == "standard" || reqSize == "detailed") petSize = reqSize;
|
|
474
485
|
clickTargetEnabled = Args.Bool(r, "glow", true);
|
|
475
486
|
string badgeSrc = label.Replace("正在操控你的电脑", "").Replace("正在操控", "").Trim();
|
|
476
|
-
if (badgeSrc.StartsWith("DeepSeek", StringComparison.OrdinalIgnoreCase)) cursorBadge = "
|
|
477
|
-
else
|
|
478
|
-
|
|
479
|
-
|
|
487
|
+
if (badgeSrc.Length == 0 || badgeSrc.StartsWith("DeepSeek", StringComparison.OrdinalIgnoreCase) || string.Equals(badgeSrc, "DSH", StringComparison.OrdinalIgnoreCase)) cursorBadge = "DSH";
|
|
488
|
+
else cursorBadge = badgeSrc.Length > 10 ? badgeSrc.Substring(0, 10) : badgeSrc;
|
|
489
|
+
if (visible && !petFinished)
|
|
490
|
+
{
|
|
491
|
+
if (clickTargetEnabled && !paused) ApplyCustomCursor(); else RestoreSystemCursor(false);
|
|
492
|
+
RenderPill();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
480
495
|
if (visible) HideCore(); // the previous run's "done" card is still up
|
|
481
496
|
petMode = Args.Bool(r, "pet", false);
|
|
482
497
|
hoveredBtn = "";
|
|
@@ -575,6 +590,7 @@ namespace DshComputerUse
|
|
|
575
590
|
visible = true;
|
|
576
591
|
if (clickTargetEnabled)
|
|
577
592
|
{
|
|
593
|
+
ApplyCustomCursor();
|
|
578
594
|
Native.POINT cp;
|
|
579
595
|
if (Native.GetCursorPos(out cp)) ShowRestingMarkOnUi(cp.X, cp.Y);
|
|
580
596
|
}
|
|
@@ -582,6 +598,106 @@ namespace DshComputerUse
|
|
|
582
598
|
});
|
|
583
599
|
}
|
|
584
600
|
|
|
601
|
+
/**
|
|
602
|
+
* Replace Windows' hardware pointer (Normal / IBeam / Hand) with our crisp,
|
|
603
|
+
* DPI-scaled stylized DSH cursor while controlling. Hardware-composited at
|
|
604
|
+
* full refresh rate with zero double-arrow overlap, and always restored via
|
|
605
|
+
* SystemParametersInfo(SPI_SETCURSORS) on pause, hide, exit, or crash recovery.
|
|
606
|
+
*/
|
|
607
|
+
static void ApplyCustomCursor()
|
|
608
|
+
{
|
|
609
|
+
if (customCursorActive) return;
|
|
610
|
+
IntPtr hCursor = IntPtr.Zero;
|
|
611
|
+
try
|
|
612
|
+
{
|
|
613
|
+
float s = Math.Max(1f, Math.Min(3f, Scale()));
|
|
614
|
+
int size = Math.Max(32, Math.Min(96, (int)Math.Round(32f * s)));
|
|
615
|
+
int tipX = Math.Max(1, (int)Math.Round(2f * s));
|
|
616
|
+
int tipY = Math.Max(1, (int)Math.Round(2f * s));
|
|
617
|
+
using (var bmp = new Bitmap(size, size, PixelFormat.Format32bppArgb))
|
|
618
|
+
{
|
|
619
|
+
using (var g = Graphics.FromImage(bmp))
|
|
620
|
+
{
|
|
621
|
+
g.Clear(Color.Transparent);
|
|
622
|
+
g.SmoothingMode = SmoothingMode.AntiAlias;
|
|
623
|
+
var arrow = new PointF[]
|
|
624
|
+
{
|
|
625
|
+
new PointF(tipX, tipY),
|
|
626
|
+
new PointF(tipX, tipY + 19.2f * s),
|
|
627
|
+
new PointF(tipX + 5.0f * s, tipY + 14.8f * s),
|
|
628
|
+
new PointF(tipX + 8.6f * s, tipY + 22.4f * s),
|
|
629
|
+
new PointF(tipX + 11.8f * s, tipY + 20.9f * s),
|
|
630
|
+
new PointF(tipX + 8.2f * s, tipY + 13.5f * s),
|
|
631
|
+
new PointF(tipX + 14.5f * s, tipY + 13.1f * s),
|
|
632
|
+
};
|
|
633
|
+
var shadow = new PointF[arrow.Length];
|
|
634
|
+
for (int i = 0; i < arrow.Length; i++)
|
|
635
|
+
shadow[i] = new PointF(arrow[i].X + 1.0f * s, arrow[i].Y + 1.6f * s);
|
|
636
|
+
using (var sb = new SolidBrush(Color.FromArgb(88, 0, 0, 0)))
|
|
637
|
+
g.FillPolygon(sb, shadow);
|
|
638
|
+
using (var grad = new LinearGradientBrush(
|
|
639
|
+
new PointF(tipX, tipY),
|
|
640
|
+
new PointF(tipX + 15f * s, tipY + 23f * s),
|
|
641
|
+
AccentHi, Accent))
|
|
642
|
+
g.FillPolygon(grad, arrow);
|
|
643
|
+
using (var outline = new Pen(Color.FromArgb(250, 255, 255, 255), Math.Max(1.4f, 1.6f * s)))
|
|
644
|
+
{
|
|
645
|
+
outline.LineJoin = LineJoin.Round;
|
|
646
|
+
g.DrawPolygon(outline, arrow);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
IntPtr hIcon = bmp.GetHicon();
|
|
650
|
+
try
|
|
651
|
+
{
|
|
652
|
+
Native.ICONINFO ii;
|
|
653
|
+
if (Native.GetIconInfo(hIcon, out ii))
|
|
654
|
+
{
|
|
655
|
+
try
|
|
656
|
+
{
|
|
657
|
+
ii.fIcon = false;
|
|
658
|
+
ii.xHotspot = tipX;
|
|
659
|
+
ii.yHotspot = tipY;
|
|
660
|
+
hCursor = Native.CreateIconIndirect(ref ii);
|
|
661
|
+
}
|
|
662
|
+
finally
|
|
663
|
+
{
|
|
664
|
+
if (ii.hbmMask != IntPtr.Zero) Native.DeleteObject(ii.hbmMask);
|
|
665
|
+
if (ii.hbmColor != IntPtr.Zero) Native.DeleteObject(ii.hbmColor);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
finally
|
|
670
|
+
{
|
|
671
|
+
Native.DestroyIcon(hIcon);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (hCursor == IntPtr.Zero) return;
|
|
675
|
+
uint[] ids = new uint[] { Native.OCR_NORMAL, Native.OCR_IBEAM, Native.OCR_HAND };
|
|
676
|
+
bool anyApplied = false;
|
|
677
|
+
for (int i = 0; i < ids.Length; i++)
|
|
678
|
+
{
|
|
679
|
+
IntPtr dup = Native.CopyIcon(hCursor);
|
|
680
|
+
if (dup == IntPtr.Zero) continue;
|
|
681
|
+
if (Native.SetSystemCursor(dup, ids[i])) anyApplied = true;
|
|
682
|
+
else Native.DestroyIcon(dup);
|
|
683
|
+
}
|
|
684
|
+
if (anyApplied) customCursorActive = true;
|
|
685
|
+
}
|
|
686
|
+
catch (Exception) { }
|
|
687
|
+
finally
|
|
688
|
+
{
|
|
689
|
+
if (hCursor != IntPtr.Zero) Native.DestroyIcon(hCursor);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/** Reload the user's native Windows cursor scheme (idempotent & crash-safe). */
|
|
694
|
+
public static void RestoreSystemCursor(bool force)
|
|
695
|
+
{
|
|
696
|
+
if (!force && !customCursorActive) return;
|
|
697
|
+
try { Native.SystemParametersInfo(Native.SPI_SETCURSORS, 0, IntPtr.Zero, 0); } catch (Exception) { }
|
|
698
|
+
customCursorActive = false;
|
|
699
|
+
}
|
|
700
|
+
|
|
585
701
|
public static void Status(string newStatus)
|
|
586
702
|
{
|
|
587
703
|
if (thread == null || !visible) return;
|
|
@@ -610,6 +726,7 @@ namespace DshComputerUse
|
|
|
610
726
|
{
|
|
611
727
|
if (!visible || !petMode) { HideCore(); return; }
|
|
612
728
|
HideMark();
|
|
729
|
+
RestoreSystemCursor(false);
|
|
613
730
|
CloseInput(false);
|
|
614
731
|
foreach (var g in glows) g.Close();
|
|
615
732
|
glows.Clear();
|
|
@@ -625,7 +742,20 @@ namespace DshComputerUse
|
|
|
625
742
|
public static void SetPaused(bool value)
|
|
626
743
|
{
|
|
627
744
|
if (thread == null) return;
|
|
628
|
-
Ui(delegate
|
|
745
|
+
Ui(delegate
|
|
746
|
+
{
|
|
747
|
+
paused = value;
|
|
748
|
+
if (paused) { HideMark(); RestoreSystemCursor(false); }
|
|
749
|
+
else if (visible && clickTargetEnabled && !petFinished) { ApplyCustomCursor(); Native.POINT cp; if (Native.GetCursorPos(out cp)) ShowRestingMarkOnUi(cp.X, cp.Y); }
|
|
750
|
+
RenderPill();
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
public static void SetWaiting(bool value)
|
|
755
|
+
{
|
|
756
|
+
if (thread == null) return;
|
|
757
|
+
if (value) SkipWaitRequested = false;
|
|
758
|
+
Ui(delegate { petWaiting = value; if (visible) RenderPill(); });
|
|
629
759
|
}
|
|
630
760
|
|
|
631
761
|
public static void Hide()
|
|
@@ -638,8 +768,11 @@ namespace DshComputerUse
|
|
|
638
768
|
{
|
|
639
769
|
{
|
|
640
770
|
HideMark();
|
|
771
|
+
RestoreSystemCursor(false);
|
|
641
772
|
CloseInput(false);
|
|
642
773
|
petFinished = false;
|
|
774
|
+
petWaiting = false;
|
|
775
|
+
SkipWaitRequested = false;
|
|
643
776
|
petReply = "";
|
|
644
777
|
visible = false;
|
|
645
778
|
paused = false;
|
|
@@ -657,8 +790,10 @@ namespace DshComputerUse
|
|
|
657
790
|
|
|
658
791
|
public static void Shutdown()
|
|
659
792
|
{
|
|
793
|
+
RestoreSystemCursor(false);
|
|
660
794
|
if (thread == null) return;
|
|
661
795
|
try { Hide(); Ui(delegate { Application.ExitThread(); }); } catch (Exception) { }
|
|
796
|
+
RestoreSystemCursor(false);
|
|
662
797
|
}
|
|
663
798
|
|
|
664
799
|
public static bool ShowClickTarget { get { return visible && clickTargetEnabled; } }
|
|
@@ -704,11 +839,11 @@ namespace DshComputerUse
|
|
|
704
839
|
* arrow with white outline, attached rounded name-tag pill (auto-flipping
|
|
705
840
|
* at all 4 screen edges), and a subtle click ripple ring on post-click.
|
|
706
841
|
*/
|
|
707
|
-
static Bitmap DrawMark(string text, Color color, float scale, bool flipX, bool flipY, bool ripple, out int cx, out int cy)
|
|
842
|
+
static Bitmap DrawMark(string text, Color color, float scale, bool flipX, bool flipY, bool ripple, bool drawArrow, out int cx, out int cy)
|
|
708
843
|
{
|
|
709
844
|
float s = Math.Max(0.75f, Math.Min(3f, scale));
|
|
710
845
|
float px = 1.333f * s;
|
|
711
|
-
float glowR = (ripple ? 20f :
|
|
846
|
+
float glowR = (ripple ? 20f : 17f) * s;
|
|
712
847
|
float pad = 4f * s;
|
|
713
848
|
using (var font = new Font("Microsoft YaHei UI", 8f * px, FontStyle.Bold, GraphicsUnit.Pixel))
|
|
714
849
|
using (var probe = new Bitmap(1, 1))
|
|
@@ -722,9 +857,10 @@ namespace DshComputerUse
|
|
|
722
857
|
float pillW = textSize.Width > 0 ? (float)Math.Ceiling(textSize.Width + 2f * pillPadX) : 0f;
|
|
723
858
|
float pillH = textSize.Height > 0 ? Math.Max(19f * s, (float)Math.Ceiling(textSize.Height + 5f * s)) : 0f;
|
|
724
859
|
|
|
725
|
-
// Offsets relative to the pointer tip at (0, 0).
|
|
726
|
-
|
|
727
|
-
float
|
|
860
|
+
// Offsets relative to the pointer tip at (0, 0). Clear the native Windows pointer
|
|
861
|
+
// arrow cleanly when attaching to the live OS cursor (drawArrow == false).
|
|
862
|
+
float tagX = flipX ? (-10f * s - pillW) : (drawArrow ? 13f * s : 14f * s);
|
|
863
|
+
float tagY = flipY ? (-10f * s - pillH) : (drawArrow ? 15f * s : 18f * s);
|
|
728
864
|
|
|
729
865
|
float minX = Math.Min(-glowR, pillW > 0 ? tagX : 0f) - pad;
|
|
730
866
|
float maxX = Math.Max(glowR, Math.Max(14f * s, pillW > 0 ? tagX + pillW : 0f)) + pad;
|
|
@@ -750,20 +886,26 @@ namespace DshComputerUse
|
|
|
750
886
|
using (var glow = new PathGradientBrush(spot))
|
|
751
887
|
{
|
|
752
888
|
glow.CenterPoint = new PointF(cx, cy);
|
|
753
|
-
glow.CenterColor = Color.FromArgb(ripple ?
|
|
889
|
+
glow.CenterColor = Color.FromArgb(ripple ? 135 : 115, color);
|
|
754
890
|
glow.SurroundColors = new Color[] { Color.FromArgb(0, color) };
|
|
755
891
|
g.FillPath(glow, spot);
|
|
756
892
|
}
|
|
757
893
|
}
|
|
758
894
|
|
|
759
|
-
// 2. Post-click delicate ripple ring
|
|
895
|
+
// 2. Post-click delicate ripple ring + crisp center dot so exact placement
|
|
896
|
+
// reads cleanly in screenshots without drawing a duplicate frozen arrow.
|
|
760
897
|
if (ripple)
|
|
761
898
|
{
|
|
762
899
|
float rr = 11.5f * s;
|
|
763
|
-
using (var ringHalo = new Pen(Color.FromArgb(
|
|
900
|
+
using (var ringHalo = new Pen(Color.FromArgb(145, 255, 255, 255), Math.Max(2.5f, 3.2f * s)))
|
|
764
901
|
g.DrawEllipse(ringHalo, cx - rr, cy - rr, rr * 2f, rr * 2f);
|
|
765
|
-
using (var ring = new Pen(Color.FromArgb(
|
|
902
|
+
using (var ring = new Pen(Color.FromArgb(235, color), Math.Max(1.6f, 2f * s)))
|
|
766
903
|
g.DrawEllipse(ring, cx - rr, cy - rr, rr * 2f, rr * 2f);
|
|
904
|
+
float dr = 3.2f * s;
|
|
905
|
+
using (var dotHalo = new SolidBrush(Color.FromArgb(245, 255, 255, 255)))
|
|
906
|
+
g.FillEllipse(dotHalo, cx - dr - 1.2f * s, cy - dr - 1.2f * s, (dr + 1.2f * s) * 2f, (dr + 1.2f * s) * 2f);
|
|
907
|
+
using (var dot = new SolidBrush(Color.FromArgb(255, color)))
|
|
908
|
+
g.FillEllipse(dot, cx - dr, cy - dr, dr * 2f, dr * 2f);
|
|
767
909
|
}
|
|
768
910
|
|
|
769
911
|
// 3. Attached collaborative name-tag pill.
|
|
@@ -786,26 +928,31 @@ namespace DshComputerUse
|
|
|
786
928
|
g.DrawString(text, font, fg, bx + (pillW - textSize.Width) / 2f, by + (pillH - textSize.Height) / 2f - 0.5f * s, fmt);
|
|
787
929
|
}
|
|
788
930
|
|
|
789
|
-
// 4.
|
|
790
|
-
|
|
931
|
+
// 4. Vector cursor arrow ONLY for capturable post-click markers (screenshots do not
|
|
932
|
+
// capture Windows' hardware cursor). Live resting/gliding states omit the fake arrow
|
|
933
|
+
// so Windows' native cursor never double-renders on top of a duplicate arrow.
|
|
934
|
+
if (drawArrow)
|
|
791
935
|
{
|
|
792
|
-
new PointF
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
arrowShadow
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
outline
|
|
808
|
-
|
|
936
|
+
var arrow = new PointF[]
|
|
937
|
+
{
|
|
938
|
+
new PointF(cx, cy),
|
|
939
|
+
new PointF(cx, cy + 16.5f * s),
|
|
940
|
+
new PointF(cx + 4.3f * s, cy + 12.8f * s),
|
|
941
|
+
new PointF(cx + 7.4f * s, cy + 19.2f * s),
|
|
942
|
+
new PointF(cx + 10.0f * s, cy + 17.9f * s),
|
|
943
|
+
new PointF(cx + 6.9f * s, cy + 11.7f * s),
|
|
944
|
+
new PointF(cx + 12.4f * s, cy + 11.4f * s),
|
|
945
|
+
};
|
|
946
|
+
var arrowShadow = new PointF[arrow.Length];
|
|
947
|
+
for (int i = 0; i < arrow.Length; i++)
|
|
948
|
+
arrowShadow[i] = new PointF(arrow[i].X + 0.8f * s, arrow[i].Y + 1.5f * s);
|
|
949
|
+
using (var sb = new SolidBrush(Color.FromArgb(72, 0, 0, 0))) g.FillPolygon(sb, arrowShadow);
|
|
950
|
+
using (var fill = new SolidBrush(Color.FromArgb(255, color))) g.FillPolygon(fill, arrow);
|
|
951
|
+
using (var outline = new Pen(Color.FromArgb(248, 255, 255, 255), Math.Max(1.2f, 1.5f * s)))
|
|
952
|
+
{
|
|
953
|
+
outline.LineJoin = LineJoin.Round;
|
|
954
|
+
g.DrawPolygon(outline, arrow);
|
|
955
|
+
}
|
|
809
956
|
}
|
|
810
957
|
}
|
|
811
958
|
return bmp;
|
|
@@ -820,99 +967,108 @@ namespace DshComputerUse
|
|
|
820
967
|
GlideMark(x, y, text, Accent, holdMs, false, false);
|
|
821
968
|
}
|
|
822
969
|
|
|
823
|
-
/**
|
|
824
|
-
|
|
970
|
+
/** Move or render the mark form: uses ultra-fast SetWindowPos when only (x, y) changed. */
|
|
971
|
+
static void PlaceMarkOnUi(int x, int y, string text, Color color, int holdMs, bool capturable, bool ripple, bool resting)
|
|
825
972
|
{
|
|
826
|
-
|
|
827
|
-
|
|
973
|
+
lastMarkX = x;
|
|
974
|
+
lastMarkY = y;
|
|
975
|
+
hasLastMark = true;
|
|
976
|
+
if (markForm == null)
|
|
977
|
+
{
|
|
978
|
+
markForm = new LayeredForm(true);
|
|
979
|
+
markForm.Show();
|
|
980
|
+
hasCachedMarkBitmap = false;
|
|
981
|
+
}
|
|
982
|
+
markForm.SetCapturable(capturable || !ExcludeFromCapture);
|
|
983
|
+
float scale; Rectangle mon;
|
|
984
|
+
MonitorAt(x, y, out scale, out mon);
|
|
985
|
+
float s = Math.Max(0.75f, Math.Min(3f, scale));
|
|
986
|
+
string labelText = text ?? "";
|
|
987
|
+
int estW = (int)((Math.Max(6, labelText.Length) * 11 + 36) * s);
|
|
988
|
+
bool flipX = !mon.IsEmpty && x + estW > mon.Right;
|
|
989
|
+
bool flipY = !mon.IsEmpty && y + (int)(52 * s) > mon.Bottom;
|
|
990
|
+
// The live hardware pointer itself is styled via SetSystemCursor (no duplicate frozen arrow).
|
|
991
|
+
bool drawArrow = false;
|
|
992
|
+
|
|
993
|
+
bool sameVisual = hasCachedMarkBitmap
|
|
994
|
+
&& Math.Abs(scale - cachedMarkScale) < 0.01f
|
|
995
|
+
&& flipX == cachedMarkFlipX && flipY == cachedMarkFlipY
|
|
996
|
+
&& ripple == cachedMarkRipple && drawArrow == cachedMarkArrow
|
|
997
|
+
&& labelText == cachedMarkText && color.ToArgb() == cachedMarkColor.ToArgb();
|
|
998
|
+
|
|
999
|
+
if (sameVisual)
|
|
828
1000
|
{
|
|
829
|
-
|
|
830
|
-
|
|
1001
|
+
// Pure DWM sprite move (< 0.05ms, zero GDI+ redraw) for native-smooth cursor tracking.
|
|
1002
|
+
Native.SetWindowPos(markForm.Handle, IntPtr.Zero, x - cachedMarkCx, y - cachedMarkCy, 0, 0, 0x0001 | 0x0004 | 0x0010);
|
|
831
1003
|
}
|
|
832
1004
|
else
|
|
833
1005
|
{
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1006
|
+
int cx, cy;
|
|
1007
|
+
using (var bmp = DrawMark(labelText, color, scale, flipX, flipY, ripple, drawArrow, out cx, out cy))
|
|
1008
|
+
{
|
|
1009
|
+
markForm.SetBitmap(bmp, new Rectangle(x - cx, y - cy, bmp.Width, bmp.Height), 255);
|
|
1010
|
+
}
|
|
1011
|
+
cachedMarkScale = scale;
|
|
1012
|
+
cachedMarkFlipX = flipX;
|
|
1013
|
+
cachedMarkFlipY = flipY;
|
|
1014
|
+
cachedMarkRipple = ripple;
|
|
1015
|
+
cachedMarkArrow = drawArrow;
|
|
1016
|
+
cachedMarkText = labelText;
|
|
1017
|
+
cachedMarkColor = color;
|
|
1018
|
+
cachedMarkCx = cx;
|
|
1019
|
+
cachedMarkCy = cy;
|
|
1020
|
+
hasCachedMarkBitmap = true;
|
|
1021
|
+
markForm.KeepOnTop();
|
|
837
1022
|
}
|
|
1023
|
+
markActive = true;
|
|
1024
|
+
markIsResting = resting;
|
|
1025
|
+
markExpiresAt = holdMs > 0 ? DateTime.UtcNow.AddMilliseconds(holdMs) : DateTime.MaxValue;
|
|
1026
|
+
if (!timer.Enabled) timer.Start();
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
static void SyncRestingCursorOnUi()
|
|
1030
|
+
{
|
|
1031
|
+
Interlocked.Exchange(ref mouseMovePending, 0);
|
|
1032
|
+
if (!visible || !clickTargetEnabled || petFinished || paused || !markActive || !markIsResting) return;
|
|
1033
|
+
PlaceMarkOnUi(latestMouseX, latestMouseY, cursorBadge, Accent, 0, false, false, true);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/** Smooth EaseOutCubic glide (~150ms @ ~60-90Hz) moving both OS cursor and cached badge in lockstep. */
|
|
1037
|
+
public static void GlideMark(int x, int y, string text, Color color, int holdMs, bool capturable, bool ripple)
|
|
1038
|
+
{
|
|
1039
|
+
int startX, startY;
|
|
1040
|
+
Native.POINT cur;
|
|
1041
|
+
if (Native.GetCursorPos(out cur)) { startX = cur.X; startY = cur.Y; }
|
|
1042
|
+
else if (hasLastMark) { startX = lastMarkX; startY = lastMarkY; }
|
|
1043
|
+
else { startX = x; startY = y; }
|
|
838
1044
|
double dist = Math.Sqrt((double)(x - startX) * (x - startX) + (double)(y - startY) * (y - startY));
|
|
839
|
-
if (dist >=
|
|
1045
|
+
if (dist >= 30.0)
|
|
840
1046
|
{
|
|
841
|
-
int steps = Math.Max(
|
|
1047
|
+
int steps = Math.Max(8, Math.Min(16, (int)(dist / 65.0) + 8));
|
|
842
1048
|
for (int i = 1; i < steps; i++)
|
|
843
1049
|
{
|
|
844
1050
|
double t = (double)i / steps;
|
|
845
1051
|
double ease = 1.0 - Math.Pow(1.0 - t, 3.0); // EaseOutCubic
|
|
846
1052
|
int ix = startX + (int)Math.Round((x - startX) * ease);
|
|
847
1053
|
int iy = startY + (int)Math.Round((y - startY) * ease);
|
|
1054
|
+
try { Native.SetCursorPos(ix, iy); } catch (Exception) { }
|
|
848
1055
|
Mark(ix, iy, text, color, holdMs, capturable, false);
|
|
849
|
-
Thread.Sleep(
|
|
1056
|
+
Thread.Sleep(10);
|
|
850
1057
|
}
|
|
851
1058
|
}
|
|
1059
|
+
try { Native.SetCursorPos(x, y); } catch (Exception) { }
|
|
852
1060
|
Mark(x, y, text, color, holdMs, capturable, ripple);
|
|
853
1061
|
}
|
|
854
1062
|
|
|
855
1063
|
static void ShowRestingMarkOnUi(int x, int y)
|
|
856
1064
|
{
|
|
857
|
-
|
|
858
|
-
lastMarkY = y;
|
|
859
|
-
hasLastMark = true;
|
|
860
|
-
if (markForm == null)
|
|
861
|
-
{
|
|
862
|
-
markForm = new LayeredForm(true);
|
|
863
|
-
markForm.Show();
|
|
864
|
-
}
|
|
865
|
-
// Resting Codex cursor stays visible to the user during control mode,
|
|
866
|
-
// while remaining invisible to screenshots so it never obscures target pixels.
|
|
867
|
-
markForm.SetCapturable(false);
|
|
868
|
-
float scale; Rectangle mon;
|
|
869
|
-
MonitorAt(x, y, out scale, out mon);
|
|
870
|
-
float s = Math.Max(0.75f, Math.Min(3f, scale));
|
|
871
|
-
int estW = (int)((Math.Max(6, cursorBadge.Length) * 11 + 36) * s);
|
|
872
|
-
bool flipX = !mon.IsEmpty && x + estW > mon.Right;
|
|
873
|
-
bool flipY = !mon.IsEmpty && y + (int)(52 * s) > mon.Bottom;
|
|
874
|
-
int cx, cy;
|
|
875
|
-
using (var bmp = DrawMark(cursorBadge, Accent, scale, flipX, flipY, false, out cx, out cy))
|
|
876
|
-
{
|
|
877
|
-
markForm.SetBitmap(bmp, new Rectangle(x - cx, y - cy, bmp.Width, bmp.Height), 255);
|
|
878
|
-
}
|
|
879
|
-
markForm.KeepOnTop();
|
|
880
|
-
markActive = true;
|
|
881
|
-
markIsResting = true;
|
|
882
|
-
markExpiresAt = DateTime.MaxValue;
|
|
1065
|
+
PlaceMarkOnUi(x, y, cursorBadge, Accent, 0, false, false, true);
|
|
883
1066
|
}
|
|
884
1067
|
|
|
885
1068
|
public static void Mark(int x, int y, string text, Color color, int holdMs, bool capturable, bool ripple)
|
|
886
1069
|
{
|
|
887
|
-
lastMarkX = x;
|
|
888
|
-
lastMarkY = y;
|
|
889
|
-
hasLastMark = true;
|
|
890
1070
|
Ensure();
|
|
891
|
-
Ui(delegate
|
|
892
|
-
{
|
|
893
|
-
if (markForm == null)
|
|
894
|
-
{
|
|
895
|
-
markForm = new LayeredForm(true);
|
|
896
|
-
markForm.Show();
|
|
897
|
-
}
|
|
898
|
-
markForm.SetCapturable(capturable || !ExcludeFromCapture);
|
|
899
|
-
float scale; Rectangle mon;
|
|
900
|
-
MonitorAt(x, y, out scale, out mon);
|
|
901
|
-
float s = Math.Max(0.75f, Math.Min(3f, scale));
|
|
902
|
-
int estW = (int)((Math.Max(6, (text ?? "").Length) * 11 + 36) * s);
|
|
903
|
-
bool flipX = !mon.IsEmpty && x + estW > mon.Right;
|
|
904
|
-
bool flipY = !mon.IsEmpty && y + (int)(52 * s) > mon.Bottom;
|
|
905
|
-
int cx, cy;
|
|
906
|
-
using (var bmp = DrawMark(text, color, scale, flipX, flipY, ripple, out cx, out cy))
|
|
907
|
-
{
|
|
908
|
-
markForm.SetBitmap(bmp, new Rectangle(x - cx, y - cy, bmp.Width, bmp.Height), 255);
|
|
909
|
-
}
|
|
910
|
-
markForm.KeepOnTop();
|
|
911
|
-
markActive = true;
|
|
912
|
-
markIsResting = false;
|
|
913
|
-
markExpiresAt = holdMs > 0 ? DateTime.UtcNow.AddMilliseconds(holdMs) : DateTime.MaxValue;
|
|
914
|
-
if (!timer.Enabled) timer.Start();
|
|
915
|
-
});
|
|
1071
|
+
Ui(delegate { PlaceMarkOnUi(x, y, text, color, holdMs, capturable, ripple, false); });
|
|
916
1072
|
}
|
|
917
1073
|
|
|
918
1074
|
public static void MarkResult(int x, int y, string button, int count, string coordLabel)
|
|
@@ -924,13 +1080,14 @@ namespace DshComputerUse
|
|
|
924
1080
|
else if (button == "right") { color = Color.FromArgb(16, 185, 129); verb = "已右键"; }
|
|
925
1081
|
else if (button == "middle") { color = Color.FromArgb(6, 182, 212); verb = "已中键"; }
|
|
926
1082
|
else { color = Color.FromArgb(59, 130, 246); verb = "已单击"; }
|
|
927
|
-
Mark(x, y, verb + " " + coordLabel, color,
|
|
1083
|
+
Mark(x, y, verb + " " + coordLabel, color, 900, true, true);
|
|
928
1084
|
}
|
|
929
1085
|
|
|
930
1086
|
static void HideMark()
|
|
931
1087
|
{
|
|
932
1088
|
markActive = false;
|
|
933
1089
|
markIsResting = false;
|
|
1090
|
+
hasCachedMarkBitmap = false;
|
|
934
1091
|
markExpiresAt = DateTime.MinValue;
|
|
935
1092
|
if (markForm != null)
|
|
936
1093
|
{
|
|
@@ -956,9 +1113,15 @@ namespace DshComputerUse
|
|
|
956
1113
|
// pause / resume / stop, from Esc or the pill buttons.
|
|
957
1114
|
static void Press(string action)
|
|
958
1115
|
{
|
|
959
|
-
if (action == "stop") { paused = false; Program.EmitEvent("stop", "button"); }
|
|
960
|
-
else if (action == "
|
|
961
|
-
else if (action == "
|
|
1116
|
+
if (action == "stop") { paused = false; petWaiting = false; SkipWaitRequested = true; RestoreSystemCursor(false); Program.EmitEvent("stop", "button"); }
|
|
1117
|
+
else if (action == "skip_wait") { petWaiting = false; SkipWaitRequested = true; Program.EmitEvent("skip_wait", "button"); }
|
|
1118
|
+
else if (action == "pause") { paused = true; HideMark(); RestoreSystemCursor(false); Program.EmitEvent("pause", "user"); }
|
|
1119
|
+
else if (action == "resume")
|
|
1120
|
+
{
|
|
1121
|
+
paused = false; pausedByInput = false;
|
|
1122
|
+
if (visible && clickTargetEnabled && !petFinished) { ApplyCustomCursor(); Native.POINT cp; if (Native.GetCursorPos(out cp)) ShowRestingMarkOnUi(cp.X, cp.Y); }
|
|
1123
|
+
Program.EmitEvent("resume", "user");
|
|
1124
|
+
}
|
|
962
1125
|
else if (action == "expand") petExpanded = !petExpanded;
|
|
963
1126
|
else if (action == "input") { if (input == null) OpenInput(); else CloseInput(true); return; }
|
|
964
1127
|
else if (action == "send") { if (input != null) SubmitInput(input.Box.Text); return; }
|
|
@@ -970,12 +1133,12 @@ namespace DshComputerUse
|
|
|
970
1133
|
{
|
|
971
1134
|
beforeInput = Native.GetForegroundWindow();
|
|
972
1135
|
// Typing an instruction pauses the agent, so its keys cannot land in the box.
|
|
973
|
-
if (!paused) { paused = true; pausedByInput = true; Program.EmitEvent("pause", "input"); }
|
|
1136
|
+
if (!paused) { paused = true; pausedByInput = true; HideMark(); RestoreSystemCursor(false); Program.EmitEvent("pause", "input"); }
|
|
974
1137
|
bool dark = DarkTheme();
|
|
975
1138
|
float px = 1.333f * Scale();
|
|
976
1139
|
input = new InputBox(new Font("Microsoft YaHei UI", 10f * px, FontStyle.Regular, GraphicsUnit.Pixel),
|
|
977
1140
|
dark ? Color.FromArgb(52, 51, 49) : Color.White, dark ? Color.FromArgb(244, 243, 241) : Color.FromArgb(31, 30, 29),
|
|
978
|
-
"告诉
|
|
1141
|
+
"告诉 AI 接下来做什么(Enter 发送,Esc 取消)");
|
|
979
1142
|
input.Submitted += SubmitInput;
|
|
980
1143
|
input.Cancelled += delegate { CloseInput(true); };
|
|
981
1144
|
inputBounds = Rectangle.Empty;
|
|
@@ -1006,7 +1169,12 @@ namespace DshComputerUse
|
|
|
1006
1169
|
InputHwnd = IntPtr.Zero;
|
|
1007
1170
|
inputBounds = Rectangle.Empty;
|
|
1008
1171
|
box.Close();
|
|
1009
|
-
if (pausedByInput)
|
|
1172
|
+
if (pausedByInput)
|
|
1173
|
+
{
|
|
1174
|
+
paused = false; pausedByInput = false;
|
|
1175
|
+
if (visible && clickTargetEnabled && !petFinished) { ApplyCustomCursor(); Native.POINT cp; if (Native.GetCursorPos(out cp)) ShowRestingMarkOnUi(cp.X, cp.Y); }
|
|
1176
|
+
Program.EmitEvent("resume", "input");
|
|
1177
|
+
}
|
|
1010
1178
|
var target = beforeInput;
|
|
1011
1179
|
beforeInput = IntPtr.Zero;
|
|
1012
1180
|
if (restoreFocus && target != IntPtr.Zero && Native.IsWindow(target))
|
|
@@ -1020,8 +1188,12 @@ namespace DshComputerUse
|
|
|
1020
1188
|
{
|
|
1021
1189
|
if (markActive && DateTime.UtcNow >= markExpiresAt)
|
|
1022
1190
|
{
|
|
1023
|
-
if (visible && clickTargetEnabled && !petFinished &&
|
|
1024
|
-
|
|
1191
|
+
if (visible && clickTargetEnabled && !petFinished && !paused)
|
|
1192
|
+
{
|
|
1193
|
+
Native.POINT cp;
|
|
1194
|
+
if (Native.GetCursorPos(out cp)) ShowRestingMarkOnUi(cp.X, cp.Y);
|
|
1195
|
+
else if (hasLastMark) ShowRestingMarkOnUi(lastMarkX, lastMarkY);
|
|
1196
|
+
}
|
|
1025
1197
|
else
|
|
1026
1198
|
HideMark();
|
|
1027
1199
|
}
|
|
@@ -1030,12 +1202,12 @@ namespace DshComputerUse
|
|
|
1030
1202
|
if (!markActive) timer.Stop();
|
|
1031
1203
|
return;
|
|
1032
1204
|
}
|
|
1033
|
-
if (visible && clickTargetEnabled && !petFinished && !markActive)
|
|
1205
|
+
if (visible && clickTargetEnabled && !petFinished && !paused && !markActive)
|
|
1034
1206
|
{
|
|
1035
1207
|
Native.POINT cp;
|
|
1036
1208
|
if (Native.GetCursorPos(out cp)) ShowRestingMarkOnUi(cp.X, cp.Y);
|
|
1037
1209
|
}
|
|
1038
|
-
else if (visible && clickTargetEnabled && !petFinished && markActive && markIsResting)
|
|
1210
|
+
else if (visible && clickTargetEnabled && !petFinished && !paused && markActive && markIsResting)
|
|
1039
1211
|
{
|
|
1040
1212
|
Native.POINT cp;
|
|
1041
1213
|
if (Native.GetCursorPos(out cp) && (Math.Abs(cp.X - lastMarkX) > 2 || Math.Abs(cp.Y - lastMarkY) > 2))
|
|
@@ -1108,19 +1280,24 @@ namespace DshComputerUse
|
|
|
1108
1280
|
if (paused)
|
|
1109
1281
|
{
|
|
1110
1282
|
main = "已暂停"; sub = "按 Esc 继续";
|
|
1111
|
-
actions = new[] { "resume", "stop" }; captions = new[] { "继续", "
|
|
1283
|
+
actions = new[] { "resume", "stop" }; captions = new[] { "继续", "停止控制" };
|
|
1112
1284
|
return;
|
|
1113
1285
|
}
|
|
1114
1286
|
main = label;
|
|
1115
1287
|
sub = Typing() ? "你正在操作,已暂停" : status.Length > 0 ? status : "Esc 暂停";
|
|
1116
|
-
|
|
1288
|
+
if (petWaiting)
|
|
1289
|
+
{
|
|
1290
|
+
actions = new[] { "skip_wait", "stop" }; captions = new[] { "跳过等待", "停止控制" };
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
actions = new[] { "stop" }; captions = new[] { "停止控制" };
|
|
1117
1294
|
}
|
|
1118
1295
|
|
|
1119
1296
|
static string Key()
|
|
1120
1297
|
{
|
|
1121
1298
|
string main, sub; string[] actions, captions;
|
|
1122
1299
|
Content(out main, out sub, out actions, out captions);
|
|
1123
|
-
return main + "|" + sub + "|" + string.Join(",", actions) + "|" + pillAtBottom + "|" + Typing();
|
|
1300
|
+
return main + "|" + sub + "|" + string.Join(",", actions) + "|" + pillAtBottom + "|" + Typing() + "|" + petWaiting;
|
|
1124
1301
|
}
|
|
1125
1302
|
|
|
1126
1303
|
static bool DarkTheme()
|
|
@@ -1184,7 +1361,8 @@ namespace DshComputerUse
|
|
|
1184
1361
|
|
|
1185
1362
|
static string ButtonTip(string act)
|
|
1186
1363
|
{
|
|
1187
|
-
if (act == "stop") return "
|
|
1364
|
+
if (act == "stop") return "停止控制并回到 DSH";
|
|
1365
|
+
if (act == "skip_wait") return "跳过等待,立即继续";
|
|
1188
1366
|
if (act == "pause") return "暂停操控";
|
|
1189
1367
|
if (act == "resume") return "继续操控";
|
|
1190
1368
|
if (act == "expand") return petExpanded ? "收起详情" : "展开详情";
|
|
@@ -1219,8 +1397,10 @@ namespace DshComputerUse
|
|
|
1219
1397
|
|
|
1220
1398
|
bool isCompact = petSize == "compact";
|
|
1221
1399
|
bool isDetailed = petSize == "detailed";
|
|
1222
|
-
string title = petFinished ? "已完成" : (isCompact && label.Length > 12 ? label.Substring(0, 11) + "…" : label);
|
|
1223
1400
|
string hoverTip = ButtonTip(hoveredBtn);
|
|
1401
|
+
string title = hoverTip.Length > 0
|
|
1402
|
+
? (isCompact ? "" : "DSH")
|
|
1403
|
+
: petFinished ? "已完成" : (isCompact && label.Length > 12 ? label.Substring(0, 11) + "…" : label);
|
|
1224
1404
|
string state = hoverTip.Length > 0 ? hoverTip
|
|
1225
1405
|
: petFinished ? "" : paused ? (input != null ? "输入指令中…" : "已暂停 · Esc 继续")
|
|
1226
1406
|
: Typing() ? "你正在操作,已暂停" : (isCompact ? "" : "Esc 暂停");
|
|
@@ -1231,6 +1411,7 @@ namespace DshComputerUse
|
|
|
1231
1411
|
{
|
|
1232
1412
|
actions.Add("stop"); glyphs.Add("\uE71A");
|
|
1233
1413
|
if (paused) { actions.Add("resume"); glyphs.Add("\uE768"); } else { actions.Add("pause"); glyphs.Add("\uE769"); }
|
|
1414
|
+
if (petWaiting && !paused) { actions.Add("skip_wait"); glyphs.Add("\uE893"); }
|
|
1234
1415
|
}
|
|
1235
1416
|
actions.Add("expand"); glyphs.Add(petExpanded ? "\uE70D" : "\uE70E");
|
|
1236
1417
|
if (!petFinished) { actions.Add("input"); glyphs.Add("\uE70F"); }
|
|
@@ -1316,9 +1497,12 @@ namespace DshComputerUse
|
|
|
1316
1497
|
else if (logo != null) g.DrawImage(logo, iconRect);
|
|
1317
1498
|
else using (var brush = new SolidBrush(Accent)) g.FillEllipse(brush, RectangleF.Inflate(iconRect, -3 * s, -3 * s));
|
|
1318
1499
|
float tx = iconRect.Right + 8 * s;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1500
|
+
if (title.Length > 0)
|
|
1501
|
+
{
|
|
1502
|
+
SizeF headSize = g.MeasureString(title, fHead, 100000, fmt);
|
|
1503
|
+
using (var b = new SolidBrush(ink)) g.DrawString(title, fHead, b, tx, hy + (hh - headSize.Height) / 2f, fmt);
|
|
1504
|
+
tx += headSize.Width + 8 * s;
|
|
1505
|
+
}
|
|
1322
1506
|
|
|
1323
1507
|
buttons.Clear();
|
|
1324
1508
|
float d = (isCompact ? 24f : 26f) * s, bx = body.Right - pad;
|
|
@@ -1328,7 +1512,7 @@ namespace DshComputerUse
|
|
|
1328
1512
|
bx -= d;
|
|
1329
1513
|
var hitRect = new RectangleF(bx, hy + (hh - d) / 2f, d, d);
|
|
1330
1514
|
bool stop = act == "stop";
|
|
1331
|
-
bool on = (act == "input" && input != null) || (act == "resume");
|
|
1515
|
+
bool on = (act == "input" && input != null) || (act == "resume") || (act == "skip_wait");
|
|
1332
1516
|
bool hover = hoveredBtn == act;
|
|
1333
1517
|
bool press = pressedBtn == act;
|
|
1334
1518
|
float inflate = press ? -0.8f * s : hover ? 1.1f * s : 0f;
|
|
@@ -1349,7 +1533,7 @@ namespace DshComputerUse
|
|
|
1349
1533
|
using (var ring = new Pen(Color.FromArgb(dark ? 150 : 120, Accent), Math.Max(1f, 1.2f * s)))
|
|
1350
1534
|
g.DrawEllipse(ring, circle);
|
|
1351
1535
|
}
|
|
1352
|
-
string glyph = glyphFont.Length > 0 ? glyphs[i] : (stop ? "■" : act == "pause" ? "❚❚" : act == "resume" ? "▶" : act == "expand" ? (petExpanded ? "˅" : "˄") : act == "close" ? "✕" : "✎");
|
|
1536
|
+
string glyph = glyphFont.Length > 0 ? glyphs[i] : (stop ? "■" : act == "skip_wait" ? "⏭" : act == "pause" ? "❚❚" : act == "resume" ? "▶" : act == "expand" ? (petExpanded ? "˅" : "˄") : act == "close" ? "✕" : "✎");
|
|
1353
1537
|
Color glyphColor = stop ? Color.White : (hover || on) ? (dark ? Color.White : Color.FromArgb(168, 72, 42)) : ink;
|
|
1354
1538
|
using (var b = new SolidBrush(glyphColor)) g.DrawString(glyph, fGlyph, b, circle, center);
|
|
1355
1539
|
buttons.Add(new KeyValuePair<Rectangle, string>(Rectangle.Round(hitRect), act));
|
|
@@ -1653,7 +1837,23 @@ namespace DshComputerUse
|
|
|
1653
1837
|
if (nCode >= 0 && visible)
|
|
1654
1838
|
{
|
|
1655
1839
|
int msg = wParam.ToInt32();
|
|
1656
|
-
//
|
|
1840
|
+
// Hardware-rate cursor tracking on WM_MOUSEMOVE: never triggers takeover, only moves
|
|
1841
|
+
// the cached resting badge via SetWindowPos for silky native-grade responsiveness.
|
|
1842
|
+
if (msg == 0x0200)
|
|
1843
|
+
{
|
|
1844
|
+
if (clickTargetEnabled && !petFinished && markActive && markIsResting && invoker != null)
|
|
1845
|
+
{
|
|
1846
|
+
var mm = (Native.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Native.MSLLHOOKSTRUCT));
|
|
1847
|
+
latestMouseX = mm.pt.X;
|
|
1848
|
+
latestMouseY = mm.pt.Y;
|
|
1849
|
+
if (Interlocked.Exchange(ref mouseMovePending, 1) == 0)
|
|
1850
|
+
{
|
|
1851
|
+
try { invoker.BeginInvoke((MethodInvoker)SyncRestingCursorOnUi); }
|
|
1852
|
+
catch (Exception) { Interlocked.Exchange(ref mouseMovePending, 0); }
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
return Native.CallNextHookEx(mouseHook, nCode, wParam, lParam);
|
|
1856
|
+
}
|
|
1657
1857
|
bool isClick = msg == 0x0201 || msg == 0x0204 || msg == 0x0207;
|
|
1658
1858
|
bool isWheel = msg == 0x020A || msg == 0x020E;
|
|
1659
1859
|
if (isClick || isWheel)
|