🐛 Keep the plain pointer through a hide the release chord ended
While the guest's screen is recorded or shared, macOS hides the cursor for the whole recording and draws it into the picture, which the window takes for a game's hide (lane ptrswitch, potluck job m3-max-75965: one setCursorState(x, y, false), then no call while the pointer moved, as in a game). Captured, the pointer then drives the guest's mouse until the share ends, and the release chord freed it only until the next click captured again. The person releasing capture (the release chord, or Release Input on macOS) now leaves the rest of that hide to the tablet, captured again or not, until the guest shows its cursor (Game::released). Losing the keyboard and the window's end do not: a player who switches away from a game and clicks back gets the guest's mouse as before. A player who presses the chord mid-game gets it back once the game shows its cursor and hides it again. The remembered hide is cleared where the guest shows its cursor, or where its hide reads shorter than at the release (a later hide). It is not cleared at capture's end: every show and hide of the guest's reaches Game::shown (the window asks at each), so it cannot outlive its hide, and clearing it there would undo the chord at the next switch away and back. features.md, the design doc and known-issues.md say so; known-issues.md's share entry now says to press the release chord once.
This commit is contained in:
1 parent
f911adda13
commit
eed36c1d89
6 files changed
+281
-30
No files matched your search
@@ -238,12 +238,20 @@ Unset or unparsable values give the defaults below.
|
||||
on the window's display, else where it was held. A button comes up by the
|
||||
route it went down by, so one held across either switch is never left
|
||||
down. Releasing capture, losing the keyboard and closing let the pointer go
|
||||
where it was held. On the desktop, and with a guest whose kext does not
|
||||
take `POINTER_MOTION` (one built before it, the option ROM, Ambrosia's
|
||||
module), the pointer is the absolute one only.
|
||||
where it was held. The release chord, or Release Input on macOS, also keeps
|
||||
the absolute pointer until the guest next shows its cursor, captured again
|
||||
or not: the way out of a hide that is not a game's, such as macOS's while
|
||||
the guest's screen is recorded or shared. So a player who presses it
|
||||
mid-game gets the guest's mouse back only once the game shows its cursor and
|
||||
hides it again, and switching away and back does not bring it back sooner.
|
||||
Losing the keyboard keeps nothing: captured again in a game's hide, the
|
||||
pointer drives the guest's mouse as before. On the desktop, and with a guest
|
||||
whose kext does not take `POINTER_MOTION` (one built before it, the option
|
||||
ROM, Ambrosia's module), the pointer is the absolute one only.
|
||||
`test: game::the_guest_s_mouse_is_driven_once_its_cursor_stays_hidden`,
|
||||
`test: game::a_hide_a_move_ends_drives_nothing`,
|
||||
`test: game::a_new_hide_starts_the_count_over`,
|
||||
`test: game::the_person_s_release_leaves_the_rest_of_that_hide_to_the_tablet`,
|
||||
`test: game::moves_go_to_the_guest_s_mouse_until_it_shows_its_cursor`,
|
||||
`test: game::a_button_comes_up_by_the_route_it_went_down_by`,
|
||||
`test: game::the_wheel_goes_to_the_driven_mouse`,
|
||||
@@ -253,6 +261,7 @@ Unset or unparsable values give the defaults below.
|
||||
`test: native::macos::input::a_button_held_across_the_switch_comes_up_by_its_own_route`,
|
||||
`test: native::macos::input::letting_go_of_a_game_gives_the_pointer_back_where_it_was_held`,
|
||||
`test: native::macos::input::a_cursor_hidden_until_the_mouse_moves_drives_nothing`,
|
||||
`test: native::macos::input::the_release_chord_leaves_the_rest_of_that_hide_to_the_tablet`,
|
||||
`test: reims-vgpu::graphics::tests::displays::a_window_s_device_offers_pointer_motion_and_drives_the_guest_s_mouse`,
|
||||
`test: reims-vgpu-graphics::device::tests::motion::a_crossing_s_hide_is_not_a_game_s`,
|
||||
`test: reims-vgpu-graphics::device::tests::motion::a_guest_that_did_not_take_pointer_motion_gets_none`,
|
||||
@@ -614,15 +623,17 @@ runtime's own device. The switches above apply, and `resolution=` too.
|
||||
raw motion on X11), its buttons pressed meanwhile and the wheel's notches,
|
||||
until the guest shows its cursor, where the host's pointer is let go over
|
||||
it; a button comes up by the route it went down by; releasing capture
|
||||
(Ctrl+Alt+Super), losing the keyboard and closing let it go where it was
|
||||
held. Gone past a shared edge when the guest hides its cursor, the pointer
|
||||
drives the guest's mouse from there. Where the compositor refuses the lock,
|
||||
the pointer stays the absolute one until capture changes.
|
||||
(Ctrl+Alt+Super), losing the keyboard and closing let it go where it was held,
|
||||
and the release chord keeps the absolute pointer until the guest next shows
|
||||
its cursor (Pointer). Gone past a shared edge when the guest hides its cursor,
|
||||
the pointer drives the guest's mouse from there. Where the compositor refuses
|
||||
the lock, the pointer stays the absolute one until capture changes.
|
||||
`test: native::sdl_thread::input::the_tablet_s_events_are_unchanged_outside_a_game`,
|
||||
`test: native::sdl_thread::input::a_hidden_cursor_s_motion_drives_the_guest_s_mouse_until_it_shows`,
|
||||
`test: native::sdl_thread::input::a_button_held_across_the_switch_comes_up_by_its_own_route`,
|
||||
`test: native::sdl_thread::input::letting_go_of_a_game_gives_the_pointer_back_where_it_was_held`,
|
||||
`test: native::sdl_thread::input::a_cursor_hidden_until_the_mouse_moves_drives_nothing`,
|
||||
`test: native::sdl_thread::input::the_release_chord_leaves_the_rest_of_that_hide_to_the_tablet`,
|
||||
`test: reims-vgpu-graphics::device::tests::motion::motion_reaches_a_guest_that_took_it`,
|
||||
`test: reims-vgpu-graphics::device::tests::motion::a_crossing_s_hide_is_not_a_game_s`,
|
||||
`manual` (as on macOS, on a Linux host's guest boot)
|
||||
|
||||
@@ -17,8 +17,13 @@
|
||||
//! lost. Once the guest shows its cursor again ([`Game::shown`]), the pointer is the window's
|
||||
//! again, the host's pointer let go over the guest's cursor where it shows on the window's
|
||||
//! display, else where it was held; letting go of capture (the release chord, the keyboard lost,
|
||||
//! the window's end) lets it go where it was held ([`Game::end`]). On the desktop, where the guest
|
||||
//! shows its cursor, the pointer stays the absolute one, exact.
|
||||
//! the window's end) lets it go where it was held ([`Game::end`]). The person releasing capture
|
||||
//! (the release chord, or the menu's Release Input on macOS) also leaves the rest of that hide to
|
||||
//! the tablet, captured again or not, until the guest shows its cursor ([`Game::released`]): the
|
||||
//! way out of a hide that is not a game's, such as the one macOS keeps while the guest's screen is
|
||||
//! recorded or shared. The keyboard lost does not, so a player who switches away from a game and
|
||||
//! clicks back gets the guest's mouse again. On the desktop, where the guest shows its cursor, the
|
||||
//! pointer stays the absolute one, exact.
|
||||
//!
|
||||
//! A button goes up by the route it went down by: one pressed while the guest's mouse is driven
|
||||
//! goes down and up through it, one pressed before through the tablet, whenever each comes up
|
||||
@@ -56,6 +61,12 @@ pub struct Game {
|
||||
/// tablet took ([`Self::begin`]): `None` while the guest shows its cursor, before that move,
|
||||
/// and while the pointer drives the guest's mouse.
|
||||
first_move: Option<u64>,
|
||||
/// How long the guest had hidden its cursor when the person released capture while the pointer
|
||||
/// drove the guest's mouse ([`Self::released`]): the rest of that hide is the tablet's. `None`
|
||||
/// once the guest shows its cursor, or its hide reads shorter than it did then (a later hide).
|
||||
/// Capture's end leaves it: every show and hide of the guest's reaches [`Self::shown`] (the
|
||||
/// window asks at each), so it never outlives its hide.
|
||||
released_hide: Option<u64>,
|
||||
}
|
||||
|
||||
impl Game {
|
||||
@@ -77,7 +88,8 @@ impl Game {
|
||||
|
||||
/// Whether the captured pointer at `point`, in the window's points, begins to drive the
|
||||
/// guest's mouse `motion`: the guest has hidden its cursor on every display and kept it
|
||||
/// hidden for [`SETTLE_NS`] past the hide's first move, and the OS did not refuse the lock
|
||||
/// hidden for [`SETTLE_NS`] past the hide's first move, the person did not release capture on
|
||||
/// this hide while the pointer drove the guest's mouse, and the OS did not refuse the lock
|
||||
/// since capture last changed. Where it does, the host's pointer is held there
|
||||
/// ([`Hold::Raw`]). Where it does not, the move is the window's, as while the guest shows its
|
||||
/// cursor: the hide's first move goes to the tablet, and a cursor hidden until the mouse
|
||||
@@ -87,6 +99,9 @@ impl Game {
|
||||
return None;
|
||||
}
|
||||
let hidden = self.hidden_for(motion)?;
|
||||
if self.released_hide.is_some() {
|
||||
return None;
|
||||
}
|
||||
let Some(first) = self.first_move else {
|
||||
self.first_move = Some(hidden);
|
||||
return None;
|
||||
@@ -101,16 +116,18 @@ impl Game {
|
||||
}
|
||||
|
||||
/// How long the guest has hidden its cursor on every display, `None` while it shows it on
|
||||
/// one. The hide's first move is forgotten where the guest shows its cursor, or where the
|
||||
/// hide reads shorter than it did at that move: a later hide, the cursor shown between.
|
||||
/// one. The hide's first move, and a hide the person released capture on, are forgotten where
|
||||
/// the guest shows its cursor, or where the hide reads shorter than it did then: a later hide,
|
||||
/// the cursor shown between.
|
||||
fn hidden_for(&mut self, motion: &dyn PointerMotion) -> Option<u64> {
|
||||
let hidden = motion.hidden_for();
|
||||
if self
|
||||
.first_move
|
||||
.is_some_and(|first| hidden.is_none_or(|now| now < first))
|
||||
{
|
||||
let over = |then: u64| hidden.is_none_or(|now| now < then);
|
||||
if self.first_move.is_some_and(over) {
|
||||
self.first_move = None;
|
||||
}
|
||||
if self.released_hide.is_some_and(over) {
|
||||
self.released_hide = None;
|
||||
}
|
||||
hidden
|
||||
}
|
||||
|
||||
@@ -218,6 +235,15 @@ impl Game {
|
||||
Some(Hold::Unlock(held))
|
||||
}
|
||||
|
||||
/// The person released capture (the release chord, or the menu's Release Input): as
|
||||
/// [`Self::end`], and where the pointer drove the guest's `motion`, the rest of that hide is
|
||||
/// the tablet's, captured again or not, until the guest shows its cursor ([`Self::begin`]).
|
||||
pub fn released(&mut self, motion: Option<&dyn PointerMotion>) -> Option<Hold> {
|
||||
let hold = self.end()?;
|
||||
self.released_hide = motion.and_then(PointerMotion::hidden_for);
|
||||
Some(hold)
|
||||
}
|
||||
|
||||
/// The OS refused to lock the host's pointer: the pointer is the window's again, where it
|
||||
/// was held, and it does not try again until capture changes.
|
||||
pub fn refused(&mut self) -> Option<Hold> {
|
||||
@@ -461,4 +487,54 @@ pub(crate) mod tests {
|
||||
);
|
||||
assert_eq!(begun(&mut game, &mouse, (1.0, 1.0)), Some(Hold::Raw));
|
||||
}
|
||||
|
||||
/// The person releasing capture while the pointer drives the guest's mouse leaves the rest of
|
||||
/// that hide to the tablet, however long it goes on and however often capture comes back, as
|
||||
/// a recorded or shared screen keeps the cursor hidden; once the guest shows its cursor the
|
||||
/// next hide is a game's again, as is a later hide whose show went unseen. Capture's other
|
||||
/// ends (the keyboard lost, the window's end) leave the hide a game's
|
||||
#[test]
|
||||
fn the_person_s_release_leaves_the_rest_of_that_hide_to_the_tablet() {
|
||||
let mouse = Mouse::default();
|
||||
let mut game = Game::new();
|
||||
assert_eq!(begun(&mut game, &mouse, (3.0, 4.0)), Some(Hold::Raw));
|
||||
mouse.hide_for(2 * SETTLE_NS);
|
||||
assert_eq!(game.released(Some(&mouse)), Some(Hold::Unlock((3.0, 4.0))));
|
||||
for (n, at) in [(3, (5.0, 5.0)), (20, (6.0, 5.0)), (200, (7.0, 5.0))] {
|
||||
mouse.hide_for(n * SETTLE_NS);
|
||||
assert_eq!(game.begin(&mouse, at), None, "{n} settles into the hide");
|
||||
assert_eq!(game.end(), None, "capture changes");
|
||||
}
|
||||
mouse.show();
|
||||
assert_eq!(game.shown(&mouse, None), None);
|
||||
assert_eq!(
|
||||
begun(&mut game, &mouse, (5.0, 5.0)),
|
||||
Some(Hold::Raw),
|
||||
"the next hide"
|
||||
);
|
||||
|
||||
mouse.hide_for(30 * SETTLE_NS);
|
||||
assert_eq!(game.released(Some(&mouse)), Some(Hold::Unlock((5.0, 5.0))));
|
||||
assert_eq!(
|
||||
begun(&mut game, &mouse, (6.0, 6.0)),
|
||||
Some(Hold::Raw),
|
||||
"a later hide, its show unseen"
|
||||
);
|
||||
|
||||
// The keyboard lost: the same hide, captured again, is a game's.
|
||||
mouse.hide_for(40 * SETTLE_NS);
|
||||
assert_eq!(game.end(), Some(Hold::Unlock((6.0, 6.0))));
|
||||
mouse.hide_for(41 * SETTLE_NS);
|
||||
assert_eq!(
|
||||
game.begin(&mouse, (7.0, 7.0)),
|
||||
None,
|
||||
"the next capture's first move"
|
||||
);
|
||||
mouse.hide_for(42 * SETTLE_NS);
|
||||
assert_eq!(
|
||||
game.begin(&mouse, (7.0, 7.0)),
|
||||
Some(Hold::Raw),
|
||||
"the keyboard lost leaves the hide a game's"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,9 @@
|
||||
//! `Y`, else their deltas), its buttons pressed meanwhile and a mouse wheel's notches to the
|
||||
//! guest's mouse ([`crate::game`]), until the guest shows its cursor again, where the host's
|
||||
//! pointer is let go over it; a button comes up by the route it went down by. Releasing
|
||||
//! capture, losing the keyboard and closing let the pointer go where it was held.
|
||||
//! capture, losing the keyboard and closing let the pointer go where it was held; releasing
|
||||
//! capture (the release chord, Release Input) also leaves the rest of that hide to the tablet,
|
||||
//! captured again or not, until the guest shows its cursor ([`Game::released`]).
|
||||
//!
|
||||
//! While captured, the window holds the system's hot keys off ([`super::hotkeys`]), the host's
|
||||
//! pointer over the image ([`InputState::pointer_confinement`], which the view applies), and its
|
||||
@@ -410,14 +412,23 @@ impl InputLogic {
|
||||
}
|
||||
}
|
||||
|
||||
/// Capture ended (released, the keyboard lost, the window's end): the pointer driving the
|
||||
/// guest's mouse is the window's again, where it was held.
|
||||
/// Capture ended (the keyboard lost, the window's end): the pointer driving the guest's mouse
|
||||
/// is the window's again, where it was held.
|
||||
fn end_game(&mut self) {
|
||||
if let Some(hold) = self.game.end() {
|
||||
self.hold = Some(hold);
|
||||
}
|
||||
}
|
||||
|
||||
/// The person released capture (the release chord, Release Input): as [`Self::end_game`],
|
||||
/// and the rest of a hide the pointer drove the guest's mouse in is the tablet's
|
||||
/// ([`Game::released`]).
|
||||
fn release_game(&mut self) {
|
||||
if let Some(hold) = self.game.released(self.motion.as_deref()) {
|
||||
self.hold = Some(hold);
|
||||
}
|
||||
}
|
||||
|
||||
/// The wheel or a trackpad scrolled: as smooth scrolling when `smooth` (the host takes
|
||||
/// it), else as notches.
|
||||
fn scrolled(&mut self, input: ScrollInput, smooth: bool, cx: &ViewContext) -> Reaction {
|
||||
@@ -526,7 +537,7 @@ impl InputLogic {
|
||||
return Reaction::default();
|
||||
}
|
||||
self.lift_keys();
|
||||
self.end_game();
|
||||
self.release_game();
|
||||
Reaction::capture(self.capture.release())
|
||||
}
|
||||
|
||||
@@ -558,7 +569,7 @@ impl InputLogic {
|
||||
fn release_capture(&mut self) -> Reaction {
|
||||
let was = self.capture.release();
|
||||
self.lift_keys();
|
||||
self.end_game();
|
||||
self.release_game();
|
||||
Reaction::capture(was)
|
||||
}
|
||||
|
||||
@@ -1785,6 +1796,83 @@ mod tests {
|
||||
assert_eq!(mouse.take(), vec![]);
|
||||
}
|
||||
|
||||
/// The release chord or Release Input while the pointer drives the guest's mouse leaves the
|
||||
/// rest of that hide to the tablet, as a recorded or shared screen keeps the cursor hidden:
|
||||
/// captured again by a click, every move is the tablet's however long the hide, until the
|
||||
/// guest shows its cursor, and the next hide is a game's again. Losing the keyboard instead
|
||||
/// leaves the hide a game's: captured again, it switches as before
|
||||
#[test]
|
||||
fn the_release_chord_leaves_the_rest_of_that_hide_to_the_tablet() {
|
||||
let mouse = Arc::new(Mouse::default());
|
||||
let in_game = || {
|
||||
let mut logic = captured_with(&mouse);
|
||||
mouse.hide_for(0);
|
||||
logic.moved((1.0, 0.0), &at((599.0, 350.0)));
|
||||
mouse.hide_for(SETTLE_NS);
|
||||
logic.moved((1.0, 0.0), &at((600.0, 350.0)));
|
||||
assert_eq!(logic.hold.take(), Some(Hold::Raw));
|
||||
sent(&mut logic);
|
||||
logic
|
||||
};
|
||||
let chord: fn(&mut InputLogic) = |logic| {
|
||||
logic.flags_changed(key(KVK_CONTROL, L_CONTROL));
|
||||
logic.flags_changed(key(KVK_OPTION, L_CONTROL | L_OPTION));
|
||||
logic.flags_changed(key(KVK_COMMAND, L_CONTROL | L_OPTION | L_COMMAND));
|
||||
};
|
||||
let menu: fn(&mut InputLogic) = |logic| {
|
||||
logic.release_capture();
|
||||
};
|
||||
for (how, release) in [("the chord", chord), ("Release Input", menu)] {
|
||||
let mut logic = in_game();
|
||||
release(&mut logic);
|
||||
assert!(!logic.capture.is_captured(), "{how}");
|
||||
assert_eq!(logic.hold.take(), Some(Hold::Unlock((600.0, 350.0))));
|
||||
logic.button_down(BUTTON_LEFT, 0, &at((600.0, 350.0)));
|
||||
logic.button_up(BUTTON_LEFT, &at((600.0, 350.0)));
|
||||
assert!(logic.capture.is_captured());
|
||||
sent(&mut logic);
|
||||
for (n, x) in [(3, 595.0), (20, 610.0), (200, 625.0)] {
|
||||
mouse.hide_for(n * SETTLE_NS);
|
||||
logic.moved((1.0, 0.0), &at((x, 350.0)));
|
||||
}
|
||||
assert_eq!(logic.hold.take(), None, "{how}: the same hide");
|
||||
assert_eq!(
|
||||
sent(&mut logic),
|
||||
vec![
|
||||
pointer(990, 600, 0),
|
||||
pointer(1020, 600, 0),
|
||||
pointer(1050, 600, 0),
|
||||
],
|
||||
"{how}: every move the tablet's"
|
||||
);
|
||||
mouse.show();
|
||||
logic.cursor_changed(&at((625.0, 350.0)));
|
||||
mouse.hide_for(0);
|
||||
logic.moved((1.0, 0.0), &at((640.0, 350.0)));
|
||||
mouse.hide_for(SETTLE_NS);
|
||||
logic.moved((1.0, 0.0), &at((655.0, 350.0)));
|
||||
assert_eq!(logic.hold.take(), Some(Hold::Raw), "{how}: the next hide");
|
||||
}
|
||||
|
||||
let mut logic = in_game();
|
||||
logic.focus_lost();
|
||||
assert_eq!(logic.hold.take(), Some(Hold::Unlock((600.0, 350.0))));
|
||||
logic.button_down(BUTTON_LEFT, 0, &at((600.0, 350.0)));
|
||||
logic.button_up(BUTTON_LEFT, &at((600.0, 350.0)));
|
||||
assert!(logic.capture.is_captured());
|
||||
mouse.hide_for(3 * SETTLE_NS);
|
||||
logic.moved((1.0, 0.0), &at((595.0, 350.0)));
|
||||
assert_eq!(logic.hold.take(), None, "the next capture's first move");
|
||||
mouse.hide_for(4 * SETTLE_NS);
|
||||
logic.moved((1.0, 0.0), &at((610.0, 350.0)));
|
||||
assert_eq!(
|
||||
logic.hold.take(),
|
||||
Some(Hold::Raw),
|
||||
"the keyboard lost leaves the hide a game's"
|
||||
);
|
||||
assert_eq!(mouse.take(), vec![]);
|
||||
}
|
||||
|
||||
/// The window's end, while the host's callback for the first key-up of a lift runs, drops
|
||||
/// the other key-ups: no callback of the host's starts after the end has returned
|
||||
#[test]
|
||||
|
||||
@@ -51,7 +51,8 @@
|
||||
//! buttons pressed meanwhile and its wheel to the guest's mouse ([`crate::game`]), until the
|
||||
//! guest shows its cursor again, where the host's pointer is let go over it; a button comes up
|
||||
//! by the route it went down by. Releasing capture, losing the keyboard and closing let the
|
||||
//! pointer go where it was held.
|
||||
//! pointer go where it was held; releasing capture also leaves the rest of that hide to the
|
||||
//! tablet, captured again or not, until the guest shows its cursor ([`Game::released`]).
|
||||
//! - **Past the image's edge**, where the host gives the window the guest's other displays
|
||||
//! ([`crate::PointerBeyond`]): the captured pointer moving toward an edge another display meets,
|
||||
//! within reach of it, goes on onto it ([`crate::beyond`]). The window locks the host's pointer
|
||||
@@ -565,10 +566,13 @@ impl Input {
|
||||
}
|
||||
}
|
||||
|
||||
/// Releases capture, lifting every key held.
|
||||
/// Releases capture (the release chord), lifting every key held: the rest of a hide the
|
||||
/// pointer drove the guest's mouse in is the tablet's ([`Game::released`]).
|
||||
pub(crate) fn release_capture(&mut self) -> Reaction {
|
||||
self.lift_keys();
|
||||
self.end_game();
|
||||
if let Some(hold) = self.game.released(self.motion.as_deref()) {
|
||||
self.hold = Some(hold);
|
||||
}
|
||||
self.let_go_away();
|
||||
Reaction {
|
||||
capture_changed: self.capture.release(),
|
||||
@@ -1474,6 +1478,73 @@ mod tests {
|
||||
assert_eq!(mouse.take(), vec![]);
|
||||
}
|
||||
|
||||
/// The release chord while the pointer drives the guest's mouse leaves the rest of that hide
|
||||
/// to the tablet, as a recorded or shared screen keeps the cursor hidden: captured again by a
|
||||
/// click, every move is the tablet's however long the hide, until the guest shows its cursor,
|
||||
/// and the next hide is a game's again. Losing the keyboard instead leaves the hide a game's:
|
||||
/// captured again, it switches as before
|
||||
#[test]
|
||||
fn the_release_chord_leaves_the_rest_of_that_hide_to_the_tablet() {
|
||||
let mouse = Arc::new(Mouse::default());
|
||||
let in_game = || {
|
||||
let mut input = captured_by(Some(Arc::clone(&mouse)));
|
||||
mouse.hide_for(0);
|
||||
input.moved(&at((25.0, 10.0)));
|
||||
mouse.hide_for(SETTLE_NS);
|
||||
input.moved(&at((30.0, 10.0)));
|
||||
assert_eq!(input.take_hold(), Some(Hold::Raw));
|
||||
input.take();
|
||||
input
|
||||
};
|
||||
let mut input = in_game();
|
||||
for usage in [0xE0, 0xE2, 0xE3] {
|
||||
input.key(usage, true, false);
|
||||
}
|
||||
assert!(!input.is_captured());
|
||||
assert_eq!(input.take_hold(), Some(Hold::Unlock((30.0, 10.0))));
|
||||
input.button_down(BUTTON_LEFT, 5_000_000_000, &at((30.0, 10.0)));
|
||||
input.button_up(BUTTON_LEFT, &at((30.0, 10.0)));
|
||||
assert!(input.is_captured());
|
||||
input.take();
|
||||
for (n, x) in [(3, 37.5), (20, 50.0), (200, 62.5)] {
|
||||
mouse.hide_for(n * SETTLE_NS);
|
||||
input.moved(&at((x, 10.0)));
|
||||
}
|
||||
assert_eq!(input.take_hold(), None, "the same hide, captured again");
|
||||
assert!(!input.drives_the_guest_s_mouse());
|
||||
assert_eq!(
|
||||
input.take(),
|
||||
vec![pointer(75, 20, 0), pointer(100, 20, 0), pointer(125, 20, 0)],
|
||||
"every move the tablet's"
|
||||
);
|
||||
mouse.show();
|
||||
input.cursor_changed(&at((62.5, 10.0)));
|
||||
mouse.hide_for(0);
|
||||
input.moved(&at((75.0, 10.0)));
|
||||
mouse.hide_for(SETTLE_NS);
|
||||
input.moved(&at((80.0, 10.0)));
|
||||
assert_eq!(input.take_hold(), Some(Hold::Raw), "the next hide");
|
||||
|
||||
let mut input = in_game();
|
||||
input.focus_lost();
|
||||
assert_eq!(input.take_hold(), Some(Hold::Unlock((30.0, 10.0))));
|
||||
input.focus_gained(10_000_000_000);
|
||||
input.button_down(BUTTON_LEFT, 12_000_000_000, &at((30.0, 10.0)));
|
||||
input.button_up(BUTTON_LEFT, &at((30.0, 10.0)));
|
||||
assert!(input.is_captured());
|
||||
mouse.hide_for(3 * SETTLE_NS);
|
||||
input.moved(&at((37.5, 10.0)));
|
||||
assert_eq!(input.take_hold(), None, "the next capture's first move");
|
||||
mouse.hide_for(4 * SETTLE_NS);
|
||||
input.moved(&at((50.0, 10.0)));
|
||||
assert_eq!(
|
||||
input.take_hold(),
|
||||
Some(Hold::Raw),
|
||||
"the keyboard lost leaves the hide a game's"
|
||||
);
|
||||
assert_eq!(mouse.take(), vec![]);
|
||||
}
|
||||
|
||||
/// SDL's buttons to the host's bits
|
||||
#[test]
|
||||
fn sdl_buttons_are_the_hosts_bits() {
|
||||
|
||||
@@ -4414,7 +4414,13 @@ tablet. So the guest gets a mouse of its own, whose motion has no edge:
|
||||
show of its cursor (the game's menu), the pointer is the
|
||||
tablet's again, the host's pointer let go over the guest's cursor where it
|
||||
shows on the window's display, else where it was held; releasing capture,
|
||||
losing the keyboard and closing let it go where it was held. A button comes
|
||||
losing the keyboard and closing let it go where it was held. The release
|
||||
chord (and macOS's Release Input) also leaves the rest of that hide to the
|
||||
tablet, captured again or not, until the guest shows its cursor: the way out
|
||||
of a hide that is not a game's, as macOS keeps one while the guest's screen
|
||||
is recorded or shared (lane ptrswitch, potluck job m3-max-75965: the
|
||||
framebuffer saw one `setCursorState(x, y, false)` and no call while the
|
||||
pointer moved, as in a game's hide). A button comes
|
||||
up by the route it went down by, the tablet or the guest's mouse, so one
|
||||
held across either switch never stays down. On a device of several
|
||||
displays, a pointer gone past a shared edge ("A drag across displays")
|
||||
|
||||
@@ -117,11 +117,10 @@ has captured input, the pointer switches to the way it works for games 50 ms aft
|
||||
the mouse, and stays that way until the recording or share stops. The guest then moves the cursor
|
||||
by your mouse's own movement and the guest's mouse settings rather than your host's pointer speed,
|
||||
so it can feel slower. Your host's pointer also stays hidden inside the window, and can't move on
|
||||
to another of the VM's displays. Releasing capture (Ctrl+Alt+Super, Ctrl+Alt+Win on Windows, or
|
||||
⌃⌥⌘ on a Mac) gives you the normal pointer back, but only until you click into the guest's picture
|
||||
again: once you're captured and move the mouse, it switches again. To avoid the switch for the whole
|
||||
share, turn off **Capture input** in the VM's settings (`reims-ctl set <vm> --capture false`), which
|
||||
applies at the VM's next start.
|
||||
to another of the VM's displays. To get the normal pointer back, press the release chord once
|
||||
(Ctrl+Alt+Super, Ctrl+Alt+Win on Windows, or ⌃⌥⌘ on a Mac, where Window ▸ Release Input does the
|
||||
same). The pointer then stays normal until macOS shows its cursor again, which it does when the
|
||||
recording or share stops, even if you click back into the guest's picture meanwhile.
|
||||
|
||||
## On a Mac
|
||||
|
||||
|
||||
Reference in new issue
Block a user