Skip to content

feat(win32): 新增 AnchoredTouch 输入方式 - #31

Merged
moomiji merged 5 commits into
MaaXYZ:mainfrom
SweetSmellFox:main
Aug 28, 2026
Merged

moomiji merged 5 commits into
MaaXYZ:mainfrom
SweetSmellFox:main

Conversation

@SweetSmellFox

@SweetSmellFox SweetSmellFox commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Sourcery 总结

将 AnchoredTouch 添加为 Win32 输入方法,用于仅通过鼠标注入合成触摸。

新功能:

  • 添加 Win32 AnchoredTouch 输入方法,用于注入合成触摸点,同时不移动光标或前台窗口。

文档:

  • 记录 AnchoredTouch 输入方法的行为和限制。
Original summary in English

Summary by Sourcery

Add AnchoredTouch as a Win32 input method for mouse-only synthetic touch injection.

New Features:

  • Add the Win32 AnchoredTouch input method for injecting synthetic touch points without moving the cursor or foreground window.

Documentation:

  • Document the behavior and limitations of the AnchoredTouch input method.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好——我发现了 1 个问题

面向 AI 代理的提示
请处理本次代码审查中的评论:

## 单独评论

### 评论 1
<location path="src/MaaFramework.Binding/Enums/Controllers/Win32InputMethod.cs" line_range="61" />
<code_context>
     PostMessageWithCursorPos = (1 << 6),
     SendMessageWithWindowPos = (1 << 7),
     PostMessageWithWindowPos = (1 << 8),
+    AnchoredTouch = (1 << 10),
 }

</code_context>
<issue_to_address>
**issue (bug_risk):** AnchoredTouch 被分配到了第 10 位(`0x400`),而现有输入方法通过第 8 位连续占用,导致第 9 位未被使用。原生控制器会原样接收此值,因此当该 ABI 值应为下一位时,新方法无法选择原生的 AnchoredTouch 实现。

**触发条件:** 当调用方为 Win32 控制器选择 `Win32InputMethod.AnchoredTouch` 时。

**建议修复:** 使用 `(1 << 9)`,除非原生 ABI 有意保留第 9 位;在这种情况下,应针对原生枚举记录并验证该保留位。

```suggestion
    AnchoredTouch = (1 << 9),
```
</issue_to_address>

Sourcery 对开源项目免费——如果您喜欢我们的审查结果,请考虑分享它们 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会利用这些反馈来改进审查结果。
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/MaaFramework.Binding/Enums/Controllers/Win32InputMethod.cs" line_range="61" />
<code_context>
     PostMessageWithCursorPos = (1 << 6),
     SendMessageWithWindowPos = (1 << 7),
     PostMessageWithWindowPos = (1 << 8),
+    AnchoredTouch = (1 << 10),
 }

</code_context>
<issue_to_address>
**issue (bug_risk):** AnchoredTouch is assigned bit 10 (`0x400`) while the existing input methods occupy consecutive bits through bit 8, leaving bit 9 unused. The native controller receives this value unchanged, so the new method does not select the native AnchoredTouch implementation when that ABI value is the next bit.

**Triggers:** When a caller selects `Win32InputMethod.AnchoredTouch` for a Win32 controller.

**Suggested fix:** Use `(1 << 9)` unless bit 9 is intentionally reserved by the native ABI, in which case document and verify that reservation against the native enum.

```suggestion
    AnchoredTouch = (1 << 9),
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

PostMessageWithCursorPos = (1 << 6),
SendMessageWithWindowPos = (1 << 7),
PostMessageWithWindowPos = (1 << 8),
AnchoredTouch = (1 << 10),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): AnchoredTouch 被分配到了第 10 位(0x400),而现有输入方法通过第 8 位连续占用,导致第 9 位未被使用。原生控制器会原样接收此值,因此当该 ABI 值应为下一位时,新方法无法选择原生的 AnchoredTouch 实现。

触发条件: 当调用方为 Win32 控制器选择 Win32InputMethod.AnchoredTouch 时。

建议修复: 使用 (1 << 9),除非原生 ABI 有意保留第 9 位;在这种情况下,应针对原生枚举记录并验证该保留位。

Suggested change
AnchoredTouch = (1 << 10),
AnchoredTouch = (1 << 9),
Original comment in English

issue (bug_risk): AnchoredTouch is assigned bit 10 (0x400) while the existing input methods occupy consecutive bits through bit 8, leaving bit 9 unused. The native controller receives this value unchanged, so the new method does not select the native AnchoredTouch implementation when that ABI value is the next bit.

Triggers: When a caller selects Win32InputMethod.AnchoredTouch for a Win32 controller.

Suggested fix: Use (1 << 9) unless bit 9 is intentionally reserved by the native ABI, in which case document and verify that reservation against the native enum.

Suggested change
AnchoredTouch = (1 << 10),
AnchoredTouch = (1 << 9),

@moomiji
moomiji merged commit d689013 into MaaXYZ:main Aug 28, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants