diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/tty.rs | 9 | ||||
| -rw-r--r-- | src/niri.rs | 9 | ||||
| -rw-r--r-- | src/utils.rs | 5 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 1da682d8..2f2e7a90 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -1,13 +1,13 @@ use std::cell::RefCell; use std::collections::{HashMap, HashSet}; use std::mem; -use std::os::fd::FromRawFd; use std::path::{Path, PathBuf}; use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::time::Duration; use anyhow::{anyhow, Context}; +use libc::dev_t; use smithay::backend::allocator::dmabuf::Dmabuf; use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice}; use smithay::backend::allocator::{Format as DrmFormat, Fourcc}; @@ -29,8 +29,7 @@ use smithay::reexports::drm::control::{ connector, crtc, Mode as DrmMode, ModeFlags, ModeTypeFlags, Device, property, }; use smithay::reexports::input::Libinput; -use smithay::reexports::nix::fcntl::OFlag; -use smithay::reexports::nix::libc::dev_t; +use smithay::reexports::rustix::fs::OFlags; use smithay::reexports::wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1::TrancheFlags; use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback; use smithay::utils::DeviceFd; @@ -285,9 +284,9 @@ impl Tty { debug!("adding device {path:?}"); assert!(self.output_device.is_none()); - let open_flags = OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_NOCTTY | OFlag::O_NONBLOCK; + let open_flags = OFlags::RDWR | OFlags::CLOEXEC | OFlags::NOCTTY | OFlags::NONBLOCK; let fd = self.session.open(path, open_flags)?; - let device_fd = unsafe { DrmDeviceFd::new(DeviceFd::from_raw_fd(fd)) }; + let device_fd = DrmDeviceFd::new(DeviceFd::from(fd)); let (drm, drm_notifier) = DrmDevice::new(device_fd.clone(), true)?; let gbm = GbmDevice::new(device_fd)?; diff --git a/src/niri.rs b/src/niri.rs index 1917ee97..90ac94f3 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -37,7 +37,6 @@ use smithay::reexports::calloop::timer::{TimeoutAction, Timer}; use smithay::reexports::calloop::{ self, Idle, Interest, LoopHandle, LoopSignal, Mode, PostAction, RegistrationToken, }; -use smithay::reexports::nix::libc::CLOCK_MONOTONIC; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel::WmCapabilities; use smithay::reexports::wayland_protocols_misc::server_decoration as _server_decoration; use smithay::reexports::wayland_server::backend::{ @@ -46,7 +45,8 @@ use smithay::reexports::wayland_server::backend::{ use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; use smithay::reexports::wayland_server::{Display, DisplayHandle}; use smithay::utils::{ - IsAlive, Logical, Physical, Point, Rectangle, Scale, Size, Transform, SERIAL_COUNTER, + ClockSource, IsAlive, Logical, Monotonic, Physical, Point, Rectangle, Scale, Size, Transform, + SERIAL_COUNTER, }; use smithay::wayland::compositor::{ with_states, with_surface_tree_downward, CompositorClientState, CompositorState, SurfaceData, @@ -506,10 +506,11 @@ impl Niri { |_| true, ); let presentation_state = - PresentationState::new::<State>(&display_handle, CLOCK_MONOTONIC as u32); + PresentationState::new::<State>(&display_handle, Monotonic::id() as u32); let text_input_state = TextInputManagerState::new::<State>(&display_handle); - let input_method_state = InputMethodManagerState::new::<State>(&display_handle); + let input_method_state = + InputMethodManagerState::new::<State, _>(&display_handle, |_| true); let virtual_keyboard_state = VirtualKeyboardManagerState::new::<State, _>(&display_handle, |_| true); diff --git a/src/utils.rs b/src/utils.rs index 7113bc92..55e6bce7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,12 +7,13 @@ use std::time::Duration; use anyhow::Context; use directories::UserDirs; -use nix::time::{clock_gettime, ClockId}; +use smithay::reexports::rustix::time::{clock_gettime, ClockId}; use smithay::utils::{Logical, Point, Rectangle}; use time::OffsetDateTime; pub fn get_monotonic_time() -> Duration { - Duration::from(clock_gettime(ClockId::CLOCK_MONOTONIC).unwrap()) + let ts = clock_gettime(ClockId::Monotonic); + Duration::new(ts.tv_sec as u64, ts.tv_nsec as u32) } pub fn center(rect: Rectangle<i32, Logical>) -> Point<i32, Logical> { |
