aboutsummaryrefslogtreecommitdiff
path: root/src/platform/unix_common.rs
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-09-20 17:10:16 +0300
committerGitHub <noreply@github.com>2026-09-20 16:10:16 +0200
commitc00a62dda169beb472fc2f386d0f673ca100dfa4 (patch)
treeff0822ed7bb848e2e340dc382920da7c519f2458 /src/platform/unix_common.rs
parent29f9f4056f344af60f411004fc89c7eb5f357c48 (diff)
fix: preserve delayed mouse reports with confirmed keyboard input (#4247)
* fix: preserve delayed mouse reports with confirmed keyboard input refs #3480 * fix: capture geometry before replaying buffered mouse input refs #3480 --------- Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
Diffstat (limited to 'src/platform/unix_common.rs')
-rw-r--r--src/platform/unix_common.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/platform/unix_common.rs b/src/platform/unix_common.rs
index a937b863..6063edd9 100644
--- a/src/platform/unix_common.rs
+++ b/src/platform/unix_common.rs
@@ -8,6 +8,29 @@ pub(crate) fn classify_child_exit(status: &portable_pty::ExitStatus) -> super::C
}
}
+pub(crate) fn read_fd(fd: std::os::fd::RawFd, data: &mut [u8]) -> std::io::Result<usize> {
+ let result = unsafe { libc::read(fd, data.as_mut_ptr().cast(), data.len()) };
+ if result < 0 {
+ Err(std::io::Error::last_os_error())
+ } else {
+ Ok(result as usize)
+ }
+}
+
+pub(crate) fn poll_fd_readable(fd: std::os::fd::RawFd, timeout_ms: i32) -> std::io::Result<bool> {
+ let mut descriptor = libc::pollfd {
+ fd,
+ events: libc::POLLIN,
+ revents: 0,
+ };
+ let result = unsafe { libc::poll(&mut descriptor, 1, timeout_ms) };
+ if result < 0 {
+ Err(std::io::Error::last_os_error())
+ } else {
+ Ok(result > 0)
+ }
+}
+
pub(crate) fn shutdown_client_stream(stream: &crate::ipc::LocalStream) -> std::io::Result<()> {
let crate::ipc::LocalStream::UdSocket(stream) = stream;
stream.inner().shutdown(std::net::Shutdown::Both)