Skip to content

Commit a9700a1

Browse files
committed
fix: expose raw mouse button transition
1 parent b1ddf9c commit a9700a1

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

include/robot/Mouse.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ class Mouse {
5151
[[nodiscard]] std::expected<void, Error> press(MouseButton button);
5252
[[nodiscard]] std::expected<void, Error> release(MouseButton button);
5353

54+
// Raw button transition with an explicit click count. This is the atom used by
55+
// higher-level language bindings that compose multi-click gestures themselves.
56+
[[nodiscard]] std::expected<void, Error> button(
57+
MouseButton button, ButtonAction action, int clickCount
58+
);
59+
5460
// Press then release at the current position. X1/X2 require
5561
// supportsExtraMouseButtons or the call fails with Unsupported.
5662
[[nodiscard]] std::expected<void, Error> click(
@@ -82,4 +88,4 @@ class Mouse {
8288
backend::IMouseBackend* backend_;
8389
};
8490

85-
} // namespace robot
91+
} // namespace robot

src/common/Mouse.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ std::expected<void, Error> Mouse::release(const MouseButton button) {
6262
return backend_->button(button, ButtonAction::Up, 1);
6363
}
6464

65+
std::expected<void, Error> Mouse::button(
66+
const MouseButton button, const ButtonAction action, const int clickCount
67+
) {
68+
return backend_->button(button, action, clickCount);
69+
}
70+
6571
std::expected<void, Error> Mouse::click(const MouseButton button) {
6672
if (auto r = backend_->button(button, ButtonAction::Down, 1); !r) return r;
6773
return backend_->button(button, ButtonAction::Up, 1);
@@ -110,4 +116,4 @@ std::expected<void, Error> Mouse::scroll(const ScrollDelta delta) {
110116
return backend_->scroll(delta);
111117
}
112118

113-
} // namespace robot
119+
} // namespace robot

0 commit comments

Comments
 (0)