diff --git a/anvil/src/input_handler.rs b/anvil/src/input_handler.rs index bfa9b77..06dd097 100644 --- a/anvil/src/input_handler.rs +++ b/anvil/src/input_handler.rs @@ -9,7 +9,7 @@ use crate::AnvilState; use smithay::{ backend::input::{ self, Event, InputBackend, InputEvent, KeyState, KeyboardKeyEvent, PointerAxisEvent, - PointerButtonEvent, PointerMotionAbsoluteEvent, PointerMotionEvent, + PointerButtonEvent, }, reexports::wayland_server::protocol::wl_pointer, wayland::{ @@ -18,8 +18,11 @@ use smithay::{ }, }; +#[cfg(feature = "winit")] +use smithay::backend::input::PointerMotionAbsoluteEvent; + #[cfg(feature = "udev")] -use smithay::backend::session::Session; +use smithay::backend::{input::PointerMotionEvent, session::Session}; impl AnvilState { fn keyboard_key_to_action(&mut self, evt: B::KeyboardKeyEvent) -> KeyAction { diff --git a/anvil/src/main.rs b/anvil/src/main.rs index 020156f..bddfff5 100644 --- a/anvil/src/main.rs +++ b/anvil/src/main.rs @@ -1,4 +1,10 @@ #![warn(rust_2018_idioms)] +// If no backend is enabled, a large portion of the codebase is unused. +// So silence this useless warning for the CI. +#![cfg_attr( + not(any(feature = "winit", feature = "udev")), + allow(dead_code, unused_imports) +)] #[macro_use] extern crate slog; @@ -57,7 +63,10 @@ fn main() { crit!(log, "Failed to initialize tty backend."); } } - _ => { + Some(other) => { + crit!(log, "Unknown backend: {}", other); + } + None => { println!("USAGE: anvil --backend"); println!(); println!("Possible backends are:"); diff --git a/anvil/src/window_map.rs b/anvil/src/window_map.rs index 06e8095..07d46ed 100644 --- a/anvil/src/window_map.rs +++ b/anvil/src/window_map.rs @@ -33,6 +33,7 @@ impl Kind { Kind::X11(ref t) => t.alive(), } } + pub fn get_surface(&self) -> Option<&wl_surface::WlSurface> { match *self { Kind::Xdg(ref t) => t.get_surface(), @@ -84,6 +85,7 @@ impl PopupKind { PopupKind::Xdg(ref t) => t.alive(), } } + pub fn get_surface(&self) -> Option<&wl_surface::WlSurface> { match *self { PopupKind::Xdg(ref t) => t.get_surface(), diff --git a/src/backend/allocator/dmabuf.rs b/src/backend/allocator/dmabuf.rs index cbd180a..6a0c51e 100644 --- a/src/backend/allocator/dmabuf.rs +++ b/src/backend/allocator/dmabuf.rs @@ -61,7 +61,7 @@ impl Drop for Plane { } } -bitflags! { +bitflags::bitflags! { /// Possible flags for a DMA buffer pub struct DmabufFlags: u32 { /// The buffer content is Y-inverted diff --git a/src/backend/drm/device/atomic.rs b/src/backend/drm/device/atomic.rs index fbaa044..25af6e3 100644 --- a/src/backend/drm/device/atomic.rs +++ b/src/backend/drm/device/atomic.rs @@ -14,6 +14,8 @@ use drm::control::{ use super::{DevPath, FdWrapper}; use crate::backend::drm::error::Error; +use slog::{error, o, trace}; + type OldState = ( Vec<(connector::Handle, PropertyValueSet)>, Vec<(crtc::Handle, PropertyValueSet)>, diff --git a/src/backend/drm/device/legacy.rs b/src/backend/drm/device/legacy.rs index 014637b..b41c450 100644 --- a/src/backend/drm/device/legacy.rs +++ b/src/backend/drm/device/legacy.rs @@ -10,6 +10,8 @@ use drm::control::{connector, crtc, Device as ControlDevice}; use super::{DevPath, FdWrapper}; use crate::backend::drm::error::Error; +use slog::{error, info, o}; + pub struct LegacyDrmDevice { pub(crate) fd: Arc>, pub(crate) active: Arc, diff --git a/src/backend/drm/device/mod.rs b/src/backend/drm/device/mod.rs index f1e5c6a..6242197 100644 --- a/src/backend/drm/device/mod.rs +++ b/src/backend/drm/device/mod.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "backend_session")] use std::cell::RefCell; use std::os::unix::io::{AsRawFd, RawFd}; use std::path::PathBuf; @@ -16,6 +17,8 @@ use super::{error::Error, planes, Planes}; use atomic::AtomicDrmDevice; use legacy::LegacyDrmDevice; +use slog::{error, info, o, trace, warn}; + /// An open drm device pub struct DrmDevice { pub(super) dev_id: dev_t, diff --git a/src/backend/drm/session.rs b/src/backend/drm/session.rs index 5e69a4d..9777239 100644 --- a/src/backend/drm/session.rs +++ b/src/backend/drm/session.rs @@ -18,6 +18,8 @@ use crate::{ signaling::{Linkable, Signaler}, }; +use slog::{crit, error, info, o, warn}; + struct DrmDeviceObserver { dev_id: dev_t, dev: Weak>, diff --git a/src/backend/drm/surface/atomic.rs b/src/backend/drm/surface/atomic.rs index 20f6f0e..56891de 100644 --- a/src/backend/drm/surface/atomic.rs +++ b/src/backend/drm/surface/atomic.rs @@ -17,6 +17,8 @@ use crate::backend::drm::{ error::Error, }; +use slog::{debug, info, o, trace, warn}; + #[derive(Debug, PartialEq, Eq, Clone)] pub struct State { pub mode: Mode, diff --git a/src/backend/drm/surface/gbm.rs b/src/backend/drm/surface/gbm.rs index a8ebc49..6fba691 100644 --- a/src/backend/drm/surface/gbm.rs +++ b/src/backend/drm/surface/gbm.rs @@ -14,6 +14,8 @@ use crate::backend::allocator::{ use crate::backend::drm::{device::DevPath, surface::DrmSurfaceInternal, DrmError, DrmSurface}; use crate::backend::SwapBuffersError; +use slog::{debug, error, o, trace, warn}; + /// Simplified by limited abstraction to link single [`DrmSurface`]s to renderers. /// /// # Use-case diff --git a/src/backend/drm/surface/legacy.rs b/src/backend/drm/surface/legacy.rs index 3f1c235..4f2e2db 100644 --- a/src/backend/drm/surface/legacy.rs +++ b/src/backend/drm/surface/legacy.rs @@ -13,6 +13,8 @@ use crate::backend::drm::{ error::Error, }; +use slog::{debug, info, o, trace}; + #[derive(Debug, PartialEq, Eq, Clone)] pub struct State { pub mode: Mode, diff --git a/src/backend/drm/surface/mod.rs b/src/backend/drm/surface/mod.rs index 7ff8920..e46b1b1 100644 --- a/src/backend/drm/surface/mod.rs +++ b/src/backend/drm/surface/mod.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "backend_session")] use std::cell::RefCell; use std::collections::HashSet; use std::convert::TryFrom; @@ -18,8 +19,12 @@ use crate::backend::allocator::{Format, Fourcc, Modifier}; use atomic::AtomicDrmSurface; use legacy::LegacyDrmSurface; +use slog::trace; + /// An open crtc + plane combination that can be used for scan-out pub struct DrmSurface { + // This field is only read when 'backend_session' is enabled + #[allow(dead_code)] pub(super) dev_id: dev_t, pub(super) crtc: crtc::Handle, pub(super) primary: plane::Handle, diff --git a/src/backend/egl/context.rs b/src/backend/egl/context.rs index f9883ea..654e770 100644 --- a/src/backend/egl/context.rs +++ b/src/backend/egl/context.rs @@ -8,6 +8,8 @@ use crate::backend::allocator::Format as DrmFormat; use crate::backend::egl::display::{EGLDisplay, PixelFormat}; use crate::backend::egl::EGLSurface; +use slog::{info, o, trace}; + /// EGL context for rendering #[derive(Debug)] pub struct EGLContext { diff --git a/src/backend/egl/display.rs b/src/backend/egl/display.rs index af13b8f..c264b61 100644 --- a/src/backend/egl/display.rs +++ b/src/backend/egl/display.rs @@ -26,8 +26,10 @@ use crate::backend::egl::{ #[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))] use crate::backend::egl::{BufferAccessError, EGLBuffer, Format}; +use slog::{debug, error, info, o, trace, warn}; + #[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))] -lazy_static! { +lazy_static::lazy_static! { pub(crate) static ref BUFFER_READER: Mutex> = Mutex::new(None); } diff --git a/src/backend/egl/ffi.rs b/src/backend/egl/ffi.rs index 4496e1f..bac6206 100644 --- a/src/backend/egl/ffi.rs +++ b/src/backend/egl/ffi.rs @@ -48,7 +48,7 @@ pub mod egl { use libloading::Library; use std::sync::Once; - lazy_static! { + lazy_static::lazy_static! { pub static ref LIB: Library = unsafe { Library::new("libEGL.so.1") }.expect("Failed to load LibEGL"); } diff --git a/src/backend/egl/mod.rs b/src/backend/egl/mod.rs index be5e4b4..d84185b 100644 --- a/src/backend/egl/mod.rs +++ b/src/backend/egl/mod.rs @@ -37,7 +37,8 @@ use nix::libc::c_void; #[allow(non_camel_case_types, dead_code, unused_mut, non_upper_case_globals)] pub mod ffi; -use self::ffi::egl::types::EGLImage; +#[cfg(feature = "wayland_frontend")] +use self::{display::EGLDisplayHandle, ffi::egl::types::EGLImage}; pub mod display; pub mod native; @@ -45,8 +46,8 @@ pub mod surface; pub use self::display::EGLDisplay; pub use self::surface::EGLSurface; -use self::display::EGLDisplayHandle; use std::ffi::CString; +#[cfg(feature = "wayland_frontend")] use std::sync::Arc; /// Error that can happen on optional EGL features diff --git a/src/backend/egl/surface.rs b/src/backend/egl/surface.rs index 0e6ce06..9508dde 100644 --- a/src/backend/egl/surface.rs +++ b/src/backend/egl/surface.rs @@ -15,6 +15,8 @@ use crate::backend::egl::{ EGLError, SwapBuffersError, }; +use slog::{debug, o, trace}; + /// EGL surface of a given EGL context for rendering pub struct EGLSurface { pub(crate) display: Arc, diff --git a/src/backend/input.rs b/src/backend/input.rs index fa6e933..7817fba 100644 --- a/src/backend/input.rs +++ b/src/backend/input.rs @@ -1,6 +1,6 @@ //! Common traits for input backends to receive input from. -use std::{error::Error, string::ToString}; +use std::error::Error; /// A seat describes a group of input devices and at least one /// graphics device belonging together. @@ -21,7 +21,8 @@ pub struct Seat { } impl Seat { - pub(crate) fn new(id: u64, name: S, capabilities: SeatCapabilities) -> Seat { + #[cfg(any(feature = "backend_winit", feature = "backend_libinput"))] + pub(crate) fn new(id: u64, name: S, capabilities: SeatCapabilities) -> Seat { Seat { id, name: name.to_string(), @@ -29,6 +30,7 @@ impl Seat { } } + #[cfg(feature = "backend_libinput")] pub(crate) fn capabilities_mut(&mut self) -> &mut SeatCapabilities { &mut self.capabilities } @@ -329,6 +331,7 @@ pub struct TouchSlot { id: u64, } +#[cfg(any(feature = "backend_winit", feature = "backend_libinput"))] impl TouchSlot { pub(crate) fn new(id: u64) -> Self { TouchSlot { id } diff --git a/src/backend/libinput/helpers.rs b/src/backend/libinput/helpers.rs index 85cbc8b..337c093 100644 --- a/src/backend/libinput/helpers.rs +++ b/src/backend/libinput/helpers.rs @@ -11,6 +11,8 @@ use std::{ hash::{Hash, Hasher}, }; +use slog::{info, warn}; + #[inline(always)] pub fn on_device_event( callback: &mut F, diff --git a/src/backend/libinput/mod.rs b/src/backend/libinput/mod.rs index 82d16d0..a637d4c 100644 --- a/src/backend/libinput/mod.rs +++ b/src/backend/libinput/mod.rs @@ -22,6 +22,8 @@ use std::{ use calloop::{EventSource, Interest, Mode, Poll, Readiness, Token}; +use slog::{info, o}; + // No idea if this is the same across unix platforms // Lets make this linux exclusive for now, once someone tries to build it for // any BSD-like system, they can verify if this is right and make a PR to change this. @@ -76,7 +78,7 @@ impl Linkable for LibinputInputBackend { } SessionSignal::ActivateSession | SessionSignal::ActivateDevice { .. } => { if input.resume().is_err() { - error!(log, "Failed to resume libinput context"); + slog::error!(log, "Failed to resume libinput context"); } } _ => {} diff --git a/src/backend/renderer/gles2/mod.rs b/src/backend/renderer/gles2/mod.rs index fe05447..4f6e9d6 100644 --- a/src/backend/renderer/gles2/mod.rs +++ b/src/backend/renderer/gles2/mod.rs @@ -1,6 +1,5 @@ //! Implementation of the rendering traits using OpenGL ES 2 -use std::collections::HashMap; use std::convert::TryFrom; use std::ffi::CStr; use std::fmt; @@ -20,7 +19,7 @@ mod version; use super::{Bind, Frame, Renderer, Texture, Transform, Unbind}; use crate::backend::allocator::{ dmabuf::{Dmabuf, WeakDmabuf}, - Buffer, Format, + Format, }; use crate::backend::egl::{ ffi::egl::{self as ffi_egl, types::EGLImage}, @@ -39,6 +38,8 @@ use crate::utils::Rectangle; #[cfg(feature = "wayland_frontend")] use wayland_server::protocol::{wl_buffer, wl_shm}; +use slog::{debug, error, info, o, trace, warn}; + #[allow(clippy::all, missing_docs)] pub mod ffi { include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); @@ -150,12 +151,14 @@ pub struct Gles2Renderer { extensions: Vec, programs: [Gles2Program; shaders::FRAGMENT_COUNT], #[cfg(feature = "wayland_frontend")] - dmabuf_cache: HashMap, + dmabuf_cache: std::collections::HashMap, egl: EGLContext, #[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))] egl_reader: Option, gl: ffi::Gles2, destruction_callback: Receiver, + // This field is only accessed if the image or wayland_frontend features are active + #[allow(dead_code)] destruction_callback_sender: Sender, logger_ptr: Option<*mut ::slog::Logger>, logger: ::slog::Logger, @@ -456,7 +459,7 @@ impl Gles2Renderer { target_surface: None, buffers: Vec::new(), #[cfg(feature = "wayland_frontend")] - dmabuf_cache: HashMap::new(), + dmabuf_cache: std::collections::HashMap::new(), destruction_callback: rx, destruction_callback_sender: tx, logger_ptr, @@ -689,6 +692,7 @@ impl ImportEgl for Gles2Renderer { #[cfg(feature = "wayland_frontend")] impl ImportDma for Gles2Renderer { fn import_dmabuf(&mut self, buffer: &Dmabuf) -> Result { + use crate::backend::allocator::Buffer; if !self.extensions.iter().any(|ext| ext == "GL_OES_EGL_image") { return Err(Gles2Error::GLExtensionNotSupported(&["GL_OES_EGL_image"])); } diff --git a/src/backend/session/auto.rs b/src/backend/session/auto.rs index 8d7215f..e799dfd 100644 --- a/src/backend/session/auto.rs +++ b/src/backend/session/auto.rs @@ -45,6 +45,8 @@ use std::{cell::RefCell, io, os::unix::io::RawFd, path::Path, rc::Rc}; use calloop::{EventSource, Poll, Readiness, Token}; +use slog::{error, info, o, warn}; + /// [`Session`] using the best available interface #[derive(Debug, Clone)] pub enum AutoSession { diff --git a/src/backend/session/dbus/logind.rs b/src/backend/session/dbus/logind.rs index 0f293f6..d2ccdf6 100644 --- a/src/backend/session/dbus/logind.rs +++ b/src/backend/session/dbus/logind.rs @@ -59,6 +59,8 @@ use std::{ use calloop::{EventSource, Poll, Readiness, Token}; +use slog::{debug, error, info, o, warn}; + use super::DBusConnection; struct LogindSessionImpl { diff --git a/src/backend/session/direct.rs b/src/backend/session/direct.rs index bb9eb1d..34b0328 100644 --- a/src/backend/session/direct.rs +++ b/src/backend/session/direct.rs @@ -70,6 +70,8 @@ use std::{ #[cfg(feature = "backend_udev")] use udev::Device as UdevDevice; +use slog::{debug, error, info, o, trace, warn}; + /// This environment variable can be used to specify a tty path /// that will be used in [DirectSession::new] in case no explicit /// tty path has been provided. @@ -77,23 +79,23 @@ pub const SMITHAY_DIRECT_TTY_ENV: &str = "SMITHAY_DIRECT_TTY"; #[allow(dead_code)] mod tty { - ioctl_read_bad!(kd_get_mode, 0x4B3B, i16); - ioctl_write_int_bad!(kd_set_mode, 0x4B3A); + nix::ioctl_read_bad!(kd_get_mode, 0x4B3B, i16); + nix::ioctl_write_int_bad!(kd_set_mode, 0x4B3A); pub const KD_TEXT: i16 = 0x00; pub const KD_GRAPHICS: i16 = 0x00; - ioctl_read_bad!(kd_get_kb_mode, 0x4B44, i32); - ioctl_write_int_bad!(kd_set_kb_mode, 0x4B45); + nix::ioctl_read_bad!(kd_get_kb_mode, 0x4B44, i32); + nix::ioctl_write_int_bad!(kd_set_kb_mode, 0x4B45); pub const K_RAW: i32 = 0x00; pub const K_XLATE: i32 = 0x01; pub const K_MEDIUMRAW: i32 = 0x02; pub const K_UNICODE: i32 = 0x03; pub const K_OFF: i32 = 0x04; - ioctl_write_int_bad!(vt_activate, 0x5606); - ioctl_write_int_bad!(vt_wait_active, 0x5607); - ioctl_write_ptr_bad!(vt_set_mode, 0x5602, VtMode); - ioctl_write_int_bad!(vt_rel_disp, 0x5605); + nix::ioctl_write_int_bad!(vt_activate, 0x5606); + nix::ioctl_write_int_bad!(vt_wait_active, 0x5607); + nix::ioctl_write_ptr_bad!(vt_set_mode, 0x5602, VtMode); + nix::ioctl_write_int_bad!(vt_rel_disp, 0x5605); #[repr(C)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct VtMode { diff --git a/src/backend/udev.rs b/src/backend/udev.rs index d049557..8c68530 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -52,6 +52,8 @@ use udev::{Enumerator, EventType, MonitorBuilder, MonitorSocket}; use calloop::{EventSource, Interest, Mode, Poll, Readiness, Token}; +use slog::{debug, info, o, warn}; + /// Backend to monitor available drm devices. /// /// Provides a way to automatically scan for available gpus and notifies the diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 75f849b..0230445 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -28,6 +28,8 @@ use winit::{ window::{Window as WinitWindow, WindowBuilder}, }; +use slog::{debug, error, info, o, trace, warn}; + /// Errors thrown by the `winit` backends #[derive(thiserror::Error, Debug)] pub enum Error { diff --git a/src/lib.rs b/src/lib.rs index 23c7c97..ede46f6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,15 +10,8 @@ //! `log` crate. If not, the logs will discarded. This cargo feature is part of the default set of //! features of Smithay. -#[cfg_attr(feature = "backend_session", macro_use)] #[doc(hidden)] pub extern crate nix; -#[macro_use] -extern crate slog; -#[macro_use] -extern crate lazy_static; -#[macro_use] -extern crate bitflags; pub mod backend; pub mod utils; @@ -33,6 +26,7 @@ pub mod xwayland; pub mod reexports; #[cfg(feature = "slog-stdlog")] +#[allow(dead_code)] fn slog_or_fallback(logger: L) -> ::slog::Logger where L: Into>, @@ -40,15 +34,16 @@ where use slog::Drain; logger .into() - .unwrap_or_else(|| ::slog::Logger::root(::slog_stdlog::StdLog.fuse(), o!())) + .unwrap_or_else(|| ::slog::Logger::root(::slog_stdlog::StdLog.fuse(), slog::o!())) } #[cfg(not(feature = "slog-stdlog"))] +#[allow(dead_code)] fn slog_or_fallback(logger: L) -> ::slog::Logger where L: Into>, { logger .into() - .unwrap_or_else(|| ::slog::Logger::root(::slog::Discard, o!())) + .unwrap_or_else(|| ::slog::Logger::root(::slog::Discard, slog::o!())) } diff --git a/src/wayland/compositor/handlers.rs b/src/wayland/compositor/handlers.rs index c93e9e4..af3edfe 100644 --- a/src/wayland/compositor/handlers.rs +++ b/src/wayland/compositor/handlers.rs @@ -19,6 +19,8 @@ use super::{ AlreadyHasRole, BufferAssignment, Damage, Rectangle, RectangleKind, RegionAttributes, SurfaceAttributes, }; +use slog::trace; + /* * wl_compositor */ diff --git a/src/wayland/compositor/mod.rs b/src/wayland/compositor/mod.rs index 626432f..2576cc8 100644 --- a/src/wayland/compositor/mod.rs +++ b/src/wayland/compositor/mod.rs @@ -449,7 +449,7 @@ where L: Into>, Impl: for<'a> FnMut(WlSurface, DispatchData<'a>) + 'static, { - let log = crate::slog_or_fallback(logger).new(o!("smithay_module" => "compositor_handler")); + let log = crate::slog_or_fallback(logger).new(slog::o!("smithay_module" => "compositor_handler")); let implem = Rc::new(RefCell::new(implem)); let compositor = display.create_global( diff --git a/src/wayland/data_device/mod.rs b/src/wayland/data_device/mod.rs index 5f5c938..e9e7fef 100644 --- a/src/wayland/data_device/mod.rs +++ b/src/wayland/data_device/mod.rs @@ -56,6 +56,8 @@ use wayland_server::{ Client, Display, Filter, Global, Main, }; +use slog::{debug, error, o}; + use crate::wayland::{ compositor, seat::{GrabStartData, Seat}, diff --git a/src/wayland/dmabuf/mod.rs b/src/wayland/dmabuf/mod.rs index 48811f6..18e40df 100644 --- a/src/wayland/dmabuf/mod.rs +++ b/src/wayland/dmabuf/mod.rs @@ -56,6 +56,8 @@ use wayland_protocols::unstable::linux_dmabuf::v1::server::{ }; use wayland_server::{protocol::wl_buffer, DispatchData, Display, Filter, Global, Main}; +use slog::{o, trace}; + use crate::backend::allocator::{ dmabuf::{Dmabuf, DmabufFlags, Plane}, Format, Fourcc, Modifier, diff --git a/src/wayland/explicit_synchronization/mod.rs b/src/wayland/explicit_synchronization/mod.rs index efecb67..2c56d2e 100644 --- a/src/wayland/explicit_synchronization/mod.rs +++ b/src/wayland/explicit_synchronization/mod.rs @@ -190,7 +190,7 @@ where L: Into>, { let _log = - crate::slog_or_fallback(logger).new(o!("smithay_module" => "wayland_explicit_synchronization")); + crate::slog_or_fallback(logger).new(slog::o!("smithay_module" => "wayland_explicit_synchronization")); display.create_global::( 2, diff --git a/src/wayland/output/mod.rs b/src/wayland/output/mod.rs index 9cc202b..2fcb7b1 100644 --- a/src/wayland/output/mod.rs +++ b/src/wayland/output/mod.rs @@ -59,6 +59,8 @@ use wayland_server::{ Display, Filter, Global, Main, }; +use slog::{info, o, trace, warn}; + /// An output mode /// /// A possible combination of dimensions and refresh rate for an output. diff --git a/src/wayland/seat/keyboard.rs b/src/wayland/seat/keyboard.rs index a5f3d7c..f994bfc 100644 --- a/src/wayland/seat/keyboard.rs +++ b/src/wayland/seat/keyboard.rs @@ -1,5 +1,6 @@ use crate::backend::input::KeyState; use crate::wayland::Serial; +use slog::{debug, info, o, trace, warn}; use std::{ cell::RefCell, default::Default, diff --git a/src/wayland/seat/mod.rs b/src/wayland/seat/mod.rs index b9ddfca..2e534da 100644 --- a/src/wayland/seat/mod.rs +++ b/src/wayland/seat/mod.rs @@ -133,7 +133,7 @@ impl Seat { keyboard: None, known_seats: Vec::new(), }), - log: log.new(o!("smithay_module" => "seat_handler", "seat_name" => name.clone())), + log: log.new(slog::o!("smithay_module" => "seat_handler", "seat_name" => name.clone())), name, user_data: UserDataMap::new(), }); diff --git a/src/wayland/shell/xdg/mod.rs b/src/wayland/shell/xdg/mod.rs index 9f7ed71..b8ea983 100644 --- a/src/wayland/shell/xdg/mod.rs +++ b/src/wayland/shell/xdg/mod.rs @@ -679,7 +679,7 @@ where })); let shell_data = ShellData { - log: log.new(o!("smithay_module" => "xdg_shell_handler")), + log: log.new(slog::o!("smithay_module" => "xdg_shell_handler")), user_impl: Rc::new(RefCell::new(implementation)), shell_state: shell_state.clone(), }; diff --git a/src/wayland/shm/mod.rs b/src/wayland/shm/mod.rs index 6aed28c..82113ef 100644 --- a/src/wayland/shm/mod.rs +++ b/src/wayland/shm/mod.rs @@ -116,7 +116,7 @@ where formats.push(wl_shm::Format::Xrgb8888); let data = ShmGlobalData { formats: formats.into(), - log: log.new(o!("smithay_module" => "shm_handler")), + log: log.new(slog::o!("smithay_module" => "shm_handler")), }; display.create_global::( diff --git a/src/wayland/shm/pool.rs b/src/wayland/shm/pool.rs index f5c4ffa..3d5755d 100644 --- a/src/wayland/shm/pool.rs +++ b/src/wayland/shm/pool.rs @@ -13,6 +13,8 @@ use std::{ sync::{Once, RwLock}, }; +use slog::{debug, trace}; + thread_local!(static SIGBUS_GUARD: Cell<(*const MemMap, bool)> = Cell::new((ptr::null_mut(), false))); static SIGBUS_INIT: Once = Once::new(); diff --git a/src/xwayland/x11_sockets.rs b/src/xwayland/x11_sockets.rs index 9cec647..c4d3a2a 100644 --- a/src/xwayland/x11_sockets.rs +++ b/src/xwayland/x11_sockets.rs @@ -3,6 +3,8 @@ use std::{ os::unix::{io::FromRawFd, net::UnixStream}, }; +use slog::{debug, info, warn}; + use nix::{errno::Errno, sys::socket, Error as NixError, Result as NixResult}; /// Find a free X11 display slot and setup diff --git a/src/xwayland/xserver.rs b/src/xwayland/xserver.rs index 8722828..740bcbc 100644 --- a/src/xwayland/xserver.rs +++ b/src/xwayland/xserver.rs @@ -59,6 +59,8 @@ use calloop::{ Interest, LoopHandle, Mode, RegistrationToken, }; +use slog::{error, info, o}; + use nix::Error as NixError; use wayland_server::{Client, Display, Filter};