mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-23 21:23:12 +08:00
[fix] support selective mouse button release across desktop platforms
This commit is contained in:
@@ -111,12 +111,17 @@ bool Input::Apply(const RemoteAction& action) {
|
||||
bool Input::Release() {
|
||||
for (const auto& change : ReconcileKeyboardState(keys_, {}))
|
||||
Key({change.key_code, change.scan_code, change.extended}, false);
|
||||
for (int button = 0; button < 3; ++button)
|
||||
if (buttons_ & (1u << button)) Pointer(2 + button * 2, x_, y_, 0);
|
||||
ReleaseMouseButtons(7);
|
||||
// Failed releases remain pending so a later cleanup can retry them.
|
||||
have_key_sequence_ = false;
|
||||
return keys_.empty() && buttons_ == 0;
|
||||
}
|
||||
unsigned Input::ReleaseMouseButtons(unsigned mask) {
|
||||
mask &= 7;
|
||||
for (int button = 0; button < 3; ++button)
|
||||
if (buttons_ & mask & (1u << button)) Pointer(2 + button * 2, x_, y_, 0);
|
||||
return mask & ~buttons_;
|
||||
}
|
||||
bool Input::LockWorkstation() {
|
||||
// The public Harmony shortcut is Meta+L. Never carry a prior remote drag or
|
||||
// modifier into it, and retain failed releases for the normal cleanup path.
|
||||
|
||||
@@ -16,6 +16,7 @@ class Input {
|
||||
bool Configure(int width, int height, int display);
|
||||
bool Apply(const RemoteAction& action);
|
||||
bool Release();
|
||||
unsigned ReleaseMouseButtons(unsigned mask);
|
||||
bool LockWorkstation();
|
||||
private:
|
||||
bool Key(const KeyboardKey& key, bool down);
|
||||
|
||||
Reference in New Issue
Block a user