Merge pull request #259 from PolyMeilex/debug
Implement Debug trait for some public types
This commit is contained in:
commit
7bbd284f0b
|
@ -20,6 +20,7 @@
|
|||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::rc::Rc;
|
||||
use std::sync::{
|
||||
|
@ -59,6 +60,25 @@ pub struct AtomicDrmDevice<A: AsRawFd + 'static> {
|
|||
logger: ::slog::Logger,
|
||||
}
|
||||
|
||||
// DeviceHandler does not implement Debug, so we have to impl Debug manually
|
||||
impl<A: AsRawFd + fmt::Debug + 'static> fmt::Debug for AtomicDrmDevice<A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut debug = f.debug_struct("AtomicDrmDevice");
|
||||
|
||||
debug
|
||||
.field("dev", &self.dev)
|
||||
.field("dev_id", &self.dev_id)
|
||||
.field("active", &self.active)
|
||||
.field("backends", &self.backends)
|
||||
.field("handler", &"...");
|
||||
|
||||
#[cfg(feature = "backend_session")]
|
||||
debug.field("links", &self.links);
|
||||
|
||||
debug.field("logger", &self.logger).finish()
|
||||
}
|
||||
}
|
||||
|
||||
type OldState = (
|
||||
Vec<(connector::Handle, PropertyValueSet)>,
|
||||
Vec<(crtc::Handle, PropertyValueSet)>,
|
||||
|
@ -73,6 +93,7 @@ type Mapping = (
|
|||
HashMap<plane::Handle, HashMap<String, property::Handle>>,
|
||||
);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(in crate::backend::drm) struct Dev<A: AsRawFd + 'static> {
|
||||
fd: A,
|
||||
privileged: bool,
|
||||
|
|
|
@ -25,6 +25,7 @@ use crate::{
|
|||
/// [`SessionObserver`](SessionObserver)
|
||||
/// linked to the [`AtomicDrmDevice`](AtomicDrmDevice)
|
||||
/// it was created from.
|
||||
#[derive(Debug)]
|
||||
pub struct AtomicDrmDeviceObserver<A: AsRawFd + 'static> {
|
||||
dev: WeakArc<Dev<A>>,
|
||||
dev_id: dev_t,
|
||||
|
|
|
@ -36,6 +36,7 @@ pub struct Planes {
|
|||
pub cursor: plane::Handle,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(in crate::backend::drm) struct AtomicDrmSurfaceInternal<A: AsRawFd + 'static> {
|
||||
pub(super) dev: Arc<Dev<A>>,
|
||||
pub(in crate::backend::drm) crtc: crtc::Handle,
|
||||
|
@ -1003,6 +1004,7 @@ impl<A: AsRawFd + 'static> AtomicDrmSurfaceInternal<A> {
|
|||
}
|
||||
|
||||
/// Open raw crtc utilizing atomic mode-setting
|
||||
#[derive(Debug)]
|
||||
pub struct AtomicDrmSurface<A: AsRawFd + 'static>(
|
||||
pub(in crate::backend::drm) Arc<AtomicDrmSurfaceInternal<A>>,
|
||||
);
|
||||
|
|
|
@ -36,12 +36,14 @@ use drm::{
|
|||
use nix::libc::c_void;
|
||||
use nix::libc::dev_t;
|
||||
use std::env;
|
||||
use std::fmt;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
#[cfg(feature = "use_system_lib")]
|
||||
use wayland_server::Display;
|
||||
|
||||
/// [`Device`](::backend::drm::Device) Wrapper to assist fallback
|
||||
/// in case initialization of the preferred device type fails.
|
||||
#[derive(Debug)]
|
||||
pub enum FallbackDevice<D1: Device + 'static, D2: Device + 'static> {
|
||||
/// Variant for successful initialization of the preferred device
|
||||
Preference(D1),
|
||||
|
@ -129,6 +131,7 @@ where
|
|||
|
||||
/// [`Surface`](::backend::drm::Surface) Wrapper to assist fallback
|
||||
/// in case initialization of the preferred device type fails.
|
||||
#[derive(Debug)]
|
||||
pub enum FallbackSurface<S1: Surface, S2: Surface> {
|
||||
/// Variant for successful initialization of the preferred device
|
||||
Preference(S1),
|
||||
|
|
|
@ -15,6 +15,7 @@ use drm::SystemError as DrmError;
|
|||
use nix::libc::dev_t;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Weak as WeakArc};
|
||||
|
@ -69,6 +70,32 @@ where
|
|||
links: Vec<crate::signaling::SignalToken>,
|
||||
}
|
||||
|
||||
// BackendRef does not implement debug, so we have to impl Debug manually
|
||||
impl<B, D> fmt::Debug for EglDevice<B, D>
|
||||
where
|
||||
B: Backend<Surface = <D as Device>::Surface, Error = <<D as Device>::Surface as Surface>::Error>
|
||||
+ fmt::Debug
|
||||
+ 'static,
|
||||
D: Device + NativeDisplay<B, Arguments = Arguments> + fmt::Debug + 'static,
|
||||
<D as Device>::Surface: NativeSurface<Error = <<D as Device>::Surface as Surface>::Error>,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut debug = f.debug_struct("EglDevice");
|
||||
|
||||
debug
|
||||
.field("dev", &self.dev)
|
||||
.field("logger", &self.logger)
|
||||
.field("default_attributes", &self.default_attributes)
|
||||
.field("default_requirements", &self.default_requirements)
|
||||
.field("backends", &"...");
|
||||
|
||||
#[cfg(feature = "backend_session")]
|
||||
debug.field("links", &self.links);
|
||||
|
||||
debug.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, D> AsRawFd for EglDevice<B, D>
|
||||
where
|
||||
B: Backend<Surface = <D as Device>::Surface, Error = <<D as Device>::Surface as Surface>::Error>
|
||||
|
|
|
@ -23,6 +23,7 @@ use crate::{
|
|||
/// [`SessionObserver`](SessionObserver)
|
||||
/// linked to the [`EglDevice`](EglDevice) it was
|
||||
/// created from.
|
||||
#[derive(Debug)]
|
||||
pub struct EglDeviceObserver<N: NativeSurface + Surface> {
|
||||
backends: Weak<RefCell<HashMap<crtc::Handle, WeakArc<EglSurfaceInternal<N>>>>>,
|
||||
}
|
||||
|
|
|
@ -14,8 +14,10 @@ use crate::backend::graphics::PixelFormat;
|
|||
use crate::backend::graphics::{CursorBackend, SwapBuffersError};
|
||||
|
||||
/// Egl surface for rendering
|
||||
#[derive(Debug)]
|
||||
pub struct EglSurface<N: native::NativeSurface + Surface>(pub(super) Arc<EglSurfaceInternal<N>>);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) struct EglSurfaceInternal<N>
|
||||
where
|
||||
N: native::NativeSurface + Surface,
|
||||
|
|
|
@ -31,6 +31,7 @@ use std::sync::Arc;
|
|||
/// Egl Device backend type
|
||||
///
|
||||
/// See [`Backend`](::backend::egl::native::Backend).
|
||||
#[derive(Debug)]
|
||||
pub struct EglStreamDeviceBackend<D: RawDevice + 'static> {
|
||||
_userdata: PhantomData<D>,
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ use nix::libc::dev_t;
|
|||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::rc::{Rc, Weak};
|
||||
|
@ -90,6 +91,22 @@ pub struct EglStreamDevice<D: RawDevice + ControlDevice + 'static> {
|
|||
links: Vec<crate::signaling::SignalToken>,
|
||||
}
|
||||
|
||||
// SurfaceInternalRef does not implement debug, so we have to impl Debug manually
|
||||
impl<D: RawDevice + ControlDevice + fmt::Debug + 'static> fmt::Debug for EglStreamDevice<D> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut debug = f.debug_struct("EglStreamDevice");
|
||||
debug
|
||||
.field("dev", &self.dev)
|
||||
.field("raw", &self.raw)
|
||||
.field("backends", &"...")
|
||||
.field("logger", &self.logger);
|
||||
|
||||
#[cfg(feature = "backend_session")]
|
||||
debug.field("links", &self.links);
|
||||
debug.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: RawDevice + ControlDevice + 'static> EglStreamDevice<D> {
|
||||
/// Try to create a new [`EglStreamDevice`] from an open device.
|
||||
///
|
||||
|
|
|
@ -19,6 +19,7 @@ use drm::control::{crtc, Device as ControlDevice};
|
|||
/// [`SessionObserver`](SessionObserver)
|
||||
/// linked to the [`EglStreamDevice`](EglStreamDevice) it was
|
||||
/// created from.
|
||||
#[derive(Debug)]
|
||||
pub struct EglStreamDeviceObserver<S: RawSurface + 'static> {
|
||||
backends: Weak<RefCell<HashMap<crtc::Handle, WeakArc<EglStreamSurfaceInternal<S>>>>>,
|
||||
logger: ::slog::Logger,
|
||||
|
|
|
@ -30,10 +30,12 @@ use crate::backend::graphics::CursorBackend;
|
|||
|
||||
// We do not want to mark the whole surface as `Send` in case we screw up somewhere else
|
||||
// and because S needs to be `Send` as well for this to work.
|
||||
#[derive(Debug)]
|
||||
pub(super) struct StreamHandle(pub(super) EGLStreamKHR);
|
||||
// EGLStreamKHR can be moved between threads
|
||||
unsafe impl Send for StreamHandle {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(in crate::backend::drm) struct EglStreamSurfaceInternal<S: RawSurface + 'static> {
|
||||
pub(in crate::backend::drm) crtc: S,
|
||||
pub(in crate::backend::drm) cursor: Mutex<Option<(DumbBuffer, (u32, u32))>>,
|
||||
|
@ -205,6 +207,7 @@ impl<S: RawSurface + 'static> CursorBackend for EglStreamSurfaceInternal<S> {
|
|||
}
|
||||
|
||||
/// egl stream surface for rendering
|
||||
#[derive(Debug)]
|
||||
pub struct EglStreamSurface<S: RawSurface + 'static>(
|
||||
pub(in crate::backend::drm) Arc<EglStreamSurfaceInternal<S>>,
|
||||
);
|
||||
|
|
|
@ -10,6 +10,7 @@ use std::ptr;
|
|||
use std::sync::{atomic::Ordering, Arc};
|
||||
|
||||
/// EGL context for rendering
|
||||
#[derive(Debug)]
|
||||
pub struct EGLContext {
|
||||
context: ffi::egl::types::EGLContext,
|
||||
display: Arc<EGLDisplayHandle>,
|
||||
|
|
|
@ -24,10 +24,12 @@ use std::ffi::CStr;
|
|||
use std::marker::PhantomData;
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
use std::fmt;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// Wrapper around [`ffi::EGLDisplay`](ffi::egl::types::EGLDisplay) to ensure display is only destroyed
|
||||
/// once all resources bound to it have been dropped.
|
||||
#[derive(Debug)]
|
||||
pub struct EGLDisplayHandle {
|
||||
/// ffi EGLDisplay ptr
|
||||
pub handle: ffi::egl::types::EGLDisplay,
|
||||
|
@ -54,6 +56,7 @@ impl Drop for EGLDisplayHandle {
|
|||
}
|
||||
|
||||
/// [`EGLDisplay`] represents an initialised EGL environment
|
||||
#[derive(Debug)]
|
||||
pub struct EGLDisplay<B: native::Backend, N: native::NativeDisplay<B>> {
|
||||
native: RefCell<N>,
|
||||
pub(crate) display: Arc<EGLDisplayHandle>,
|
||||
|
@ -454,6 +457,17 @@ pub struct EGLBufferReader {
|
|||
gl: gl_ffi::Gles2,
|
||||
}
|
||||
|
||||
// Gles2 does not implement debug, so we have to impl Debug manually
|
||||
#[cfg(feature = "use_system_lib")]
|
||||
impl fmt::Debug for EGLBufferReader {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("EGLBufferReader")
|
||||
.field("display", &self.display)
|
||||
.field("wayland", &self.wayland)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "use_system_lib")]
|
||||
impl EGLBufferReader {
|
||||
fn new(display: Arc<EGLDisplayHandle>, wayland: *mut wl_display) -> Self {
|
||||
|
|
|
@ -269,6 +269,21 @@ pub struct EGLImages {
|
|||
gl: gl_ffi::Gles2,
|
||||
}
|
||||
|
||||
// Gles2 does not implement debug, so we have to impl Debug manually
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
impl fmt::Debug for EGLImages {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Point")
|
||||
.field("display", &self.display)
|
||||
.field("width", &self.width)
|
||||
.field("height", &self.height)
|
||||
.field("y_inverted", &self.y_inverted)
|
||||
.field("format", &self.format)
|
||||
.field("images", &self.images)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
impl EGLImages {
|
||||
/// Amount of planes of these `EGLImages`
|
||||
|
|
|
@ -35,6 +35,7 @@ pub trait Backend {
|
|||
}
|
||||
|
||||
#[cfg(feature = "backend_winit")]
|
||||
#[derive(Debug)]
|
||||
/// Wayland backend type
|
||||
pub enum Wayland {}
|
||||
#[cfg(feature = "backend_winit")]
|
||||
|
@ -79,10 +80,12 @@ impl Backend for Wayland {
|
|||
}
|
||||
|
||||
#[cfg(feature = "backend_winit")]
|
||||
#[derive(Debug)]
|
||||
/// Typed Xlib window for the `X11` backend
|
||||
pub struct XlibWindow(u64);
|
||||
#[cfg(feature = "backend_winit")]
|
||||
/// X11 backend type
|
||||
#[derive(Debug)]
|
||||
pub enum X11 {}
|
||||
#[cfg(feature = "backend_winit")]
|
||||
impl Backend for X11 {
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::sync::{
|
|||
};
|
||||
|
||||
/// EGL surface of a given EGL context for rendering
|
||||
#[derive(Debug)]
|
||||
pub struct EGLSurface<N: native::NativeSurface> {
|
||||
pub(crate) display: Arc<EGLDisplayHandle>,
|
||||
native: N,
|
||||
|
|
|
@ -8,6 +8,7 @@ use glium::{
|
|||
};
|
||||
use std::{
|
||||
cell::{Cell, Ref, RefCell, RefMut},
|
||||
fmt,
|
||||
os::raw::c_void,
|
||||
rc::Rc,
|
||||
};
|
||||
|
@ -22,6 +23,29 @@ pub struct GliumGraphicsBackend<T: GLGraphicsBackend> {
|
|||
error_channel: Rc<Cell<Option<Box<dyn std::error::Error>>>>,
|
||||
}
|
||||
|
||||
// GLGraphicsBackend is a trait, so we have to impl Debug manually
|
||||
impl<T: GLGraphicsBackend> fmt::Debug for GliumGraphicsBackend<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
struct BackendDebug<'a, T: GLGraphicsBackend>(&'a Rc<InternalBackend<T>>);
|
||||
impl<'a, T: GLGraphicsBackend> fmt::Debug for BackendDebug<'a, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let b = &self.0 .0.borrow();
|
||||
f.debug_struct("GLGraphicsBackend")
|
||||
.field("framebuffer_dimensions", &b.get_framebuffer_dimensions())
|
||||
.field("is_current", &b.is_current())
|
||||
.field("pixel_format", &b.get_pixel_format())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
f.debug_struct("GliumGraphicsBackend")
|
||||
.field("context", &"...")
|
||||
.field("backend", &BackendDebug(&self.backend))
|
||||
.field("error_channel", &"...")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
struct InternalBackend<T: GLGraphicsBackend>(RefCell<T>, Rc<Cell<Option<Box<dyn std::error::Error>>>>);
|
||||
|
||||
impl<T: GLGraphicsBackend + 'static> GliumGraphicsBackend<T> {
|
||||
|
|
|
@ -87,6 +87,7 @@ pub trait Event {
|
|||
/// that is not used by an [`InputBackend`] implementation. Initialization is not
|
||||
/// possible, making accidental use impossible and enabling a lot of possible
|
||||
/// compiler optimizations.
|
||||
#[derive(Debug)]
|
||||
pub enum UnusedEvent {}
|
||||
|
||||
impl Event for UnusedEvent {
|
||||
|
@ -537,6 +538,7 @@ pub trait InputBackend: Sized {
|
|||
}
|
||||
|
||||
/// Different events that can be generated by an input backend
|
||||
#[derive(Debug)]
|
||||
pub enum InputEvent<B: InputBackend> {
|
||||
/// A new seat has been created
|
||||
NewSeat(Seat),
|
||||
|
|
|
@ -16,6 +16,7 @@ use input::event;
|
|||
use std::path::Path;
|
||||
use std::{
|
||||
collections::hash_map::HashMap,
|
||||
fmt,
|
||||
io::Error as IoError,
|
||||
os::unix::io::{AsRawFd, RawFd},
|
||||
};
|
||||
|
@ -32,6 +33,7 @@ const INPUT_MAJOR: u32 = 13;
|
|||
///
|
||||
/// Tracks input of all devices given manually or via a udev seat to a provided libinput
|
||||
/// context.
|
||||
#[derive(Debug)]
|
||||
pub struct LibinputInputBackend {
|
||||
context: libinput::Libinput,
|
||||
config: LibinputConfig,
|
||||
|
@ -273,6 +275,7 @@ impl backend::Event for event::touch::TouchFrameEvent {
|
|||
impl backend::TouchFrameEvent for event::touch::TouchFrameEvent {}
|
||||
|
||||
/// Special events generated by Libinput
|
||||
#[derive(Debug)]
|
||||
pub enum LibinputEvent {
|
||||
/// A new device was plugged in
|
||||
NewDevice(libinput::Device),
|
||||
|
@ -284,6 +287,7 @@ pub enum LibinputEvent {
|
|||
///
|
||||
/// This type allows you to access the list of know devices to configure them
|
||||
/// if relevant
|
||||
#[derive(Debug)]
|
||||
pub struct LibinputConfig {
|
||||
devices: Vec<libinput::Device>,
|
||||
}
|
||||
|
@ -421,6 +425,7 @@ impl From<event::pointer::ButtonState> for backend::MouseButtonState {
|
|||
/// Wrapper for types implementing the [`Session`] trait to provide
|
||||
/// a [`libinput::LibinputInterface`] implementation.
|
||||
#[cfg(feature = "backend_session")]
|
||||
#[derive(Debug)]
|
||||
pub struct LibinputSessionInterface<S: Session>(S);
|
||||
|
||||
#[cfg(feature = "backend_session")]
|
||||
|
|
|
@ -44,7 +44,7 @@ use std::{cell::RefCell, io, os::unix::io::RawFd, path::Path, rc::Rc};
|
|||
use calloop::{EventSource, Poll, Readiness, Token};
|
||||
|
||||
/// [`Session`] using the best available interface
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum AutoSession {
|
||||
/// Logind session
|
||||
#[cfg(feature = "backend_session_logind")]
|
||||
|
@ -54,6 +54,7 @@ pub enum AutoSession {
|
|||
}
|
||||
|
||||
/// [`SessionNotifier`] using the best available interface
|
||||
#[derive(Debug)]
|
||||
pub enum AutoSessionNotifier {
|
||||
/// Logind session notifier
|
||||
#[cfg(feature = "backend_session_logind")]
|
||||
|
|
|
@ -49,6 +49,7 @@ use nix::{
|
|||
};
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
fmt,
|
||||
io::Error as IoError,
|
||||
os::unix::io::RawFd,
|
||||
path::Path,
|
||||
|
@ -70,15 +71,30 @@ struct LogindSessionImpl {
|
|||
logger: ::slog::Logger,
|
||||
}
|
||||
|
||||
// DBusConnection does not implement debug, so we have to impl Debug manually
|
||||
impl fmt::Debug for LogindSessionImpl {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("LogindSessionImpl ")
|
||||
.field("session_id", &self.session_id)
|
||||
.field("conn", &"...")
|
||||
.field("session_path", &self.session_path)
|
||||
.field("active", &self.active)
|
||||
.field("signaler", &self.signaler)
|
||||
.field("seat", &self.seat)
|
||||
.field("logger", &self.logger)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
/// [`Session`] via the logind dbus interface
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LogindSession {
|
||||
internal: Weak<LogindSessionImpl>,
|
||||
seat: String,
|
||||
}
|
||||
|
||||
/// [`SessionNotifier`] via the logind dbus interface
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LogindSessionNotifier {
|
||||
internal: Rc<LogindSessionImpl>,
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ use nix::{
|
|||
Error as NixError, Result as NixResult,
|
||||
};
|
||||
use std::{
|
||||
fmt,
|
||||
os::unix::io::RawFd,
|
||||
path::Path,
|
||||
sync::{
|
||||
|
@ -142,6 +143,7 @@ fn is_tty_device(dev: dev_t, path: Option<&Path>) -> bool {
|
|||
}
|
||||
|
||||
/// [`Session`] via the virtual terminal direct kernel interface
|
||||
#[derive(Debug)]
|
||||
pub struct DirectSession {
|
||||
tty: RawFd,
|
||||
active: Arc<AtomicBool>,
|
||||
|
@ -160,6 +162,26 @@ pub struct DirectSessionNotifier {
|
|||
source: Option<Signals>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for DirectSessionNotifier {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Point")
|
||||
.field("tty", &self.tty)
|
||||
.field("active", &self.active)
|
||||
.field("signaler", &self.signaler)
|
||||
.field("signal", &self.signal)
|
||||
.field("logger", &self.logger)
|
||||
// Signal deos not implement Debug`
|
||||
.field(
|
||||
"source",
|
||||
&match self.source {
|
||||
Some(_) => "Some(..)",
|
||||
None => "None",
|
||||
},
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl DirectSession {
|
||||
/// Tries to create a new session via the legacy virtual terminal interface.
|
||||
///
|
||||
|
|
|
@ -43,6 +43,7 @@ use nix::sys::stat::{dev_t, stat};
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
ffi::OsString,
|
||||
fmt,
|
||||
io::Result as IoResult,
|
||||
os::unix::io::{AsRawFd, RawFd},
|
||||
path::{Path, PathBuf},
|
||||
|
@ -62,6 +63,18 @@ pub struct UdevBackend {
|
|||
logger: ::slog::Logger,
|
||||
}
|
||||
|
||||
// MonitorSocket does not implement debug, so we have to impl Debug manually
|
||||
impl fmt::Debug for UdevBackend {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use udev::AsRaw;
|
||||
f.debug_struct("UdevBackend")
|
||||
.field("devices", &self.devices)
|
||||
.field("monitor", &format!("MonitorSocket ({:?})", self.monitor.as_raw()))
|
||||
.field("logger", &self.logger)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRawFd for UdevBackend {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
self.monitor.as_raw_fd()
|
||||
|
@ -182,6 +195,7 @@ impl EventSource for UdevBackend {
|
|||
}
|
||||
|
||||
/// Events generated by the [`UdevBackend`], notifying you of changes in system devices
|
||||
#[derive(Debug)]
|
||||
pub enum UdevEvent {
|
||||
/// A new device has been detected
|
||||
Added {
|
||||
|
|
|
@ -16,6 +16,7 @@ use nix::libc::c_void;
|
|||
use std::{
|
||||
cell::{Ref, RefCell},
|
||||
convert::TryInto,
|
||||
fmt,
|
||||
rc::Rc,
|
||||
time::Instant,
|
||||
};
|
||||
|
@ -65,6 +66,30 @@ enum Window {
|
|||
},
|
||||
}
|
||||
|
||||
// WlEglSurface does not implement debug, so we have to impl Debug manually
|
||||
impl fmt::Debug for Window {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Window::Wayland { display, context, .. } => f
|
||||
.debug_struct("Window::Wayland")
|
||||
.field("display", &display)
|
||||
.field("context", &context)
|
||||
.field("surface", &"...")
|
||||
.finish(),
|
||||
Window::X11 {
|
||||
display,
|
||||
context,
|
||||
surface,
|
||||
} => f
|
||||
.debug_struct("Window::X11")
|
||||
.field("display", &display)
|
||||
.field("context", &context)
|
||||
.field("surface", &surface)
|
||||
.finish(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Window {
|
||||
fn window(&self) -> Ref<'_, WinitWindow> {
|
||||
match *self {
|
||||
|
@ -74,6 +99,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct WindowSize {
|
||||
physical_size: PhysicalSize<u32>,
|
||||
scale_factor: f64,
|
||||
|
@ -81,6 +107,7 @@ struct WindowSize {
|
|||
|
||||
/// Window with an active EGL Context created by `winit`. Implements the
|
||||
/// [`EGLGraphicsBackend`] and [`GLGraphicsBackend`] graphics backend trait
|
||||
#[derive(Debug)]
|
||||
pub struct WinitGraphicsBackend {
|
||||
window: Rc<Window>,
|
||||
size: Rc<RefCell<WindowSize>>,
|
||||
|
@ -91,6 +118,7 @@ pub struct WinitGraphicsBackend {
|
|||
///
|
||||
/// You need to call [`dispatch_new_events`](InputBackend::dispatch_new_events)
|
||||
/// periodically to receive any events.
|
||||
#[derive(Debug)]
|
||||
pub struct WinitInputBackend {
|
||||
events_loop: EventLoop<()>,
|
||||
window: Rc<Window>,
|
||||
|
@ -226,6 +254,7 @@ where
|
|||
}
|
||||
|
||||
/// Specific events generated by Winit
|
||||
#[derive(Debug)]
|
||||
pub enum WinitEvent {
|
||||
/// The window has been resized
|
||||
Resized {
|
||||
|
@ -358,8 +387,8 @@ pub enum WinitInputError {
|
|||
WindowClosed,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a [`KeyboardKeyEvent`]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct WinitKeyboardInputEvent {
|
||||
time: u32,
|
||||
key: u32,
|
||||
|
@ -387,8 +416,8 @@ impl KeyboardKeyEvent for WinitKeyboardInputEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a [`PointerMotionAbsoluteEvent`]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WinitMouseMovedEvent {
|
||||
size: Rc<RefCell<WindowSize>>,
|
||||
time: u32,
|
||||
|
@ -426,8 +455,8 @@ impl PointerMotionAbsoluteEvent for WinitMouseMovedEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a [`PointerAxisEvent`]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct WinitMouseWheelEvent {
|
||||
time: u32,
|
||||
delta: MouseScrollDelta,
|
||||
|
@ -464,8 +493,8 @@ impl PointerAxisEvent for WinitMouseWheelEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a [`PointerButtonEvent`]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct WinitMouseInputEvent {
|
||||
time: u32,
|
||||
button: WinitMouseButton,
|
||||
|
@ -488,8 +517,8 @@ impl PointerButtonEvent for WinitMouseInputEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a [`TouchDownEvent`]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WinitTouchStartedEvent {
|
||||
size: Rc<RefCell<WindowSize>>,
|
||||
time: u32,
|
||||
|
@ -531,8 +560,8 @@ impl TouchDownEvent for WinitTouchStartedEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a [`TouchMotionEvent`]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WinitTouchMovedEvent {
|
||||
size: Rc<RefCell<WindowSize>>,
|
||||
time: u32,
|
||||
|
@ -574,8 +603,8 @@ impl TouchMotionEvent for WinitTouchMovedEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a `TouchUpEvent`
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct WinitTouchEndedEvent {
|
||||
time: u32,
|
||||
id: u64,
|
||||
|
@ -593,8 +622,8 @@ impl TouchUpEvent for WinitTouchEndedEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
/// Winit-Backend internal event wrapping `winit`'s types into a [`TouchCancelEvent`]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct WinitTouchCancelledEvent {
|
||||
time: u32,
|
||||
id: u64,
|
||||
|
@ -615,6 +644,7 @@ impl TouchCancelEvent for WinitTouchCancelledEvent {
|
|||
/// Input config for Winit
|
||||
///
|
||||
/// This backend does not allow any input configuration, so this type does nothing.
|
||||
#[derive(Debug)]
|
||||
pub struct WinitInputConfig;
|
||||
|
||||
impl InputBackend for WinitInputBackend {
|
||||
|
|
|
@ -21,10 +21,12 @@ use std::{
|
|||
any::Any,
|
||||
cell::RefCell,
|
||||
collections::VecDeque,
|
||||
fmt,
|
||||
rc::{Rc, Weak},
|
||||
};
|
||||
|
||||
/// A signaler, main type for signaling
|
||||
#[derive(Debug)]
|
||||
pub struct Signaler<S> {
|
||||
inner: Rc<SignalInner<S>>,
|
||||
}
|
||||
|
@ -88,6 +90,7 @@ impl<S> Default for Signaler<S> {
|
|||
/// Dropping it will disable and drop the callback it is associated to.
|
||||
/// If you don't plan to ever disable the callback, you can use the `leak`
|
||||
/// method to safely get rid of this value.
|
||||
#[derive(Debug)]
|
||||
pub struct SignalToken {
|
||||
signal: Rc<dyn Any>,
|
||||
}
|
||||
|
@ -108,6 +111,17 @@ struct SignalInner<S> {
|
|||
pending_events: RefCell<VecDeque<S>>,
|
||||
}
|
||||
|
||||
// WeakCallback does not implement debug, so we have to impl Debug manually
|
||||
impl<S: fmt::Debug> fmt::Debug for SignalInner<S> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("SignalInner")
|
||||
.field("callbacks::len()", &self.callbacks.borrow().len())
|
||||
.field("pending_callbacks::len()", &self.pending_callbacks.borrow().len())
|
||||
.field("pending_events", &self.pending_events)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> SignalInner<S> {
|
||||
fn new() -> SignalInner<S> {
|
||||
SignalInner {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::{rc::Rc, cell::RefCell};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct SignalerInner<E> {
|
||||
closures: RefCell<Vec<Box<dyn FnMut(&mut E)>>>
|
||||
}
|
||||
|
@ -12,6 +13,7 @@ impl<E> SignalerInner<E> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Signaler<E> {
|
||||
inner: Rc<SignalerInner<E>>
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
//! surfaces. See the documentation of the [`roles`](::wayland::compositor::roles) submodule
|
||||
//! for a detailed explanation.
|
||||
|
||||
use std::{cell::RefCell, rc::Rc, sync::Mutex};
|
||||
use std::{cell::RefCell, fmt, rc::Rc, sync::Mutex};
|
||||
|
||||
mod handlers;
|
||||
pub mod roles;
|
||||
|
@ -89,6 +89,7 @@ use wayland_server::{
|
|||
|
||||
/// Description of which part of a surface
|
||||
/// should be considered damaged and needs to be redrawn
|
||||
#[derive(Debug)]
|
||||
pub enum Damage {
|
||||
/// The whole surface must be considered damaged (this is the default)
|
||||
Full,
|
||||
|
@ -100,12 +101,13 @@ pub enum Damage {
|
|||
Buffer(Rectangle),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
#[derive(Debug, Copy, Clone, Default)]
|
||||
struct Marker<R> {
|
||||
_r: ::std::marker::PhantomData<R>,
|
||||
}
|
||||
|
||||
/// New buffer assignation for a surface
|
||||
#[derive(Debug)]
|
||||
pub enum BufferAssignment {
|
||||
/// The surface no longer has a buffer attached to it
|
||||
Removed,
|
||||
|
@ -170,6 +172,22 @@ pub struct SurfaceAttributes {
|
|||
pub user_data: UserDataMap,
|
||||
}
|
||||
|
||||
// UserDataMap does not implement debug, so we have to impl Debug manually
|
||||
impl fmt::Debug for SurfaceAttributes {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("SurfaceAttributes")
|
||||
.field("buffer", &self.buffer)
|
||||
.field("buffer_scale", &self.buffer_scale)
|
||||
.field("buffer_transform", &self.buffer_transform)
|
||||
.field("opaque_region", &self.opaque_region)
|
||||
.field("input_region", &self.input_region)
|
||||
.field("damage", &self.damage)
|
||||
.field("frame_callback", &self.frame_callback)
|
||||
.field("user_data", &"...")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SurfaceAttributes {
|
||||
fn default() -> SurfaceAttributes {
|
||||
SurfaceAttributes {
|
||||
|
@ -259,6 +277,7 @@ impl RegionAttributes {
|
|||
/// access data associated with the [`wl_surface`](wayland_server::protocol::wl_surface)
|
||||
/// and [`wl_region`](wayland_server::protocol::wl_region) managed
|
||||
/// by the `CompositorGlobal` that provided it.
|
||||
#[derive(Debug)]
|
||||
pub struct CompositorToken<R> {
|
||||
_role: ::std::marker::PhantomData<*mut R>,
|
||||
}
|
||||
|
@ -516,6 +535,7 @@ where
|
|||
/// The global provided by smithay cannot process these events for you, so
|
||||
/// they are forwarded directly via your provided implementation, and are
|
||||
/// described by this global.
|
||||
#[derive(Debug)]
|
||||
pub enum SurfaceEvent {
|
||||
/// The double-buffered state has been validated by the client
|
||||
///
|
||||
|
|
|
@ -28,6 +28,7 @@ pub enum Location {
|
|||
}
|
||||
|
||||
/// Possible actions to do after handling a node diring tree traversal
|
||||
#[derive(Debug)]
|
||||
pub enum TraversalAction<T> {
|
||||
/// Traverse its children as well, providing them the data T
|
||||
DoChildren(T),
|
||||
|
|
|
@ -78,6 +78,7 @@ pub use self::data_source::{with_source_metadata, SourceMetadata};
|
|||
pub use self::server_dnd_grab::ServerDndEvent;
|
||||
|
||||
/// Events that are generated by interactions of the clients with the data device
|
||||
#[derive(Debug)]
|
||||
pub enum DataDeviceEvent {
|
||||
/// A client has set the selection
|
||||
NewSelection(Option<wl_data_source::WlDataSource>),
|
||||
|
@ -108,7 +109,7 @@ pub enum DataDeviceEvent {
|
|||
}
|
||||
|
||||
/// The role applied to surfaces used as DnD icons
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct DnDIconRole;
|
||||
|
||||
enum Selection {
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::wayland::Serial;
|
|||
use super::{DataDeviceData, SeatData};
|
||||
|
||||
/// Event generated by the interactions of clients with a server initiated drag'n'drop
|
||||
#[derive(Debug)]
|
||||
pub enum ServerDndEvent {
|
||||
/// The client chose an action
|
||||
Action(DndAction),
|
||||
|
|
|
@ -76,6 +76,7 @@ use wayland_protocols::unstable::linux_dmabuf::v1::server::{
|
|||
use wayland_server::{protocol::wl_buffer, Display, Filter, Global, Main};
|
||||
|
||||
/// Representation of a Dmabuf format, as advertized to the client
|
||||
#[derive(Debug)]
|
||||
pub struct Format {
|
||||
/// The format identifier.
|
||||
pub format: ::drm::buffer::format::PixelFormat,
|
||||
|
@ -89,6 +90,7 @@ pub struct Format {
|
|||
}
|
||||
|
||||
/// A plane send by the client
|
||||
#[derive(Debug)]
|
||||
pub struct Plane {
|
||||
/// The file descriptor
|
||||
pub fd: RawFd,
|
||||
|
@ -115,6 +117,7 @@ bitflags! {
|
|||
}
|
||||
|
||||
/// The complete information provided by the client to create a dmabuf buffer
|
||||
#[derive(Debug)]
|
||||
pub struct BufferInfo {
|
||||
/// The submitted planes
|
||||
pub planes: Vec<Plane>,
|
||||
|
|
|
@ -86,6 +86,7 @@ use wayland_server::{protocol::wl_surface::WlSurface, Display, Filter, Global, M
|
|||
use crate::wayland::compositor::{CompositorToken, SurfaceAttributes};
|
||||
|
||||
/// An object to signal end of use of a buffer
|
||||
#[derive(Debug)]
|
||||
pub struct ExplicitBufferRelease {
|
||||
release: ZwpLinuxBufferReleaseV1,
|
||||
}
|
||||
|
@ -111,6 +112,7 @@ impl ExplicitBufferRelease {
|
|||
/// The client is not required to fill both. `acquire` being `None` means that you don't need to wait
|
||||
/// before acessing the buffer, `release` being `None` means that the client does not require additionnal
|
||||
/// signaling that you are finished (you still need to send `wl_buffer.release`).
|
||||
#[derive(Debug)]
|
||||
pub struct ExplicitSyncState {
|
||||
/// An acquire `dma_fence` object, that you should wait on before accessing the contents of the
|
||||
/// buffer associated with the surface.
|
||||
|
@ -143,6 +145,7 @@ impl ESUserData {
|
|||
}
|
||||
|
||||
/// Possible errors you can send to an ill-behaving clients
|
||||
#[derive(Debug)]
|
||||
pub enum ExplicitSyncError {
|
||||
/// An invalid file descriptor was sent by the client for an acquire fence
|
||||
InvalidFence,
|
||||
|
|
|
@ -80,6 +80,7 @@ impl From<Serial> for u32 {
|
|||
///
|
||||
/// The counter will wrap around on overflow, ensuring it can run for as long
|
||||
/// as needed.
|
||||
#[derive(Debug)]
|
||||
pub struct SerialCounter {
|
||||
// TODO: replace with an AtomicU32 when stabilized
|
||||
serial: AtomicUsize,
|
||||
|
|
|
@ -65,7 +65,7 @@ use wayland_server::{
|
|||
///
|
||||
/// This should only describe the characteristics of the video driver,
|
||||
/// not taking into account any global scaling.
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub struct Mode {
|
||||
/// The width in pixels
|
||||
pub width: i32,
|
||||
|
@ -78,6 +78,7 @@ pub struct Mode {
|
|||
}
|
||||
|
||||
/// The physical properties of an output
|
||||
#[derive(Debug)]
|
||||
pub struct PhysicalProperties {
|
||||
/// The width in millimeters
|
||||
pub width: i32,
|
||||
|
@ -91,6 +92,7 @@ pub struct PhysicalProperties {
|
|||
pub model: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Inner {
|
||||
name: String,
|
||||
log: ::slog::Logger,
|
||||
|
@ -155,6 +157,7 @@ impl Inner {
|
|||
///
|
||||
/// This handle is stored in the event loop, and allows you to notify clients
|
||||
/// about any change in the properties of this output.
|
||||
#[derive(Debug)]
|
||||
pub struct Output {
|
||||
inner: Arc<Mutex<Inner>>,
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ use crate::wayland::Serial;
|
|||
use std::{
|
||||
cell::RefCell,
|
||||
default::Default,
|
||||
fmt,
|
||||
io::{Error as IoError, Write},
|
||||
ops::Deref as _,
|
||||
os::unix::io::AsRawFd,
|
||||
|
@ -119,6 +120,23 @@ struct KbdInternal {
|
|||
focus_hook: Box<dyn FnMut(Option<&WlSurface>)>,
|
||||
}
|
||||
|
||||
// focus_hook does not implement debug, so we have to impl Debug manually
|
||||
impl fmt::Debug for KbdInternal {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("KbdInternal")
|
||||
.field("known_kbds", &self.known_kbds)
|
||||
.field("focus", &self.focus)
|
||||
.field("pressed_keys", &self.pressed_keys)
|
||||
.field("mods_state", &self.mods_state)
|
||||
.field("keymap", &self.keymap.get_raw_ptr())
|
||||
.field("state", &self.state.get_raw_ptr())
|
||||
.field("repeat_rate", &self.repeat_rate)
|
||||
.field("repeat_delay", &self.repeat_delay)
|
||||
.field("focus_hook", &"...")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
// This is OK because all parts of `xkb` will remain on the
|
||||
// same thread
|
||||
unsafe impl Send for KbdInternal {}
|
||||
|
@ -267,6 +285,7 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct KbdRc {
|
||||
internal: RefCell<KbdInternal>,
|
||||
keymap: String,
|
||||
|
@ -284,7 +303,7 @@ struct KbdRc {
|
|||
/// - process key inputs from the input backend, allowing them to be caught at the compositor-level
|
||||
/// or forwarded to the client. See the documentation of the [`KeyboardHandle::input`] method for
|
||||
/// details.
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KeyboardHandle {
|
||||
arc: Rc<KbdRc>,
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
//! These methods return handles that can be cloned and sent across thread, so you can keep one around
|
||||
//! in your event-handling code to forward inputs to your clients.
|
||||
|
||||
use std::{cell::RefCell, ops::Deref as _, rc::Rc};
|
||||
use std::{cell::RefCell, fmt, ops::Deref as _, rc::Rc};
|
||||
|
||||
mod keyboard;
|
||||
mod pointer;
|
||||
|
@ -60,6 +60,7 @@ use wayland_server::{
|
|||
Display, Filter, Global, Main, UserDataMap,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Inner {
|
||||
pointer: Option<PointerHandle>,
|
||||
keyboard: Option<KeyboardHandle>,
|
||||
|
@ -73,6 +74,18 @@ pub(crate) struct SeatRc {
|
|||
name: String,
|
||||
}
|
||||
|
||||
// UserDataMap does not implement debug, so we have to impl Debug manually
|
||||
impl fmt::Debug for SeatRc {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("SeatRc")
|
||||
.field("inner", &self.inner)
|
||||
.field("user_data", &"...")
|
||||
.field("log", &self.log)
|
||||
.field("name", &self.name)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Inner {
|
||||
fn compute_caps(&self) -> wl_seat::Capability {
|
||||
let mut caps = wl_seat::Capability::empty();
|
||||
|
@ -103,7 +116,7 @@ impl Inner {
|
|||
/// This is an handle to the inner logic, it can be cloned.
|
||||
///
|
||||
/// See module-level documentation for details of use.
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Seat {
|
||||
pub(crate) arc: Rc<SeatRc>,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{cell::RefCell, ops::Deref as _, rc::Rc};
|
||||
use std::{cell::RefCell, fmt, ops::Deref as _, rc::Rc};
|
||||
|
||||
use wayland_server::{
|
||||
protocol::{
|
||||
|
@ -12,14 +12,14 @@ use crate::wayland::compositor::{roles::Role, CompositorToken};
|
|||
use crate::wayland::Serial;
|
||||
|
||||
/// The role representing a surface set as the pointer cursor
|
||||
#[derive(Default, Copy, Clone)]
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
pub struct CursorImageRole {
|
||||
/// Location of the hotspot of the pointer in the surface
|
||||
pub hotspot: (i32, i32),
|
||||
}
|
||||
|
||||
/// Possible status of a cursor as requested by clients
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum CursorImageStatus {
|
||||
/// The cursor should be hidden
|
||||
Hidden,
|
||||
|
@ -35,6 +35,17 @@ enum GrabStatus {
|
|||
Borrowed,
|
||||
}
|
||||
|
||||
// PointerGrab is a trait, so we have to impl Debug manually
|
||||
impl fmt::Debug for GrabStatus {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
GrabStatus::None => f.debug_tuple("GrabStatus::None").finish(),
|
||||
GrabStatus::Active(serial, _) => f.debug_tuple("GrabStatus::Active").field(&serial).finish(),
|
||||
GrabStatus::Borrowed => f.debug_tuple("GrabStatus::Borrowed").finish(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct PointerInternal {
|
||||
known_pointers: Vec<WlPointer>,
|
||||
focus: Option<(WlSurface, (f64, f64))>,
|
||||
|
@ -45,6 +56,21 @@ struct PointerInternal {
|
|||
image_callback: Box<dyn FnMut(CursorImageStatus)>,
|
||||
}
|
||||
|
||||
// image_callback does not implement debug, so we have to impl Debug manually
|
||||
impl fmt::Debug for PointerInternal {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Point")
|
||||
.field("known_pointers", &self.known_pointers)
|
||||
.field("focus", &self.focus)
|
||||
.field("pending_focus", &self.pending_focus)
|
||||
.field("location", &self.location)
|
||||
.field("grab", &self.grab)
|
||||
.field("pressed_buttons", &self.pressed_buttons)
|
||||
.field("image_callback", &"...")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl PointerInternal {
|
||||
fn new<F, R>(token: CompositorToken<R>, mut cb: F) -> PointerInternal
|
||||
where
|
||||
|
@ -125,7 +151,7 @@ impl PointerInternal {
|
|||
///
|
||||
/// When sending events using this handle, they will be intercepted by a pointer
|
||||
/// grab if any is active. See the [`PointerGrab`] trait for details.
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PointerHandle {
|
||||
inner: Rc<RefCell<PointerInternal>>,
|
||||
}
|
||||
|
@ -233,7 +259,7 @@ impl PointerHandle {
|
|||
}
|
||||
|
||||
/// Data about the event that started the grab.
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GrabStartData {
|
||||
/// The focused surface and its location, if any, at the start of the grab.
|
||||
///
|
||||
|
@ -287,6 +313,7 @@ pub trait PointerGrab {
|
|||
|
||||
/// This inner handle is accessed from inside a pointer grab logic, and directly
|
||||
/// sends event to the client
|
||||
#[derive(Debug)]
|
||||
pub struct PointerInnerHandle<'a> {
|
||||
inner: &'a mut PointerInternal,
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ use wayland_server::{
|
|||
mod wl_handlers;
|
||||
|
||||
/// Metadata associated with the `wl_surface` role
|
||||
#[derive(Debug)]
|
||||
pub struct ShellSurfaceRole {
|
||||
/// Title of the surface
|
||||
pub title: String,
|
||||
|
@ -86,6 +87,7 @@ pub struct ShellSurfaceRole {
|
|||
}
|
||||
|
||||
/// A handle to a shell surface
|
||||
#[derive(Debug)]
|
||||
pub struct ShellSurface<R> {
|
||||
wl_surface: wl_surface::WlSurface,
|
||||
shell_surface: wl_shell_surface::WlShellSurface,
|
||||
|
@ -169,6 +171,7 @@ where
|
|||
}
|
||||
|
||||
/// Possible kinds of shell surface of the `wl_shell` protocol
|
||||
#[derive(Debug)]
|
||||
pub enum ShellSurfaceKind {
|
||||
/// Toplevel, a regular window displayed somewhere in the compositor space
|
||||
Toplevel,
|
||||
|
@ -222,6 +225,7 @@ pub enum ShellSurfaceKind {
|
|||
}
|
||||
|
||||
/// A request triggered by a `wl_shell_surface`
|
||||
#[derive(Debug)]
|
||||
pub enum ShellRequest<R> {
|
||||
/// A new shell surface was created
|
||||
///
|
||||
|
@ -275,6 +279,7 @@ pub enum ShellRequest<R> {
|
|||
///
|
||||
/// This state allows you to retrieve a list of surfaces
|
||||
/// currently known to the shell global.
|
||||
#[derive(Debug)]
|
||||
pub struct ShellState<R> {
|
||||
known_surfaces: Vec<ShellSurface<R>>,
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ mod xdg_handlers;
|
|||
mod zxdgv6_handlers;
|
||||
|
||||
/// Metadata associated with the `xdg_surface` role
|
||||
#[derive(Debug)]
|
||||
pub struct XdgSurfaceRole {
|
||||
/// Pending state as requested by the client
|
||||
///
|
||||
|
@ -177,6 +178,7 @@ impl PositionerState {
|
|||
}
|
||||
|
||||
/// Contents of the pending state of a shell surface, depending on its role
|
||||
#[derive(Debug)]
|
||||
pub enum XdgSurfacePendingState {
|
||||
/// This a regular, toplevel surface
|
||||
///
|
||||
|
@ -196,6 +198,7 @@ pub enum XdgSurfacePendingState {
|
|||
}
|
||||
|
||||
/// State of a regular toplevel surface
|
||||
#[derive(Debug)]
|
||||
pub struct ToplevelState {
|
||||
/// Parent of this surface
|
||||
///
|
||||
|
@ -233,6 +236,7 @@ impl Clone for ToplevelState {
|
|||
}
|
||||
|
||||
/// The pending state of a popup surface
|
||||
#[derive(Debug)]
|
||||
pub struct PopupState {
|
||||
/// Parent of this popup surface
|
||||
pub parent: Option<wl_surface::WlSurface>,
|
||||
|
@ -326,6 +330,7 @@ where
|
|||
///
|
||||
/// This state allows you to retrieve a list of surfaces
|
||||
/// currently known to the shell global.
|
||||
#[derive(Debug)]
|
||||
pub struct ShellState<R> {
|
||||
known_toplevels: Vec<ToplevelSurface<R>>,
|
||||
known_popups: Vec<PopupSurface<R>>,
|
||||
|
@ -350,6 +355,7 @@ where
|
|||
* User interaction
|
||||
*/
|
||||
|
||||
#[derive(Debug)]
|
||||
enum ShellClientKind {
|
||||
Xdg(xdg_wm_base::XdgWmBase),
|
||||
ZxdgV6(zxdg_shell_v6::ZxdgShellV6),
|
||||
|
@ -377,6 +383,7 @@ fn make_shell_client_data() -> ShellClientData {
|
|||
///
|
||||
/// You can use this handle to access a storage for any
|
||||
/// client-specific data you wish to associate with it.
|
||||
#[derive(Debug)]
|
||||
pub struct ShellClient<R> {
|
||||
kind: ShellClientKind,
|
||||
_token: CompositorToken<R>,
|
||||
|
@ -481,13 +488,14 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) enum ToplevelKind {
|
||||
Xdg(xdg_toplevel::XdgToplevel),
|
||||
ZxdgV6(zxdg_toplevel_v6::ZxdgToplevelV6),
|
||||
}
|
||||
|
||||
/// A handle to a toplevel surface
|
||||
#[derive(Debug)]
|
||||
pub struct ToplevelSurface<R> {
|
||||
wl_surface: wl_surface::WlSurface,
|
||||
shell_surface: ToplevelKind,
|
||||
|
@ -650,6 +658,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum PopupKind {
|
||||
Xdg(xdg_popup::XdgPopup),
|
||||
ZxdgV6(zxdg_popup_v6::ZxdgPopupV6),
|
||||
|
@ -659,6 +668,7 @@ pub(crate) enum PopupKind {
|
|||
///
|
||||
/// This is an unified abstraction over the popup surfaces
|
||||
/// of both `wl_shell` and `xdg_shell`.
|
||||
#[derive(Debug)]
|
||||
pub struct PopupSurface<R> {
|
||||
wl_surface: wl_surface::WlSurface,
|
||||
shell_surface: PopupKind,
|
||||
|
@ -818,6 +828,7 @@ where
|
|||
}
|
||||
|
||||
/// A configure message for toplevel surfaces
|
||||
#[derive(Debug)]
|
||||
pub struct ToplevelConfigure {
|
||||
/// A suggestion for a new size for the surface
|
||||
pub size: Option<(i32, i32)>,
|
||||
|
@ -835,6 +846,7 @@ pub struct ToplevelConfigure {
|
|||
}
|
||||
|
||||
/// A configure message for popup surface
|
||||
#[derive(Debug)]
|
||||
pub struct PopupConfigure {
|
||||
/// The position chosen for this popup relative to
|
||||
/// its parent
|
||||
|
@ -855,6 +867,7 @@ pub struct PopupConfigure {
|
|||
/// for you directly.
|
||||
///
|
||||
/// Depending on what you want to do, you might ignore some of them
|
||||
#[derive(Debug)]
|
||||
pub enum XdgRequest<R> {
|
||||
/// A new shell client was instantiated
|
||||
NewClient {
|
||||
|
|
|
@ -82,7 +82,7 @@ use wayland_server::{
|
|||
|
||||
mod pool;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
/// Internal data storage of `ShmGlobal`
|
||||
///
|
||||
/// This type is only visible as type parameter of
|
||||
|
|
Loading…
Reference in New Issue