diff --git a/Cargo.lock b/Cargo.lock index 8c426f0..a3a9aa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,16 +31,14 @@ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "bindgen" -version = "0.69.5" +version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ "bitflags 2.9.1", "cexpr", "clang-sys", "itertools", - "lazy_static", - "lazycell", "log", "prettyplease", "proc-macro2", @@ -49,7 +47,6 @@ dependencies = [ "rustc-hash", "shlex", "syn", - "which", ] [[package]] @@ -276,15 +273,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" -[[package]] -name = "home" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" -dependencies = [ - "windows-sys", -] - [[package]] name = "humantime" version = "2.2.0" @@ -333,18 +321,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.172" @@ -363,9 +339,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.15" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "log" @@ -564,15 +540,15 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustix" -version = "0.38.44" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags 2.9.1", "errno", @@ -630,9 +606,9 @@ checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" [[package]] name = "smithay-client-toolkit" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" dependencies = [ "bitflags 2.9.1", "cursor-icon", @@ -646,6 +622,8 @@ dependencies = [ "wayland-csd-frame", "wayland-cursor", "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", "wayland-protocols-wlr", "wayland-scanner", "xkeysym", @@ -696,18 +674,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.69" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.69" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", @@ -815,9 +793,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wayland-backend" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe770181423e5fc79d3e2a7f4410b7799d5aab1de4372853de3c6aa13ca24121" +checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35" dependencies = [ "cc", "downcast-rs", @@ -828,9 +806,9 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.10" +version = "0.31.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978fa7c67b0847dbd6a9f350ca2569174974cd4082737054dbb7fbb79d7d9a61" +checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d" dependencies = [ "bitflags 2.9.1", "rustix", @@ -851,9 +829,9 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.31.10" +version = "0.31.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65317158dec28d00416cb16705934070aef4f8393353d41126c54264ae0f182" +checksum = "447ccc440a881271b19e9989f75726d60faa09b95b0200a9b7eb5cc47c3eeb29" dependencies = [ "rustix", "wayland-client", @@ -862,9 +840,9 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.32.8" +version = "0.32.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779075454e1e9a521794fed15886323ea0feda3f8b0fc1390f5398141310422a" +checksum = "efa790ed75fbfd71283bd2521a1cfdc022aabcc28bdcff00851f9e4ae88d9901" dependencies = [ "bitflags 2.9.1", "wayland-backend", @@ -873,6 +851,32 @@ dependencies = [ "wayland-server", ] +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.9.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfe33d551eb8bffd03ff067a8b44bb963919157841a99957151299a6307d19c" +dependencies = [ + "bitflags 2.9.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + [[package]] name = "wayland-protocols-wlr" version = "0.3.8" @@ -888,9 +892,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.31.6" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484" +checksum = "54cb1e9dc49da91950bdfd8b848c49330536d9d1fb03d4bfec8cae50caa50ae3" dependencies = [ "proc-macro2", "quick-xml 0.37.5", @@ -899,9 +903,9 @@ dependencies = [ [[package]] name = "wayland-server" -version = "0.31.9" +version = "0.31.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485dfb8ccf0daa0d34625d34e6ac15f99e550a7999b6fd88a0835ccd37655785" +checksum = "fcbd4f3aba6c9fba70445ad2a484c0ef0356c1a9459b1e8e435bedc1971a6222" dependencies = [ "bitflags 2.9.1", "downcast-rs", @@ -912,25 +916,13 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.31.6" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615" +checksum = "34949b42822155826b41db8e5d0c1be3a2bd296c747577a43a3e6daefc296142" dependencies = [ "pkg-config", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi-util" version = "0.1.9" @@ -1108,9 +1100,9 @@ dependencies = [ [[package]] name = "xcb-util-cursor" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4566d84acf11570d684ae89c6da06ab0452aa647a80a7b2f4bc741733e4ac" +checksum = "f361f49c89d5aa2e9e44bd5c38ac6865b9338d48b58a980015881df5c4484eff" dependencies = [ "xcb", "xcb-util-cursor-sys", @@ -1118,9 +1110,9 @@ dependencies = [ [[package]] name = "xcb-util-cursor-sys" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2675ff3564723a6c85e22cedcc05ae84da546470aa1646931d5efdfba3ba601" +checksum = "7df0ea411b072fa53e1f4f5a6543649712cb9640c0de7686cca8edaf6971b117" dependencies = [ "bindgen", "pkg-config", @@ -1156,6 +1148,7 @@ dependencies = [ "testwl", "vergen-gitcl", "wayland-client", + "wayland-cursor", "wayland-protocols", "wayland-server", "wl_drm", diff --git a/Cargo.toml b/Cargo.toml index 69b4bbd..41e4e62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,11 +2,14 @@ members = ["macros", "testwl", "wl_drm"] [workspace.dependencies] -wayland-client = "0.31.2" -wayland-protocols = "0.32.0" -wayland-scanner = "0.31.1" -wayland-server = "0.31.1" -rustix = "0.38.31" +wayland-client = "0.31.11" +# We don't directly use wayland-cursor, but we need to set its version so +# smithay-client-toolkit does not depend on an older version with rustix < 1 +wayland-cursor = "0.31.11" +wayland-protocols = "0.32.9" +wayland-scanner = "0.31.7" +wayland-server = "0.31.10" +rustix = "1.1.2" [workspace.lints.clippy] all = "deny" @@ -30,14 +33,15 @@ crate-type = ["lib"] bitflags = "2.5.0" rustix = { workspace = true, features = ["event"] } wayland-client.workspace = true +wayland-cursor.workspace = true wayland-protocols = { workspace = true, features = ["client", "server", "staging", "unstable"] } wayland-server.workspace = true xcb = { version = "1.6.0", features = ["composite", "randr", "res"] } wl_drm = { path = "wl_drm" } log = "0.4.21" pretty_env_logger = "0.5.0" -xcb-util-cursor = "0.3.2" -smithay-client-toolkit = { version = "0.19.1", default-features = false } +xcb-util-cursor = "0.3.4" +smithay-client-toolkit = { version = "0.20.0", default-features = false } sd-notify = { version = "0.4.2", optional = true } macros = { version = "0.1.0", path = "macros" } diff --git a/src/lib.rs b/src/lib.rs index 452aa62..6ae2084 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -119,7 +119,7 @@ pub fn main(mut data: impl RunData) -> Option<()> { unsafe { Box::from_raw(data as *mut _) } } - let connection = match poll(&mut ready_fds, -1) { + let connection = match poll(&mut ready_fds, None) { Ok(_) => { if !ready_fds[1].revents().is_empty() { let status = xwayland_exit_code(&mut finish_rx); @@ -156,7 +156,7 @@ pub fn main(mut data: impl RunData) -> Option<()> { ]; loop { - match poll(&mut fds, -1) { + match poll(&mut fds, None) { Ok(_) => { if !fds[3].revents().is_empty() { let status = xwayland_exit_code(&mut quit_rx); @@ -219,7 +219,7 @@ pub fn main(mut data: impl RunData) -> Option<()> { xstate.update_global_scale(scale); } - match poll(&mut fds, -1) { + match poll(&mut fds, None) { Ok(_) => { if !fds[3].revents().is_empty() { let status = xwayland_exit_code(&mut quit_rx); diff --git a/src/server/mod.rs b/src/server/mod.rs index 1e10520..fd12bdb 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -11,7 +11,7 @@ use crate::{X11Selection, XConnection}; use clientside::MyWorld; use hecs::{Entity, World}; use log::{debug, warn}; -use rustix::event::{poll, PollFd, PollFlags}; +use rustix::event::{poll, PollFd, PollFlags, Timespec}; use smithay_client_toolkit::activation::ActivationState; use std::collections::{HashMap, HashSet}; use std::ops::{Deref, DerefMut}; @@ -569,7 +569,11 @@ impl ServerState { if let Some(r) = self.queue.prepare_read() { let fd = r.connection_fd(); let pollfd = PollFd::new(&fd, PollFlags::IN); - if poll(&mut [pollfd], 0).unwrap() > 0 { + let timeout = Some(&Timespec { + tv_sec: 0, + tv_nsec: 0, + }); + if poll(&mut [pollfd], timeout).unwrap() > 0 { let _ = r.read(); } } diff --git a/src/server/tests.rs b/src/server/tests.rs index babd533..a436561 100644 --- a/src/server/tests.rs +++ b/src/server/tests.rs @@ -2,7 +2,7 @@ use super::{selection::Clipboard, InnerServerState, NoConnection, ServerState, W use crate::server::selection::{Primary, SelectionType}; use crate::xstate::{SetState, WinSize, WmName}; use crate::XConnection; -use rustix::event::{poll, PollFd, PollFlags}; +use rustix::event::{poll, PollFd, PollFlags, Timespec}; use std::collections::HashMap; use std::io::Write; use std::os::fd::{AsRawFd, BorrowedFd}; @@ -361,7 +361,11 @@ impl EarlyTestFixture { // Handle initial globals roundtrip setup requirement let thread = std::thread::spawn(move || { let mut pollfd = [PollFd::from_borrowed_fd(testwl.poll_fd(), PollFlags::IN)]; - if poll(&mut pollfd, 1000).unwrap() == 0 { + let timeout = Some(&Timespec { + tv_sec: 1, + tv_nsec: 0, + }); + if poll(&mut pollfd, timeout).unwrap() == 0 { panic!("Did not get events for testwl!"); } testwl.dispatch(); @@ -1392,11 +1396,15 @@ fn copy_from_wayland() { s.spawn(|| { let pollfd = unsafe { BorrowedFd::borrow_raw(f.testwl.poll_fd().as_raw_fd()) }; let mut pollfd = [PollFd::from_borrowed_fd(pollfd, PollFlags::IN)]; - if poll(&mut pollfd, 100).unwrap() == 0 { + let timeout = Some(&Timespec { + tv_sec: 0, + tv_nsec: 100_000_000, + }); + if poll(&mut pollfd, timeout).unwrap() == 0 { panic!("Did not get events for testwl!"); } f.testwl.dispatch(); - while poll(&mut pollfd, 100).unwrap() > 0 { + while poll(&mut pollfd, timeout).unwrap() > 0 { f.testwl.dispatch(); } }); @@ -1452,11 +1460,15 @@ fn selection_x11_then_wayland() { s.spawn(|| { let pollfd = unsafe { BorrowedFd::borrow_raw(f.testwl.poll_fd().as_raw_fd()) }; let mut pollfd = [PollFd::from_borrowed_fd(pollfd, PollFlags::IN)]; - if poll(&mut pollfd, 100).unwrap() == 0 { + let timeout = Some(&Timespec { + tv_sec: 0, + tv_nsec: 100_000_000, + }); + if poll(&mut pollfd, timeout).unwrap() == 0 { panic!("Did not get events for testwl!"); } f.testwl.dispatch(); - while poll(&mut pollfd, 100).unwrap() > 0 { + while poll(&mut pollfd, timeout).unwrap() > 0 { f.testwl.dispatch(); } }); diff --git a/tests/integration.rs b/tests/integration.rs index 95ab070..147f15a 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1,4 +1,4 @@ -use rustix::event::{poll, PollFd, PollFlags}; +use rustix::event::{poll, PollFd, PollFlags, Timespec}; use rustix::process::{Pid, Signal, WaitOptions}; use std::collections::HashMap; use std::io::Write; @@ -102,7 +102,7 @@ impl Drop for Fixture { if thread.join().is_err() { log::error!("main thread panicked"); } - rustix::process::kill_process(self.pid, Signal::Term).unwrap(); + rustix::process::kill_process(self.pid, Signal::TERM).unwrap(); rustix::process::waitpid(Some(self.pid), WaitOptions::NOHANG).unwrap(); } } @@ -131,7 +131,11 @@ impl Fixture { // wait for connection let fd = unsafe { BorrowedFd::borrow_raw(testwl.poll_fd().as_raw_fd()) }; let pollfd = PollFd::from_borrowed_fd(fd, PollFlags::IN); - assert!(poll(&mut [pollfd.clone()], 1000).unwrap() > 0); + let timeout = Some(&Timespec { + tv_sec: 1, + tv_nsec: 0, + }); + assert!(poll(&mut [pollfd.clone()], timeout).unwrap() > 0); testwl.dispatch(); let try_bool_timeout = |b: &AtomicBool| { @@ -159,7 +163,11 @@ impl Fixture { let mut ready = our_data.display.lock().unwrap().is_some(); while !ready && start.elapsed() < Duration::from_millis(2000) { - let n = poll(&mut f, 100).unwrap(); + let timeout = Some(&Timespec { + tv_sec: 0, + tv_nsec: 100_000_000, + }); + let n = poll(&mut f, timeout).unwrap(); if n > 0 { testwl.dispatch(); } @@ -187,14 +195,18 @@ impl Fixture { fn wait_and_dispatch(&mut self) { let mut pollfd = [self.pollfd.clone()]; self.testwl.dispatch(); + let timeout = Some(&Timespec { + tv_sec: 0, + tv_nsec: 50_000_000, + }); assert!( - poll(&mut pollfd, 50).unwrap() > 0, + poll(&mut pollfd, timeout).unwrap() > 0, "Did not receive any events" ); self.pollfd.clear_revents(); self.testwl.dispatch(); - while poll(&mut pollfd, 50).unwrap() > 0 { + while poll(&mut pollfd, timeout).unwrap() > 0 { self.testwl.dispatch(); self.pollfd.clear_revents(); } @@ -467,8 +479,12 @@ impl Connection { if let Some(event) = self.poll_for_event().expect("Failed to poll for event") { return event; } + let timeout = Some(&Timespec { + tv_sec: 0, + tv_nsec: 100_000_000, + }); assert!( - poll(&mut [self.pollfd.clone()], 100).expect("poll failed") > 0, + poll(&mut [self.pollfd.clone()], timeout).expect("poll failed") > 0, "Did not get any X11 events" ); self.pollfd.clear_revents();