mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-06-30 20:34:47 +03:00
Compare commits
7 Commits
move-featu
...
main-4b93b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b93be3228 | ||
|
|
c32d695cd9 | ||
|
|
82d677f9c8 | ||
|
|
7ef43418c9 | ||
|
|
8f32b7fe96 | ||
|
|
02ac0bf220 | ||
|
|
1b53e58ba9 |
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@@ -174,13 +174,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Download build artifacts
|
- name: Download build artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
- name: Get short SHA
|
||||||
|
id: vars
|
||||||
|
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
|
||||||
- name: Create Pre-Release
|
- name: Create Pre-Release
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
tag_name: ${{ github.event.inputs.name || github.ref_name }}
|
tag_name: ${{ format('{0}-{1}', github.event.inputs.name || github.ref_name, steps.vars.outputs.short_sha) }}
|
||||||
name: ${{ github.event.inputs.name || github.ref_name }}
|
name: ${{ format('{0}-{1}', github.event.inputs.name || github.ref_name, steps.vars.outputs.short_sha) }}
|
||||||
prerelease: true
|
prerelease: true
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
files: |
|
files: |
|
||||||
|
|||||||
@@ -106,8 +106,19 @@ impl MacOSEmulation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// release key when cancelled
|
// Always release the key with the correct CGKeyCode, regardless of
|
||||||
update_modifiers(&modifiers, key as u32, 0);
|
// whether the repeat loop ran. This matches @feschber's review
|
||||||
|
// request: "still release the key repeat task but with the correct
|
||||||
|
// code."
|
||||||
|
//
|
||||||
|
// Do NOT call update_modifiers here: `key` is a Mac CGKeyCode but
|
||||||
|
// update_modifiers expects a Linux evdev scancode, and the two
|
||||||
|
// codespaces collide (e.g. Mac LeftShift=56 == Linux KeyLeftAlt=56,
|
||||||
|
// Mac Down=125 == Linux KeyLeftMeta=125), corrupting modifier
|
||||||
|
// state for chords like Shift+Option+X or Cmd+Down. Modifier state
|
||||||
|
// is owned by the main consume() loop, which already calls
|
||||||
|
// update_modifiers with the correct Linux scancode on the real key
|
||||||
|
// release event from the client.
|
||||||
key_event(event_source.clone(), key, 0, modifiers.get());
|
key_event(event_source.clone(), key, 0, modifiers.get());
|
||||||
});
|
});
|
||||||
self.repeat_task = Some(repeat_task);
|
self.repeat_task = Some(repeat_task);
|
||||||
@@ -157,6 +168,19 @@ extern "C" {
|
|||||||
fn AXIsProcessTrusted() -> bool;
|
fn AXIsProcessTrusted() -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Mac virtual key codes for the four arrow keys.
|
||||||
|
const MAC_KEY_LEFT: u16 = 0x7B;
|
||||||
|
const MAC_KEY_RIGHT: u16 = 0x7C;
|
||||||
|
const MAC_KEY_DOWN: u16 = 0x7D;
|
||||||
|
const MAC_KEY_UP: u16 = 0x7E;
|
||||||
|
|
||||||
|
fn is_arrow_key(key: u16) -> bool {
|
||||||
|
matches!(
|
||||||
|
key,
|
||||||
|
MAC_KEY_LEFT | MAC_KEY_RIGHT | MAC_KEY_DOWN | MAC_KEY_UP
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn key_event(event_source: CGEventSource, key: u16, state: u8, modifiers: XMods) {
|
fn key_event(event_source: CGEventSource, key: u16, state: u8, modifiers: XMods) {
|
||||||
let event = match CGEvent::new_keyboard_event(event_source, key, state != 0) {
|
let event = match CGEvent::new_keyboard_event(event_source, key, state != 0) {
|
||||||
Ok(e) => e,
|
Ok(e) => e,
|
||||||
@@ -165,7 +189,15 @@ fn key_event(event_source: CGEventSource, key: u16, state: u8, modifiers: XMods)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
event.set_flags(to_cgevent_flags(modifiers));
|
let mut flags = to_cgevent_flags(modifiers);
|
||||||
|
// Hardware-generated arrow keys on macOS carry NumericPad + SecondaryFn.
|
||||||
|
// CGEventTap-based hotkey matchers (e.g. tiling window managers) check
|
||||||
|
// these flags to recognize navigation keys; without them synthesized
|
||||||
|
// arrow chords fall through to the focused app.
|
||||||
|
if is_arrow_key(key) {
|
||||||
|
flags |= CGEventFlags::CGEventFlagNumericPad | CGEventFlags::CGEventFlagSecondaryFn;
|
||||||
|
}
|
||||||
|
event.set_flags(flags);
|
||||||
event.post(CGEventTapLocation::HID);
|
event.post(CGEventTapLocation::HID);
|
||||||
log::trace!("key event: {key} {state}");
|
log::trace!("key event: {key} {state}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user