mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +02:00
Merge pull request #596 from JakeStanger/build/nix
refactor: update `nix` crate to latest version
This commit is contained in:
commit
3b6480f3f2
4 changed files with 30 additions and 11 deletions
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -435,6 +435,12 @@ version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg_aliases"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.38"
|
version = "0.4.38"
|
||||||
|
@ -1596,7 +1602,7 @@ dependencies = [
|
||||||
"mlua",
|
"mlua",
|
||||||
"mpd-utils",
|
"mpd-utils",
|
||||||
"mpris",
|
"mpris",
|
||||||
"nix 0.27.1",
|
"nix 0.28.0",
|
||||||
"notify",
|
"notify",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
@ -1663,9 +1669,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.150"
|
version = "0.2.155"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libcorn"
|
name = "libcorn"
|
||||||
|
@ -1948,6 +1954,18 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.28.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.4.0",
|
||||||
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nom"
|
name = "nom"
|
||||||
version = "7.1.3"
|
version = "7.1.3"
|
||||||
|
|
|
@ -125,7 +125,7 @@ mlua = { version = "0.9.7", optional = true, features = ["luajit"] }
|
||||||
cairo-rs = { version = "0.18.5", optional = true, features = ["png"] }
|
cairo-rs = { version = "0.18.5", optional = true, features = ["png"] }
|
||||||
|
|
||||||
# clipboard
|
# clipboard
|
||||||
nix = { version = "0.27.1", optional = true, features = ["event"] }
|
nix = { version = "0.28.0", optional = true, features = ["event", "fs"] }
|
||||||
|
|
||||||
# clock
|
# clock
|
||||||
chrono = { version = "0.4.38", optional = true, default_features = false, features = ["clock", "unstable-locales"] }
|
chrono = { version = "0.4.38", optional = true, default_features = false, features = ["clock", "unstable-locales"] }
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{lock, try_send, Ironbar};
|
||||||
use device::DataControlDevice;
|
use device::DataControlDevice;
|
||||||
use glib::Bytes;
|
use glib::Bytes;
|
||||||
use nix::fcntl::{fcntl, F_GETPIPE_SZ, F_SETPIPE_SZ};
|
use nix::fcntl::{fcntl, F_GETPIPE_SZ, F_SETPIPE_SZ};
|
||||||
use nix::sys::epoll::{Epoll, EpollCreateFlags, EpollEvent, EpollFlags};
|
use nix::sys::epoll::{Epoll, EpollCreateFlags, EpollEvent, EpollFlags, EpollTimeout};
|
||||||
use smithay_client_toolkit::data_device_manager::WritePipe;
|
use smithay_client_toolkit::data_device_manager::WritePipe;
|
||||||
use smithay_client_toolkit::reexports::calloop::{PostAction, RegistrationToken};
|
use smithay_client_toolkit::reexports::calloop::{PostAction, RegistrationToken};
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
|
@ -274,7 +274,7 @@ impl DataControlDeviceHandler for Environment {
|
||||||
Ok(token) => {
|
Ok(token) => {
|
||||||
cur_offer.token.replace(token);
|
cur_offer.token.replace(token);
|
||||||
}
|
}
|
||||||
Err(err) => error!("{err:?}"),
|
Err(err) => error!("Failed to insert read pipe event: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,11 +349,12 @@ impl DataControlSourceHandler for Environment {
|
||||||
.add(fd, epoll_event)
|
.add(fd, epoll_event)
|
||||||
.expect("to send valid epoll operation");
|
.expect("to send valid epoll operation");
|
||||||
|
|
||||||
|
let timeout = EpollTimeout::from(100u16);
|
||||||
while !bytes.is_empty() {
|
while !bytes.is_empty() {
|
||||||
let chunk = &bytes[..min(pipe_size as usize, bytes.len())];
|
let chunk = &bytes[..min(pipe_size as usize, bytes.len())];
|
||||||
|
|
||||||
epoll_fd
|
epoll_fd
|
||||||
.wait(&mut events, 100)
|
.wait(&mut events, timeout)
|
||||||
.expect("Failed to wait to epoll");
|
.expect("Failed to wait to epoll");
|
||||||
|
|
||||||
match file.write(chunk) {
|
match file.write(chunk) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use nix::unistd::{close, pipe2};
|
||||||
use smithay_client_toolkit::data_device_manager::data_offer::DataOfferError;
|
use smithay_client_toolkit::data_device_manager::data_offer::DataOfferError;
|
||||||
use smithay_client_toolkit::data_device_manager::ReadPipe;
|
use smithay_client_toolkit::data_device_manager::ReadPipe;
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
use std::os::fd::{BorrowedFd, FromRawFd};
|
use std::os::fd::{AsFd, AsRawFd};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use tracing::{trace, warn};
|
use tracing::{trace, warn};
|
||||||
use wayland_client::{Connection, Dispatch, Proxy, QueueHandle};
|
use wayland_client::{Connection, Dispatch, Proxy, QueueHandle};
|
||||||
|
@ -176,11 +176,11 @@ pub unsafe fn receive(
|
||||||
// create a pipe
|
// create a pipe
|
||||||
let (readfd, writefd) = pipe2(OFlag::O_CLOEXEC)?;
|
let (readfd, writefd) = pipe2(OFlag::O_CLOEXEC)?;
|
||||||
|
|
||||||
offer.receive(mime_type, BorrowedFd::borrow_raw(writefd));
|
offer.receive(mime_type, writefd.as_fd());
|
||||||
|
|
||||||
if let Err(err) = close(writefd) {
|
if let Err(err) = close(writefd.as_raw_fd()) {
|
||||||
warn!("Failed to close write pipe: {}", err);
|
warn!("Failed to close write pipe: {}", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(FromRawFd::from_raw_fd(readfd))
|
Ok(ReadPipe::from(readfd))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue