File: use-nix-0.29.diff

package info (click to toggle)
swayosd 0.1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 616 kB
  • sloc: makefile: 19; xml: 19
file content (45 lines) | stat: -rw-r--r-- 1,344 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Description: Use nix 0.29 
 The following patch makes swayosd compatible with nix 0.29
Author: Matthias Geiger <werdahias@debian.org>
Forwarded: https://github.com/ErikReider/SwayOSD/pull/98 
Last-Update: 2024-11-07
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/

--- a/Cargo.toml
+++ b/Cargo.toml
@@ -37,7 +37,7 @@ input = "0.8"
 libc = "0.2.147"
 evdev-rs = "0.6.1"
 async-std = "1.12.0"
-nix = "0.26.2"
+nix = { version = "0.29", features = ["poll"] }
 blight = "0.7.0"
 anyhow = "1.0.75"
 thiserror = "1.0.49"
--- a/src/input-backend/main.rs
+++ b/src/input-backend/main.rs
@@ -15,6 +15,7 @@ use std::os::unix::{fs::OpenOptionsExt, io::OwnedFd};
 use std::path::Path;
 use std::time::Duration;
 use zbus::InterfaceRef;
+use std::os::fd::BorrowedFd;
 
 #[path = "../config.rs"]
 mod config;
@@ -57,9 +58,11 @@ fn main() -> Result<(), zbus::Error> {
 	input
 		.udev_assign_seat("seat0")
 		.expect("Could not assign seat0");
-
-	let pollfd = PollFd::new(input.as_raw_fd(), PollFlags::POLLIN);
-	while poll(&mut [pollfd], -1).is_ok() {
+   let fd = input.as_raw_fd();
+   assert!(fd != -1);
+   let borrowed_fd = unsafe{ BorrowedFd::borrow_raw(input.as_raw_fd())};
+	let pollfd = PollFd::new(borrowed_fd, PollFlags::POLLIN);
+   	while poll(&mut [pollfd], None::<u8>).is_ok() {
 		event(&mut input, &iface_ref);
 	}