Skip to content

Commit 5cd833c

Browse files
committed
[*] fix: wayshot-cursor send the same position twice and portal cursor monitor doesn't exit when stop recording
1 parent d5a4697 commit 5cd833c

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

.github/workflows/linux-portal.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
cp -rf release/$binary_name-cursor $binary_name-cursor
5555
tar -zcf $output $binary_name-cursor
5656
cp $output ..
57-
echo "ASSET=$output" >> $GITHUB_ENV
57+
echo "CURSOR_ASSET=$output" >> $GITHUB_ENV
5858
5959
output="$binary_name-portal-${{ env.VERSION }}-x86_64-linux.deb"
6060
cp -rf $binary_name.deb $output
@@ -68,6 +68,7 @@ jobs:
6868
with:
6969
files: |
7070
${{ env.ASSET }}
71+
${{ env.CURSOR_ASSET }}
7172
${{ env.DEB_ASSET }}
7273
7374
- run: echo "🍏 This job's status is ${{ job.status }}."

lib/screen-capture-wayland-portal/src/cursor.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ fn process_mouse_positions(
4040
callback: &mut (impl FnMut(CursorPosition) + Send + 'static),
4141
) -> Result<()> {
4242
loop {
43+
if config.stop_sig.load(Ordering::Relaxed) {
44+
break;
45+
}
46+
4347
let pos = receive_position(stream)?;
4448
let x = ((pos >> 32) & 0x0000_0000_ffff_ffff) as i32;
4549
let y = (pos & 0x0000_0000_ffff_ffff) as i32;
@@ -59,6 +63,8 @@ fn process_mouse_positions(
5963

6064
std::thread::sleep(Duration::from_millis(5));
6165
}
66+
67+
Ok(())
6268
}
6369

6470
fn receive_position(stream: &mut UnixStream) -> Result<u64> {

lib/screen-capture/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub trait ScreenCapture {
2828
cb: impl FnMut(CaptureStreamCallbackData),
2929
) -> Result<CaptureStatus, ScreenCaptureError>;
3030

31+
// don't same the same cursor position twice
3132
fn monitor_cursor_position(
3233
&mut self,
3334
config: MonitorCursorPositionConfig,

wayshot-cursor/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ fn server() -> Result<()> {
7272
log::warn!("send position failed: {e}");
7373
break;
7474
}
75+
76+
LAST_SENT_POSITION.store(pos, Ordering::Relaxed);
7577
}
7678

7779
std::thread::sleep(std::time::Duration::from_millis(5));

wayshot/src/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub static VERSION: &str = "v0.2.9";
1+
pub static VERSION: &str = "v0.2.9-beta1";

0 commit comments

Comments
 (0)