fix: bump xcb-util-cursor to 0.3.5
xcb-util-cursor made another patch release to revert back to Rust 2021 edition, so we bump to that. Also create a function, `timespec_from_millis` to make creating `Timespec` for using in `poll` calls a lot more ergonomic.
This commit is contained in:
parent
e827c42d2d
commit
bf745144ac
6 changed files with 41 additions and 59 deletions
9
Cargo.lock
generated
9
Cargo.lock
generated
|
|
@ -1100,9 +1100,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "xcb-util-cursor"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f361f49c89d5aa2e9e44bd5c38ac6865b9338d48b58a980015881df5c4484eff"
|
||||
checksum = "bf6417c51a1f5eda49156061175021bd3ccf0a759bc7c402bbea6a6a1ae14239"
|
||||
dependencies = [
|
||||
"xcb",
|
||||
"xcb-util-cursor-sys",
|
||||
|
|
@ -1110,9 +1110,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "xcb-util-cursor-sys"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7df0ea411b072fa53e1f4f5a6543649712cb9640c0de7686cca8edaf6971b117"
|
||||
checksum = "4c78acb131647687ee62f9e64c988457f23ecb8f3a078a37a312f989b320cb47"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"pkg-config",
|
||||
|
|
@ -1148,7 +1148,6 @@ dependencies = [
|
|||
"testwl",
|
||||
"vergen-gitcl",
|
||||
"wayland-client",
|
||||
"wayland-cursor",
|
||||
"wayland-protocols",
|
||||
"wayland-server",
|
||||
"wl_drm",
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@ members = ["macros", "testwl", "wl_drm"]
|
|||
|
||||
[workspace.dependencies]
|
||||
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"
|
||||
|
|
@ -33,14 +30,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.4"
|
||||
# xcb-util-cursor 0.4 uses Rust 2024, which would bump MSRV from 1.83 to 1.85, however it also has
|
||||
# no meaningful code changes, so we stick to the older version
|
||||
xcb-util-cursor = "0.3.5"
|
||||
smithay-client-toolkit = { version = "0.20.0", default-features = false }
|
||||
|
||||
sd-notify = { version = "0.4.2", optional = true }
|
||||
|
|
|
|||
10
src/lib.rs
10
src/lib.rs
|
|
@ -4,7 +4,7 @@ pub mod xstate;
|
|||
use crate::server::{NoConnection, PendingSurfaceState, ServerState};
|
||||
use crate::xstate::{RealConnection, XState};
|
||||
use log::{error, info};
|
||||
use rustix::event::{poll, PollFd, PollFlags};
|
||||
use rustix::event::{poll, PollFd, PollFlags, Timespec};
|
||||
use server::selection::{Clipboard, Primary};
|
||||
use smithay_client_toolkit::data_device_manager::WritePipe;
|
||||
use std::io::{BufRead, BufReader, Read, Write};
|
||||
|
|
@ -47,6 +47,14 @@ pub trait RunData {
|
|||
fn xwayland_ready(&self, _display: String, _pid: u32) {}
|
||||
}
|
||||
|
||||
pub const fn timespec_from_millis(millis: u64) -> Timespec {
|
||||
let d = std::time::Duration::from_millis(millis);
|
||||
Timespec {
|
||||
tv_sec: d.as_secs() as i64,
|
||||
tv_nsec: d.subsec_nanos() as i64,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main(mut data: impl RunData) -> Option<()> {
|
||||
let mut version = env!("VERGEN_GIT_DESCRIBE");
|
||||
if version == "VERGEN_IDEMPOTENT_OUTPUT" {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ mod tests;
|
|||
|
||||
use self::event::*;
|
||||
use crate::xstate::{Decorations, MoveResizeDirection, WindowDims, WmHints, WmName, WmNormalHints};
|
||||
use crate::{X11Selection, XConnection};
|
||||
use crate::{timespec_from_millis, X11Selection, XConnection};
|
||||
use clientside::MyWorld;
|
||||
use hecs::{Entity, World};
|
||||
use log::{debug, warn};
|
||||
use rustix::event::{poll, PollFd, PollFlags, Timespec};
|
||||
use rustix::event::{poll, PollFd, PollFlags};
|
||||
use smithay_client_toolkit::activation::ActivationState;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
|
@ -569,11 +569,8 @@ impl<C: XConnection> ServerState<C> {
|
|||
if let Some(r) = self.queue.prepare_read() {
|
||||
let fd = r.connection_fd();
|
||||
let pollfd = PollFd::new(&fd, PollFlags::IN);
|
||||
let timeout = Some(&Timespec {
|
||||
tv_sec: 0,
|
||||
tv_nsec: 0,
|
||||
});
|
||||
if poll(&mut [pollfd], timeout).unwrap() > 0 {
|
||||
let timeout = timespec_from_millis(0);
|
||||
if poll(&mut [pollfd], Some(&timeout)).unwrap() > 0 {
|
||||
let _ = r.read();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use super::{selection::Clipboard, InnerServerState, NoConnection, ServerState, WindowDims};
|
||||
use crate::server::selection::{Primary, SelectionType};
|
||||
use crate::xstate::{SetState, WinSize, WmName};
|
||||
use crate::XConnection;
|
||||
use rustix::event::{poll, PollFd, PollFlags, Timespec};
|
||||
use crate::{timespec_from_millis, XConnection};
|
||||
use rustix::event::{poll, PollFd, PollFlags};
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write;
|
||||
use std::os::fd::{AsRawFd, BorrowedFd};
|
||||
|
|
@ -361,11 +361,8 @@ 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)];
|
||||
let timeout = Some(&Timespec {
|
||||
tv_sec: 1,
|
||||
tv_nsec: 0,
|
||||
});
|
||||
if poll(&mut pollfd, timeout).unwrap() == 0 {
|
||||
let timeout = timespec_from_millis(1000);
|
||||
if poll(&mut pollfd, Some(&timeout)).unwrap() == 0 {
|
||||
panic!("Did not get events for testwl!");
|
||||
}
|
||||
testwl.dispatch();
|
||||
|
|
@ -1396,15 +1393,12 @@ fn copy_from_wayland<T: SelectionTest>() {
|
|||
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)];
|
||||
let timeout = Some(&Timespec {
|
||||
tv_sec: 0,
|
||||
tv_nsec: 100_000_000,
|
||||
});
|
||||
if poll(&mut pollfd, timeout).unwrap() == 0 {
|
||||
let timeout = timespec_from_millis(100);
|
||||
if poll(&mut pollfd, Some(&timeout)).unwrap() == 0 {
|
||||
panic!("Did not get events for testwl!");
|
||||
}
|
||||
f.testwl.dispatch();
|
||||
while poll(&mut pollfd, timeout).unwrap() > 0 {
|
||||
while poll(&mut pollfd, Some(&timeout)).unwrap() > 0 {
|
||||
f.testwl.dispatch();
|
||||
}
|
||||
});
|
||||
|
|
@ -1460,15 +1454,12 @@ fn selection_x11_then_wayland<T: SelectionTest>() {
|
|||
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)];
|
||||
let timeout = Some(&Timespec {
|
||||
tv_sec: 0,
|
||||
tv_nsec: 100_000_000,
|
||||
});
|
||||
if poll(&mut pollfd, timeout).unwrap() == 0 {
|
||||
let timeout = timespec_from_millis(100);
|
||||
if poll(&mut pollfd, Some(&timeout)).unwrap() == 0 {
|
||||
panic!("Did not get events for testwl!");
|
||||
}
|
||||
f.testwl.dispatch();
|
||||
while poll(&mut pollfd, timeout).unwrap() > 0 {
|
||||
while poll(&mut pollfd, Some(&timeout)).unwrap() > 0 {
|
||||
f.testwl.dispatch();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use rustix::event::{poll, PollFd, PollFlags, Timespec};
|
||||
use rustix::event::{poll, PollFd, PollFlags};
|
||||
use rustix::process::{Pid, Signal, WaitOptions};
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write;
|
||||
|
|
@ -19,6 +19,7 @@ use wayland_server::Resource;
|
|||
use xcb::{x, Xid};
|
||||
use xwayland_satellite as xwls;
|
||||
use xwayland_satellite::xstate::{MoveResizeDirection, WmSizeHintsFlags, WmState};
|
||||
use xwls::timespec_from_millis;
|
||||
|
||||
#[derive(Default)]
|
||||
struct TestDataInner {
|
||||
|
|
@ -131,11 +132,8 @@ 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);
|
||||
let timeout = Some(&Timespec {
|
||||
tv_sec: 1,
|
||||
tv_nsec: 0,
|
||||
});
|
||||
assert!(poll(&mut [pollfd.clone()], timeout).unwrap() > 0);
|
||||
let timeout = timespec_from_millis(1000);
|
||||
assert!(poll(&mut [pollfd.clone()], Some(&timeout)).unwrap() > 0);
|
||||
testwl.dispatch();
|
||||
|
||||
let try_bool_timeout = |b: &AtomicBool| {
|
||||
|
|
@ -163,11 +161,8 @@ impl Fixture {
|
|||
|
||||
let mut ready = our_data.display.lock().unwrap().is_some();
|
||||
while !ready && start.elapsed() < Duration::from_millis(2000) {
|
||||
let timeout = Some(&Timespec {
|
||||
tv_sec: 0,
|
||||
tv_nsec: 100_000_000,
|
||||
});
|
||||
let n = poll(&mut f, timeout).unwrap();
|
||||
let timeout = timespec_from_millis(100);
|
||||
let n = poll(&mut f, Some(&timeout)).unwrap();
|
||||
if n > 0 {
|
||||
testwl.dispatch();
|
||||
}
|
||||
|
|
@ -195,18 +190,15 @@ 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,
|
||||
});
|
||||
let timeout = timespec_from_millis(50);
|
||||
assert!(
|
||||
poll(&mut pollfd, timeout).unwrap() > 0,
|
||||
poll(&mut pollfd, Some(&timeout)).unwrap() > 0,
|
||||
"Did not receive any events"
|
||||
);
|
||||
self.pollfd.clear_revents();
|
||||
self.testwl.dispatch();
|
||||
|
||||
while poll(&mut pollfd, timeout).unwrap() > 0 {
|
||||
while poll(&mut pollfd, Some(&timeout)).unwrap() > 0 {
|
||||
self.testwl.dispatch();
|
||||
self.pollfd.clear_revents();
|
||||
}
|
||||
|
|
@ -479,12 +471,9 @@ 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,
|
||||
});
|
||||
let timeout = timespec_from_millis(100);
|
||||
assert!(
|
||||
poll(&mut [self.pollfd.clone()], timeout).expect("poll failed") > 0,
|
||||
poll(&mut [self.pollfd.clone()], Some(&timeout)).expect("poll failed") > 0,
|
||||
"Did not get any X11 events"
|
||||
);
|
||||
self.pollfd.clear_revents();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue