1
0
Fork 0
forked from wry/wry

autocommit 2022-04-07 17:31:31 CEST

This commit is contained in:
Julian Orth 2022-04-07 17:31:31 +02:00
parent 1d33088dba
commit be32036824
200 changed files with 3267 additions and 2479 deletions

View file

@ -13,10 +13,12 @@
extern crate core; extern crate core;
use std::fs::{File, OpenOptions}; use std::{
use std::io::BufWriter; env,
use std::path::PathBuf; fs::{File, OpenOptions},
use std::{env, io}; io::{self, BufWriter},
path::PathBuf,
};
mod egl; mod egl;
mod enums; mod enums;

View file

@ -1,6 +1,7 @@
use crate::open; use {
use std::fmt::Write as FmtWrite; crate::open,
use std::io::Write; std::{fmt::Write as FmtWrite, io::Write},
};
fn write_egl_procs<W: Write>(f: &mut W) -> anyhow::Result<()> { fn write_egl_procs<W: Write>(f: &mut W) -> anyhow::Result<()> {
let map = [ let map = [

View file

@ -1,7 +1,8 @@
use crate::open; use {
use repc::layout::{Type, TypeVariant}; crate::open,
use std::env; repc::layout::{Type, TypeVariant},
use std::io::Write; std::{env, io::Write},
};
#[allow(unused_macros)] #[allow(unused_macros)]
#[macro_use] #[macro_use]

View file

@ -1,5 +1,7 @@
use anyhow::{bail, Context, Result}; use {
use bstr::{BStr, BString, ByteSlice}; anyhow::{bail, Context, Result},
bstr::{BStr, BString, ByteSlice},
};
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum TreeDelim { pub enum TreeDelim {

View file

@ -1,9 +1,9 @@
use crate::open; use {
use anyhow::{bail, Context, Result}; crate::open,
use bstr::{BStr, BString, ByteSlice}; anyhow::{bail, Context, Result},
use std::fs::DirEntry; bstr::{BStr, BString, ByteSlice},
use std::io::Write; std::{fs::DirEntry, io::Write, os::unix::ffi::OsStrExt},
use std::os::unix::ffi::OsStrExt; };
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
enum TreeDelim { enum TreeDelim {

View file

@ -1,11 +1,16 @@
use crate::open; use {
use crate::tokens::{tokenize, Lined, Symbol, Token, TokenKind, TreeDelim}; crate::{
use anyhow::{bail, Context, Result}; open,
use bstr::{BStr, BString, ByteSlice}; tokens::{tokenize, Lined, Symbol, Token, TokenKind, TreeDelim},
use std::collections::hash_map::Entry; },
use std::collections::HashMap; anyhow::{bail, Context, Result},
use std::io::Write; bstr::{BStr, BString, ByteSlice},
use std::os::unix::ffi::OsStrExt; std::{
collections::{hash_map::Entry, HashMap},
io::Write,
os::unix::ffi::OsStrExt,
},
};
#[derive(Debug)] #[derive(Debug)]
enum Type { enum Type {

View file

@ -1,13 +1,12 @@
use crate::open; use {
use crate::tokens::{tokenize, Symbol, Token, TokenKind, TreeDelim}; crate::{
use anyhow::{bail, Context, Result}; open,
use bstr::{BStr, BString, ByteSlice}; tokens::{tokenize, Symbol, Token, TokenKind, TreeDelim},
use std::cell::Cell; },
use std::collections::HashMap; anyhow::{bail, Context, Result},
use std::io::Write; bstr::{BStr, BString, ByteSlice},
use std::mem; std::{cell::Cell, collections::HashMap, io::Write, mem, os::unix::ffi::OsStrExt, rc::Rc},
use std::os::unix::ffi::OsStrExt; };
use std::rc::Rc;
struct Parser<'a> { struct Parser<'a> {
pos: usize, pos: usize,

View file

@ -1,17 +1,26 @@
use jay_config::drm::{get_connector, on_connector_connected, on_new_connector}; use jay_config::{
use jay_config::embedded::grab_input_device; config,
use jay_config::input::capability::{CAP_KEYBOARD, CAP_POINTER}; drm::{get_connector, on_connector_connected, on_new_connector},
use jay_config::input::{create_seat, input_devices, on_new_input_device, InputDevice, Seat}; embedded::grab_input_device,
use jay_config::keyboard::mods::{Modifiers, ALT, CTRL, SHIFT}; get_workspace,
use jay_config::keyboard::syms::{ input::{
SYM_Super_L, SYM_b, SYM_d, SYM_f, SYM_h, SYM_j, SYM_k, SYM_l, SYM_m, SYM_p, SYM_q, SYM_t, capability::{CAP_KEYBOARD, CAP_POINTER},
SYM_v, SYM_y, SYM_F1, SYM_F10, SYM_F11, SYM_F12, SYM_F13, SYM_F14, SYM_F15, SYM_F16, SYM_F17, create_seat, input_devices, on_new_input_device, InputDevice, Seat,
SYM_F18, SYM_F19, SYM_F2, SYM_F20, SYM_F21, SYM_F22, SYM_F23, SYM_F24, SYM_F25, SYM_F3, SYM_F4, },
SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9, keyboard::{
mods::{Modifiers, ALT, CTRL, SHIFT},
syms::{
SYM_Super_L, SYM_b, SYM_d, SYM_f, SYM_h, SYM_j, SYM_k, SYM_l, SYM_m, SYM_p, SYM_q,
SYM_t, SYM_v, SYM_y, SYM_F1, SYM_F10, SYM_F11, SYM_F12, SYM_F13, SYM_F14, SYM_F15,
SYM_F16, SYM_F17, SYM_F18, SYM_F19, SYM_F2, SYM_F20, SYM_F21, SYM_F22, SYM_F23,
SYM_F24, SYM_F25, SYM_F3, SYM_F4, SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9,
},
},
quit, switch_to_vt,
Axis::{Horizontal, Vertical},
Command,
Direction::{Down, Left, Right, Up},
}; };
use jay_config::Axis::{Horizontal, Vertical};
use jay_config::Direction::{Down, Left, Right, Up};
use jay_config::{config, get_workspace, quit, switch_to_vt, Command};
const MOD: Modifiers = ALT; const MOD: Modifiers = ALT;
@ -95,7 +104,7 @@ pub fn configure() {
input_devices().into_iter().for_each(handle_input_device); input_devices().into_iter().for_each(handle_input_device);
on_new_input_device(handle_input_device); on_new_input_device(handle_input_device);
let connectors_changed = || { let handle_connectors_changed = || {
let left = get_connector("HDMI-A-1"); let left = get_connector("HDMI-A-1");
let right = get_connector("DP-1"); let right = get_connector("DP-1");
if left.connected() && right.connected() { if left.connected() && right.connected() {
@ -103,9 +112,9 @@ pub fn configure() {
right.set_position(left.width(), 0); right.set_position(left.width(), 0);
} }
}; };
on_new_connector(move |_| connectors_changed()); on_new_connector(move |_| handle_connectors_changed());
on_connector_connected(move |_| connectors_changed()); on_connector_connected(move |_| handle_connectors_changed());
connectors_changed(); handle_connectors_changed();
} }
config!(configure); config!(configure);

View file

@ -1,21 +1,30 @@
#![allow(clippy::declare_interior_mutable_const, clippy::type_complexity)] #![allow(clippy::declare_interior_mutable_const, clippy::type_complexity)]
use crate::_private::ipc::{ClientMessage, InitMessage, Response, ServerMessage}; use {
use crate::_private::{bincode_ops, logging, Config, ConfigEntry, ConfigEntryGen, VERSION}; crate::{
use crate::drm::connector_type::{ConnectorType, CON_UNKNOWN}; _private::{
use crate::drm::{Connector, Mode}; bincode_ops,
use crate::input::acceleration::AccelProfile; ipc::{ClientMessage, InitMessage, Response, ServerMessage},
use crate::input::capability::Capability; logging, Config, ConfigEntry, ConfigEntryGen, VERSION,
use crate::input::{InputDevice, Seat}; },
use crate::keyboard::keymap::Keymap; drm::{
use crate::theme::Color; connector_type::{ConnectorType, CON_UNKNOWN},
use crate::{Axis, Command, Direction, LogLevel, ModifiedKeySym, Workspace}; Connector, Mode,
use std::cell::{Cell, RefCell}; },
use std::collections::hash_map::Entry; input::{acceleration::AccelProfile, capability::Capability, InputDevice, Seat},
use std::collections::HashMap; keyboard::keymap::Keymap,
use std::ops::Deref; theme::Color,
use std::rc::Rc; Axis, Command, Direction, LogLevel, ModifiedKeySym, Workspace,
use std::{ptr, slice}; },
std::{
cell::{Cell, RefCell},
collections::{hash_map::Entry, HashMap},
ops::Deref,
ptr,
rc::Rc,
slice,
},
};
pub(crate) struct Client { pub(crate) struct Client {
configure: extern "C" fn(), configure: extern "C" fn(),

View file

@ -1,14 +1,13 @@
use crate::drm::connector_type::ConnectorType; use {
use crate::drm::Connector; crate::{
use crate::input::acceleration::AccelProfile; drm::{connector_type::ConnectorType, Connector},
use crate::input::capability::Capability; input::{acceleration::AccelProfile, capability::Capability, InputDevice, Seat},
use crate::input::{InputDevice, Seat}; keyboard::{keymap::Keymap, mods::Modifiers, syms::KeySym},
use crate::keyboard::keymap::Keymap; theme::Color,
use crate::keyboard::mods::Modifiers; Axis, Direction, LogLevel, Workspace,
use crate::keyboard::syms::KeySym; },
use crate::theme::Color; bincode::{BorrowDecode, Decode, Encode},
use crate::{Axis, Direction, LogLevel, Workspace}; };
use bincode::{BorrowDecode, Decode, Encode};
#[derive(Encode, BorrowDecode, Debug)] #[derive(Encode, BorrowDecode, Debug)]
pub enum ServerMessage { pub enum ServerMessage {

View file

@ -1,5 +1,7 @@
use crate::LogLevel; use {
use log::{Level, LevelFilter, Log, Metadata, Record}; crate::LogLevel,
log::{Level, LevelFilter, Log, Metadata, Record},
};
pub fn init() { pub fn init() {
log::set_logger(&Logger).unwrap(); log::set_logger(&Logger).unwrap();

View file

@ -1,10 +1,13 @@
use crate::drm::connector_type::{ use {
ConnectorType, CON_9PIN_DIN, CON_COMPONENT, CON_COMPOSITE, CON_DISPLAY_PORT, CON_DPI, CON_DSI, crate::drm::connector_type::{
CON_DVIA, CON_DVID, CON_DVII, CON_EDP, CON_EMBEDDED_WINDOW, CON_HDMIA, CON_HDMIB, CON_LVDS, ConnectorType, CON_9PIN_DIN, CON_COMPONENT, CON_COMPOSITE, CON_DISPLAY_PORT, CON_DPI,
CON_SPI, CON_SVIDEO, CON_TV, CON_UNKNOWN, CON_USB, CON_VGA, CON_VIRTUAL, CON_WRITEBACK, CON_DSI, CON_DVIA, CON_DVID, CON_DVII, CON_EDP, CON_EMBEDDED_WINDOW, CON_HDMIA, CON_HDMIB,
CON_LVDS, CON_SPI, CON_SVIDEO, CON_TV, CON_UNKNOWN, CON_USB, CON_VGA, CON_VIRTUAL,
CON_WRITEBACK,
},
bincode::{Decode, Encode},
std::str::FromStr,
}; };
use bincode::{Decode, Encode};
use std::str::FromStr;
#[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)] #[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)]
pub struct Mode { pub struct Mode {

View file

@ -1,10 +1,13 @@
pub mod acceleration; pub mod acceleration;
pub mod capability; pub mod capability;
use crate::input::acceleration::AccelProfile; use {
use crate::input::capability::Capability; crate::{
use crate::{Axis, Direction, Keymap, ModifiedKeySym, Workspace}; input::{acceleration::AccelProfile, capability::Capability},
use bincode::{Decode, Encode}; Axis, Direction, Keymap, ModifiedKeySym, Workspace,
},
bincode::{Decode, Encode},
};
#[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)] #[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)]
pub struct InputDevice(pub u64); pub struct InputDevice(pub u64);

View file

@ -1,7 +1,8 @@
use crate::keyboard::mods::Modifiers; use {
use crate::keyboard::syms::KeySym; crate::keyboard::{mods::Modifiers, syms::KeySym},
use bincode::{Decode, Encode}; bincode::{Decode, Encode},
use std::ops::{BitOr, BitOrAssign}; std::ops::{BitOr, BitOrAssign},
};
pub mod keymap; pub mod keymap;
pub mod mods; pub mod mods;

View file

@ -1,7 +1,8 @@
use crate::keyboard::syms::KeySym; use {
use crate::ModifiedKeySym; crate::{keyboard::syms::KeySym, ModifiedKeySym},
use bincode::{Decode, Encode}; bincode::{Decode, Encode},
use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign}; std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign},
};
#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Default, Hash, Debug)] #[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Default, Hash, Debug)]
pub struct Modifiers(pub u32); pub struct Modifiers(pub u32);

View file

@ -1,7 +1,8 @@
use crate::keyboard::keymap::Keymap; use {
use crate::keyboard::ModifiedKeySym; crate::keyboard::{keymap::Keymap, ModifiedKeySym},
use bincode::{Decode, Encode}; bincode::{Decode, Encode},
use std::collections::HashMap; std::collections::HashMap,
};
#[macro_use] #[macro_use]
mod macros; mod macros;

1
rustfmt.toml Normal file
View file

@ -0,0 +1 @@
imports_granularity = "One"

View file

@ -1,10 +1,14 @@
use crate::client::ClientError; use {
use crate::event_loop::{EventLoopDispatcher, EventLoopError, EventLoopId}; crate::{
use crate::state::State; client::ClientError,
use crate::utils::errorfmt::ErrorFmt; event_loop::{EventLoopDispatcher, EventLoopError, EventLoopId},
use std::rc::Rc; state::State,
use thiserror::Error; utils::errorfmt::ErrorFmt,
use uapi::{c, format_ustr, Errno, OwnedFd, Ustring}; },
std::rc::Rc,
thiserror::Error,
uapi::{c, format_ustr, Errno, OwnedFd, Ustring},
};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum AcceptorError { pub enum AcceptorError {

View file

@ -1,19 +1,26 @@
pub use crate::async_engine::yield_::Yield; pub use {
use crate::event_loop::{EventLoop, EventLoopError}; crate::async_engine::yield_::Yield,
use crate::utils::copyhashmap::CopyHashMap; fd::{AsyncFd, FdStatus},
use crate::utils::numcell::NumCell; task::SpawnedFuture,
use crate::wheel::{Wheel, WheelError}; timeout::Timeout,
use fd::AsyncFdData; };
pub use fd::{AsyncFd, FdStatus}; use {
use queue::{DispatchQueue, Dispatcher}; crate::{
use std::cell::{Cell, RefCell}; event_loop::{EventLoop, EventLoopError},
use std::future::Future; utils::{copyhashmap::CopyHashMap, numcell::NumCell},
use std::rc::Rc; wheel::{Wheel, WheelError},
pub use task::SpawnedFuture; },
use thiserror::Error; fd::AsyncFdData,
pub use timeout::Timeout; queue::{DispatchQueue, Dispatcher},
use timeout::TimeoutData; std::{
use uapi::OwnedFd; cell::{Cell, RefCell},
future::Future,
rc::Rc,
},
thiserror::Error,
timeout::TimeoutData,
uapi::OwnedFd,
};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum AsyncError { pub enum AsyncError {
@ -110,11 +117,15 @@ impl AsyncEngine {
} }
mod yield_ { mod yield_ {
use crate::async_engine::queue::DispatchQueue; use {
use std::future::Future; crate::async_engine::queue::DispatchQueue,
use std::pin::Pin; std::{
use std::rc::Rc; future::Future,
use std::task::{Context, Poll}; pin::Pin,
rc::Rc,
task::{Context, Poll},
},
};
pub struct Yield { pub struct Yield {
pub(super) iteration: u64, pub(super) iteration: u64,
@ -136,13 +147,17 @@ mod yield_ {
} }
mod timeout { mod timeout {
use crate::wheel::{Wheel, WheelDispatcher, WheelId}; use {
use std::cell::{Cell, RefCell}; crate::wheel::{Wheel, WheelDispatcher, WheelId},
use std::error::Error; std::{
use std::future::Future; cell::{Cell, RefCell},
use std::pin::Pin; error::Error,
use std::rc::Rc; future::Future,
use std::task::{Context, Poll, Waker}; pin::Pin,
rc::Rc,
task::{Context, Poll, Waker},
},
};
pub(super) struct TimeoutData { pub(super) struct TimeoutData {
pub expired: Cell<bool>, pub expired: Cell<bool>,
@ -186,17 +201,24 @@ mod timeout {
} }
mod task { mod task {
use crate::async_engine::queue::DispatchQueue; use {
use crate::async_engine::Phase; crate::{
use crate::utils::numcell::NumCell; async_engine::{queue::DispatchQueue, Phase},
use crate::utils::ptr_ext::{MutPtrExt, PtrExt}; utils::{
use std::cell::{Cell, UnsafeCell}; numcell::NumCell,
use std::future::Future; ptr_ext::{MutPtrExt, PtrExt},
use std::mem::ManuallyDrop; },
use std::pin::Pin; },
use std::ptr; std::{
use std::rc::Rc; cell::{Cell, UnsafeCell},
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; future::Future,
mem::ManuallyDrop,
pin::Pin,
ptr,
rc::Rc,
task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
},
};
#[must_use] #[must_use]
pub struct SpawnedFuture<T: 'static> { pub struct SpawnedFuture<T: 'static> {
@ -430,17 +452,20 @@ mod task {
} }
mod queue { mod queue {
use crate::async_engine::task::Runnable; use {
use crate::async_engine::{AsyncError, Phase, NUM_PHASES}; crate::{
use crate::event_loop::{EventLoop, EventLoopDispatcher, EventLoopId}; async_engine::{task::Runnable, AsyncError, Phase, NUM_PHASES},
use crate::utils::array; event_loop::{EventLoop, EventLoopDispatcher, EventLoopId},
use crate::utils::numcell::NumCell; utils::{array, numcell::NumCell, syncqueue::SyncQueue},
use crate::utils::syncqueue::SyncQueue; },
use std::cell::{Cell, RefCell}; std::{
use std::collections::VecDeque; cell::{Cell, RefCell},
use std::error::Error; collections::VecDeque,
use std::rc::Rc; error::Error,
use std::task::Waker; rc::Rc,
task::Waker,
},
};
pub(super) struct Dispatcher { pub(super) struct Dispatcher {
queue: Rc<DispatchQueue>, queue: Rc<DispatchQueue>,
@ -538,17 +563,23 @@ mod queue {
} }
mod fd { mod fd {
use crate::async_engine::{AsyncEngine, AsyncError}; use {
use crate::event_loop::{EventLoop, EventLoopDispatcher, EventLoopError, EventLoopId}; crate::{
use crate::utils::numcell::NumCell; async_engine::{AsyncEngine, AsyncError},
use std::cell::{Cell, RefCell}; event_loop::{EventLoop, EventLoopDispatcher, EventLoopError, EventLoopId},
use std::error::Error; utils::numcell::NumCell,
use std::fmt::{Debug, Formatter}; },
use std::future::Future; std::{
use std::pin::Pin; cell::{Cell, RefCell},
use std::rc::Rc; error::Error,
use std::task::{Context, Poll, Waker}; fmt::{Debug, Formatter},
use uapi::{c, OwnedFd}; future::Future,
pin::Pin,
rc::Rc,
task::{Context, Poll, Waker},
},
uapi::{c, OwnedFd},
};
type Queue = RefCell<Vec<(Waker, Rc<Cell<Option<FdStatus>>>)>>; type Queue = RefCell<Vec<(Waker, Rc<Cell<Option<FdStatus>>>)>>;

View file

@ -1,7 +1,10 @@
use crate::drm::drm::ConnectorType; use {
use crate::fixed::Fixed; crate::{video::drm::ConnectorType, fixed::Fixed},
use std::fmt::{Debug, Display, Formatter}; std::{
use std::rc::Rc; fmt::{Debug, Display, Formatter},
rc::Rc,
},
};
linear_ids!(ConnectorIds, ConnectorId); linear_ids!(ConnectorIds, ConnectorId);
linear_ids!(InputDeviceIds, InputDeviceId); linear_ids!(InputDeviceIds, InputDeviceId);

View file

@ -1,6 +1,10 @@
use crate::backend::{Backend, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId}; use {
use crate::drm::drm::ConnectorType; crate::{
use std::rc::Rc; backend::{Backend, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId},
video::drm::ConnectorType,
},
std::rc::Rc,
};
pub struct DummyBackend {} pub struct DummyBackend {}

View file

@ -2,40 +2,50 @@ mod input;
mod monitor; mod monitor;
mod video; mod video;
use crate::async_engine::{AsyncError, AsyncFd}; use {
use crate::backend::{ crate::{
async_engine::{AsyncError, AsyncFd},
backend::{
Backend, InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, Backend, InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId,
InputEvent, KeyState, InputEvent, KeyState,
},
backends::metal::video::{MetalDrmDevice, PendingDrmDevice},
dbus::DbusError,
video::{drm::DrmError, gbm::GbmError},
libinput::{
consts::{
AccelProfile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE,
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT, LIBINPUT_DEVICE_CAP_GESTURE,
LIBINPUT_DEVICE_CAP_KEYBOARD, LIBINPUT_DEVICE_CAP_POINTER,
LIBINPUT_DEVICE_CAP_SWITCH, LIBINPUT_DEVICE_CAP_TABLET_PAD,
LIBINPUT_DEVICE_CAP_TABLET_TOOL, LIBINPUT_DEVICE_CAP_TOUCH,
},
device::RegisteredDevice,
LibInput, LibInputAdapter, LibInputError,
},
logind::{LogindError, Session},
render::RenderError,
state::State,
udev::{Udev, UdevError, UdevMonitor},
utils::{
clonecell::{CloneCell, UnsafeCellCloneSafe},
copyhashmap::CopyHashMap,
errorfmt::ErrorFmt,
oserror::OsError,
smallmap::SmallMap,
syncqueue::SyncQueue,
},
},
std::{
cell::{Cell, RefCell},
ffi::{CStr, CString},
future::pending,
mem,
rc::Rc,
},
thiserror::Error,
uapi::{c, OwnedFd},
}; };
use crate::backends::metal::video::{MetalDrmDevice, PendingDrmDevice};
use crate::dbus::DbusError;
use crate::drm::drm::DrmError;
use crate::drm::gbm::GbmError;
use crate::libinput::consts::{
AccelProfile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT,
LIBINPUT_DEVICE_CAP_GESTURE, LIBINPUT_DEVICE_CAP_KEYBOARD, LIBINPUT_DEVICE_CAP_POINTER,
LIBINPUT_DEVICE_CAP_SWITCH, LIBINPUT_DEVICE_CAP_TABLET_PAD, LIBINPUT_DEVICE_CAP_TABLET_TOOL,
LIBINPUT_DEVICE_CAP_TOUCH,
};
use crate::libinput::device::RegisteredDevice;
use crate::libinput::{LibInput, LibInputAdapter, LibInputError};
use crate::logind::{LogindError, Session};
use crate::render::RenderError;
use crate::state::State;
use crate::udev::{Udev, UdevError, UdevMonitor};
use crate::utils::clonecell::{CloneCell, UnsafeCellCloneSafe};
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::oserror::OsError;
use crate::utils::smallmap::SmallMap;
use crate::utils::syncqueue::SyncQueue;
use std::cell::{Cell, RefCell};
use std::ffi::{CStr, CString};
use std::future::pending;
use std::mem;
use std::rc::Rc;
use thiserror::Error;
use uapi::{c, OwnedFd};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum MetalError { pub enum MetalError {

View file

@ -1,13 +1,19 @@
use crate::async_engine::FdStatus; use {
use crate::backend::{InputEvent, KeyState, ScrollAxis}; crate::{
use crate::backends::metal::MetalBackend; async_engine::FdStatus,
use crate::libinput::consts::{ backend::{InputEvent, KeyState, ScrollAxis},
backends::metal::MetalBackend,
libinput::{
consts::{
LIBINPUT_BUTTON_STATE_PRESSED, LIBINPUT_KEY_STATE_PRESSED, LIBINPUT_BUTTON_STATE_PRESSED, LIBINPUT_KEY_STATE_PRESSED,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
},
event::LibInputEvent,
},
utils::errorfmt::ErrorFmt,
},
std::rc::Rc,
}; };
use crate::libinput::event::LibInputEvent;
use crate::utils::errorfmt::ErrorFmt;
use std::rc::Rc;
macro_rules! unpack { macro_rules! unpack {
($slf:expr, $ev:expr) => {{ ($slf:expr, $ev:expr) => {{

View file

@ -1,17 +1,21 @@
use crate::async_engine::FdStatus; use {
use crate::backend::BackendEvent; crate::{
use crate::backends::metal::video::{MetalDrmDevice, PendingDrmDevice}; async_engine::FdStatus,
use crate::backends::metal::{MetalBackend, MetalDevice, MetalError, MetalInputDevice}; backend::BackendEvent,
use crate::dbus::TRUE; backends::metal::{
use crate::drm::drm::DrmMaster; video::{MetalDrmDevice, PendingDrmDevice},
use crate::udev::UdevDevice; MetalBackend, MetalDevice, MetalError, MetalInputDevice,
use crate::utils::errorfmt::ErrorFmt; },
use crate::utils::nonblock::set_nonblock; dbus::TRUE,
use crate::wire_dbus::org::freedesktop::login1::session::{PauseDevice, ResumeDevice}; video::drm::DrmMaster,
use bstr::ByteSlice; udev::UdevDevice,
use std::cell::Cell; utils::{errorfmt::ErrorFmt, nonblock::set_nonblock},
use std::rc::Rc; wire_dbus::org::freedesktop::login1::session::{PauseDevice, ResumeDevice},
use uapi::{c, OwnedFd}; },
bstr::ByteSlice,
std::{cell::Cell, rc::Rc},
uapi::{c, OwnedFd},
};
const DRM: &[u8] = b"drm"; const DRM: &[u8] = b"drm";
const INPUT: &[u8] = b"input"; const INPUT: &[u8] = b"input";

View file

@ -1,34 +1,40 @@
use crate::async_engine::{AsyncFd, SpawnedFuture}; use {
use crate::backend::{ crate::{
async_engine::{AsyncFd, SpawnedFuture},
backend::{
BackendEvent, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId, MonitorInfo, BackendEvent, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId, MonitorInfo,
},
backends::metal::{DrmId, MetalBackend, MetalError},
video::{
drm::{
drm_mode_modeinfo, Change, ConnectorStatus, ConnectorType, DrmBlob, DrmConnector,
DrmCrtc, DrmEncoder, DrmError, DrmEvent, DrmFramebuffer, DrmMaster, DrmModeInfo,
DrmObject, DrmPlane, DrmProperty, DrmPropertyDefinition, DrmPropertyType, PropBlob,
DRM_CLIENT_CAP_ATOMIC, DRM_MODE_ATOMIC_ALLOW_MODESET, DRM_MODE_ATOMIC_NONBLOCK,
DRM_MODE_PAGE_FLIP_EVENT,
},
gbm::{GbmDevice, GBM_BO_USE_RENDERING, GBM_BO_USE_SCANOUT},
ModifiedFormat, INVALID_MODIFIER,
},
edid::Descriptor,
format::{Format, XRGB8888},
render::{Framebuffer, RenderContext},
state::State,
utils::{
bitflags::BitflagsExt, clonecell::CloneCell, debug_fn::debug_fn, errorfmt::ErrorFmt,
numcell::NumCell, oserror::OsError, syncqueue::SyncQueue,
},
},
ahash::{AHashMap, AHashSet},
bstr::{BString, ByteSlice},
std::{
cell::Cell,
ffi::CString,
fmt::{Debug, Formatter},
rc::Rc,
},
uapi::c,
}; };
use crate::backends::metal::{DrmId, MetalBackend, MetalError};
use crate::drm::drm::{
drm_mode_modeinfo, Change, ConnectorStatus, ConnectorType, DrmBlob, DrmConnector, DrmCrtc,
DrmEncoder, DrmError, DrmEvent, DrmFramebuffer, DrmMaster, DrmModeInfo, DrmObject, DrmPlane,
DrmProperty, DrmPropertyDefinition, DrmPropertyType, PropBlob, DRM_CLIENT_CAP_ATOMIC,
DRM_MODE_ATOMIC_ALLOW_MODESET, DRM_MODE_ATOMIC_NONBLOCK, DRM_MODE_PAGE_FLIP_EVENT,
};
use crate::drm::gbm::{GbmDevice, GBM_BO_USE_RENDERING, GBM_BO_USE_SCANOUT};
use crate::drm::{ModifiedFormat, INVALID_MODIFIER};
use crate::edid::Descriptor;
use crate::format::{Format, XRGB8888};
use crate::render::{Framebuffer, RenderContext};
use crate::state::State;
use crate::utils::bitflags::BitflagsExt;
use crate::utils::clonecell::CloneCell;
use crate::utils::debug_fn::debug_fn;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::numcell::NumCell;
use crate::utils::oserror::OsError;
use crate::utils::syncqueue::SyncQueue;
use ahash::{AHashMap, AHashSet};
use bstr::{BString, ByteSlice};
use std::cell::Cell;
use std::ffi::CString;
use std::fmt::{Debug, Formatter};
use std::rc::Rc;
use uapi::c;
pub struct PendingDrmDevice { pub struct PendingDrmDevice {
pub id: DrmId, pub id: DrmId,

View file

@ -1,49 +1,59 @@
use crate::async_engine::{Phase, SpawnedFuture}; use {
use crate::backend::{ crate::{
Backend, BackendEvent, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId, InputDevice, async_engine::{Phase, SpawnedFuture},
InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, InputEvent, KeyState, Mode, backend::{
MonitorInfo, ScrollAxis, Backend, BackendEvent, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId,
}; InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, InputEvent,
use crate::drm::drm::{ConnectorType, Drm, DrmError}; KeyState, Mode, MonitorInfo, ScrollAxis,
use crate::drm::gbm::{GbmDevice, GbmError, GBM_BO_USE_RENDERING}; },
use crate::drm::{ModifiedFormat, INVALID_MODIFIER}; video::{
use crate::fixed::Fixed; drm::{ConnectorType, Drm, DrmError},
use crate::format::XRGB8888; gbm::{GbmDevice, GbmError, GBM_BO_USE_RENDERING},
use crate::render::{Framebuffer, RenderContext, RenderError}; ModifiedFormat, INVALID_MODIFIER,
use crate::state::State; },
use crate::utils::clonecell::CloneCell; fixed::Fixed,
use crate::utils::copyhashmap::CopyHashMap; format::XRGB8888,
use crate::utils::errorfmt::ErrorFmt; render::{Framebuffer, RenderContext, RenderError},
use crate::utils::numcell::NumCell; state::State,
use crate::utils::queue::AsyncQueue; utils::{
use crate::utils::syncqueue::SyncQueue; clonecell::CloneCell, copyhashmap::CopyHashMap, errorfmt::ErrorFmt, numcell::NumCell,
use crate::wire_xcon::{ queue::AsyncQueue, syncqueue::SyncQueue,
},
wire_xcon::{
ChangeProperty, ChangeWindowAttributes, ConfigureNotify, CreateCursor, CreatePixmap, ChangeProperty, ChangeWindowAttributes, ConfigureNotify, CreateCursor, CreatePixmap,
CreateWindow, CreateWindowValues, DestroyNotify, Dri3Open, Dri3PixmapFromBuffer, CreateWindow, CreateWindowValues, DestroyNotify, Dri3Open, Dri3PixmapFromBuffer,
Dri3QueryVersion, Extension, FreePixmap, MapWindow, PresentCompleteNotify, PresentIdleNotify, Dri3QueryVersion, Extension, FreePixmap, MapWindow, PresentCompleteNotify,
PresentPixmap, PresentQueryVersion, PresentSelectInput, XiButtonPress, XiButtonRelease, PresentIdleNotify, PresentPixmap, PresentQueryVersion, PresentSelectInput,
XiDeviceInfo, XiEnter, XiEventMask, XiGetDeviceButtonMapping, XiGrabDevice, XiHierarchy, XiButtonPress, XiButtonRelease, XiDeviceInfo, XiEnter, XiEventMask,
XiKeyPress, XiKeyRelease, XiMotion, XiQueryDevice, XiQueryVersion, XiSelectEvents, XiGetDeviceButtonMapping, XiGrabDevice, XiHierarchy, XiKeyPress, XiKeyRelease,
XiUngrabDevice, XkbPerClientFlags, XkbUseExtension, XiMotion, XiQueryDevice, XiQueryVersion, XiSelectEvents, XiUngrabDevice,
}; XkbPerClientFlags, XkbUseExtension,
use crate::xcon::consts::{ },
xcon::{
consts::{
ATOM_STRING, ATOM_WM_CLASS, EVENT_MASK_EXPOSURE, EVENT_MASK_STRUCTURE_NOTIFY, ATOM_STRING, ATOM_WM_CLASS, EVENT_MASK_EXPOSURE, EVENT_MASK_STRUCTURE_NOTIFY,
EVENT_MASK_VISIBILITY_CHANGE, GRAB_MODE_ASYNC, GRAB_STATUS_SUCCESS, INPUT_DEVICE_ALL, EVENT_MASK_VISIBILITY_CHANGE, GRAB_MODE_ASYNC, GRAB_STATUS_SUCCESS,
INPUT_DEVICE_ALL_MASTER, INPUT_DEVICE_TYPE_MASTER_KEYBOARD, INPUT_HIERARCHY_MASK_MASTER_ADDED, INPUT_DEVICE_ALL, INPUT_DEVICE_ALL_MASTER, INPUT_DEVICE_TYPE_MASTER_KEYBOARD,
INPUT_HIERARCHY_MASK_MASTER_REMOVED, PRESENT_EVENT_MASK_COMPLETE_NOTIFY, INPUT_HIERARCHY_MASK_MASTER_ADDED, INPUT_HIERARCHY_MASK_MASTER_REMOVED,
PRESENT_EVENT_MASK_IDLE_NOTIFY, PROP_MODE_REPLACE, WINDOW_CLASS_INPUT_OUTPUT, PRESENT_EVENT_MASK_COMPLETE_NOTIFY, PRESENT_EVENT_MASK_IDLE_NOTIFY,
XI_EVENT_MASK_BUTTON_PRESS, XI_EVENT_MASK_BUTTON_RELEASE, XI_EVENT_MASK_ENTER, PROP_MODE_REPLACE, WINDOW_CLASS_INPUT_OUTPUT, XI_EVENT_MASK_BUTTON_PRESS,
XI_EVENT_MASK_FOCUS_IN, XI_EVENT_MASK_FOCUS_OUT, XI_EVENT_MASK_HIERARCHY, XI_EVENT_MASK_BUTTON_RELEASE, XI_EVENT_MASK_ENTER, XI_EVENT_MASK_FOCUS_IN,
XI_EVENT_MASK_KEY_PRESS, XI_EVENT_MASK_KEY_RELEASE, XI_EVENT_MASK_LEAVE, XI_EVENT_MASK_MOTION, XI_EVENT_MASK_FOCUS_OUT, XI_EVENT_MASK_HIERARCHY, XI_EVENT_MASK_KEY_PRESS,
XI_EVENT_MASK_KEY_RELEASE, XI_EVENT_MASK_LEAVE, XI_EVENT_MASK_MOTION,
XI_EVENT_MASK_TOUCH_BEGIN, XI_EVENT_MASK_TOUCH_END, XI_EVENT_MASK_TOUCH_UPDATE, XI_EVENT_MASK_TOUCH_BEGIN, XI_EVENT_MASK_TOUCH_END, XI_EVENT_MASK_TOUCH_UPDATE,
XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT, XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT,
},
Event, XEvent, Xcon, XconError,
},
},
std::{
borrow::Cow,
cell::{Cell, RefCell},
collections::VecDeque,
rc::Rc,
},
thiserror::Error,
}; };
use crate::xcon::{Event, XEvent, Xcon, XconError};
use std::borrow::Cow;
use std::cell::{Cell, RefCell};
use std::collections::VecDeque;
use std::rc::Rc;
use thiserror::Error;
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum XBackendError { pub enum XBackendError {

View file

@ -1,5 +1,4 @@
use ahash::AHashMap; use {ahash::AHashMap, once_cell::sync::Lazy};
use once_cell::sync::Lazy;
static BUGS: Lazy<AHashMap<&'static str, Bugs>> = Lazy::new(|| { static BUGS: Lazy<AHashMap<&'static str, Bugs>> = Lazy::new(|| {
let mut map = AHashMap::new(); let mut map = AHashMap::new();

View file

@ -3,10 +3,12 @@ mod log;
mod quit; mod quit;
mod set_log_level; mod set_log_level;
use crate::compositor::start_compositor; use {
use ::log::Level; crate::compositor::start_compositor,
use clap::{ArgEnum, Args, Parser, Subcommand}; ::log::Level,
use clap_complete::Shell; clap::{ArgEnum, Args, Parser, Subcommand},
clap_complete::Shell,
};
/// A wayland compositor. /// A wayland compositor.
#[derive(Parser, Debug)] #[derive(Parser, Debug)]

View file

@ -1,6 +1,8 @@
use crate::cli::{GenerateArgs, Jay}; use {
use clap::CommandFactory; crate::cli::{GenerateArgs, Jay},
use std::io::stdout; clap::CommandFactory,
std::io::stdout,
};
pub fn main(args: GenerateArgs) { pub fn main(args: GenerateArgs) {
let stdout = stdout(); let stdout = stdout();

View file

@ -1,16 +1,21 @@
use crate::cli::{GlobalArgs, LogArgs}; use {
use crate::tools::tool_client::{Handle, ToolClient}; crate::{
use crate::utils::errorfmt::ErrorFmt; cli::{GlobalArgs, LogArgs},
use crate::wire::{jay_compositor, jay_log_file}; tools::tool_client::{Handle, ToolClient},
use bstr::{BString, ByteSlice}; utils::errorfmt::ErrorFmt,
use jay_compositor::GetLogFile; wire::{jay_compositor, jay_log_file},
use jay_log_file::Path; },
use std::cell::RefCell; bstr::{BString, ByteSlice},
use std::ops::Deref; jay_compositor::GetLogFile,
use std::os::unix::process::CommandExt; jay_log_file::Path,
use std::process; std::{
use std::process::Command; cell::RefCell,
use std::rc::Rc; ops::Deref,
os::unix::process::CommandExt,
process::{self, Command},
rc::Rc,
},
};
pub fn main(global: GlobalArgs, args: LogArgs) { pub fn main(global: GlobalArgs, args: LogArgs) {
let tc = ToolClient::new(global.log_level.into()); let tc = ToolClient::new(global.log_level.into());

View file

@ -1,7 +1,7 @@
use crate::cli::GlobalArgs; use {
use crate::tools::tool_client::ToolClient; crate::{cli::GlobalArgs, tools::tool_client::ToolClient, wire::jay_compositor::Quit},
use crate::wire::jay_compositor::Quit; std::rc::Rc,
use std::rc::Rc; };
pub fn main(global: GlobalArgs) { pub fn main(global: GlobalArgs) {
let tc = ToolClient::new(global.log_level.into()); let tc = ToolClient::new(global.log_level.into());

View file

@ -1,7 +1,11 @@
use crate::cli::{GlobalArgs, SetLogArgs}; use {
use crate::tools::tool_client::ToolClient; crate::{
use crate::wire::jay_compositor::SetLogLevel; cli::{GlobalArgs, SetLogArgs},
use std::rc::Rc; tools::tool_client::ToolClient,
wire::jay_compositor::SetLogLevel,
},
std::rc::Rc,
};
pub fn main(global: GlobalArgs, args: SetLogArgs) { pub fn main(global: GlobalArgs, args: SetLogArgs) {
let tc = ToolClient::new(global.log_level.into()); let tc = ToolClient::new(global.log_level.into());

View file

@ -1,29 +1,34 @@
use crate::async_engine::{AsyncFd, SpawnedFuture};
use crate::client::error::LookupError;
use crate::client::objects::Objects;
use crate::ifs::wl_callback::WlCallback;
use crate::ifs::wl_display::WlDisplay;
use crate::ifs::wl_registry::WlRegistry;
use crate::leaks::Tracker;
use crate::object::{Interface, Object, ObjectId, WL_DISPLAY_ID};
use crate::state::State;
use crate::utils::asyncevent::AsyncEvent;
use crate::utils::buffd::{MsgFormatter, MsgParser, MsgParserError, OutBufferSwapchain};
use crate::utils::copyhashmap::Locked;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::numcell::NumCell;
use crate::utils::queue::AsyncQueue;
use crate::wire::WlRegistryId;
use crate::xwayland::XWaylandEvent;
use ahash::AHashMap;
pub use error::{ClientError, ObjectError}; pub use error::{ClientError, ObjectError};
use std::cell::{Cell, RefCell}; use {
use std::error::Error; crate::{
use std::fmt::{Debug, Display, Formatter}; async_engine::{AsyncFd, SpawnedFuture},
use std::mem; client::{error::LookupError, objects::Objects},
use std::ops::DerefMut; ifs::{wl_callback::WlCallback, wl_display::WlDisplay, wl_registry::WlRegistry},
use std::rc::Rc; leaks::Tracker,
use uapi::{c, OwnedFd}; object::{Interface, Object, ObjectId, WL_DISPLAY_ID},
state::State,
utils::{
asyncevent::AsyncEvent,
buffd::{MsgFormatter, MsgParser, MsgParserError, OutBufferSwapchain},
copyhashmap::Locked,
errorfmt::ErrorFmt,
numcell::NumCell,
queue::AsyncQueue,
},
wire::WlRegistryId,
xwayland::XWaylandEvent,
},
ahash::AHashMap,
std::{
cell::{Cell, RefCell},
error::Error,
fmt::{Debug, Display, Formatter},
mem,
ops::DerefMut,
rc::Rc,
},
uapi::{c, OwnedFd},
};
mod error; mod error;
mod objects; mod objects;

View file

@ -1,10 +1,14 @@
use crate::async_engine::AsyncError; use {
use crate::client::ClientId; crate::{
use crate::object::{Interface, ObjectId}; async_engine::AsyncError,
use crate::utils::buffd::{BufFdError, MsgParserError}; client::ClientId,
use crate::wire::WlDisplayId; object::{Interface, ObjectId},
use std::error::Error; utils::buffd::{BufFdError, MsgParserError},
use thiserror::Error; wire::WlDisplayId,
},
std::error::Error,
thiserror::Error,
};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum ClientError { pub enum ClientError {

View file

@ -1,29 +1,38 @@
use crate::client::{Client, ClientError}; use {
use crate::ifs::ipc::wl_data_source::WlDataSource; crate::{
use crate::ifs::ipc::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1; client::{Client, ClientError},
use crate::ifs::wl_buffer::WlBuffer; ifs::{
use crate::ifs::wl_display::WlDisplay; ipc::{
use crate::ifs::wl_output::WlOutput; wl_data_source::WlDataSource,
use crate::ifs::wl_region::WlRegion; zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1,
use crate::ifs::wl_registry::WlRegistry; },
use crate::ifs::wl_seat::WlSeat; wl_buffer::WlBuffer,
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel; wl_display::WlDisplay,
use crate::ifs::wl_surface::xdg_surface::XdgSurface; wl_output::WlOutput,
use crate::ifs::wl_surface::WlSurface; wl_region::WlRegion,
use crate::ifs::xdg_positioner::XdgPositioner; wl_registry::WlRegistry,
use crate::ifs::xdg_wm_base::XdgWmBase; wl_seat::WlSeat,
use crate::object::{Object, ObjectId}; wl_surface::{
use crate::tree::Node; xdg_surface::{xdg_toplevel::XdgToplevel, XdgSurface},
use crate::utils::clonecell::CloneCell; WlSurface,
use crate::utils::copyhashmap::{CopyHashMap, Locked}; },
use crate::wire::{ xdg_positioner::XdgPositioner,
WlBufferId, WlDataSourceId, WlOutputId, WlRegionId, WlRegistryId, WlSeatId, WlSurfaceId, xdg_wm_base::XdgWmBase,
XdgPositionerId, XdgSurfaceId, XdgToplevelId, XdgWmBaseId, ZwpPrimarySelectionSourceV1Id, },
object::{Object, ObjectId},
tree::Node,
utils::{
clonecell::CloneCell,
copyhashmap::{CopyHashMap, Locked},
},
wire::{
WlBufferId, WlDataSourceId, WlOutputId, WlRegionId, WlRegistryId, WlSeatId,
WlSurfaceId, XdgPositionerId, XdgSurfaceId, XdgToplevelId, XdgWmBaseId,
ZwpPrimarySelectionSourceV1Id,
},
},
std::{cell::RefCell, mem, ops::DerefMut, rc::Rc},
}; };
use std::cell::RefCell;
use std::mem;
use std::ops::DerefMut;
use std::rc::Rc;
pub struct Objects { pub struct Objects {
pub display: CloneCell<Option<Rc<WlDisplay>>>, pub display: CloneCell<Option<Rc<WlDisplay>>>,

View file

@ -1,13 +1,17 @@
use crate::async_engine::Phase; use {
use crate::client::{Client, ClientError}; crate::{
use crate::object::ObjectId; async_engine::Phase,
use crate::utils::buffd::{BufFdIn, BufFdOut, MsgParser}; client::{Client, ClientError},
use crate::utils::errorfmt::ErrorFmt; object::ObjectId,
use crate::utils::vec_ext::VecExt; utils::{
use futures_util::{select, FutureExt}; buffd::{BufFdIn, BufFdOut, MsgParser},
use std::collections::VecDeque; errorfmt::ErrorFmt,
use std::mem; vec_ext::VecExt,
use std::rc::Rc; },
},
futures_util::{select, FutureExt},
std::{collections::VecDeque, mem, rc::Rc},
};
pub async fn client(data: Rc<Client>) { pub async fn client(data: Rc<Client>) {
let mut recv = data.state.eng.spawn(receive(data.clone())).fuse(); let mut recv = data.state.eng.spawn(receive(data.clone())).fuse();

View file

@ -1,11 +1,14 @@
use std::cell::{Cell, UnsafeCell}; use {
use std::mem::MaybeUninit; std::{
use std::ptr; cell::{Cell, UnsafeCell},
use std::rc::Rc; mem::MaybeUninit,
use std::sync::atomic::{compiler_fence, Ordering}; ptr,
use thiserror::Error; rc::Rc,
use uapi::c; sync::atomic::{compiler_fence, Ordering},
use uapi::c::raise; },
thiserror::Error,
uapi::{c, c::raise},
};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum ClientMemError { pub enum ClientMemError {

View file

@ -1,37 +1,40 @@
use crate::acceptor::{Acceptor, AcceptorError}; use {
use crate::async_engine::{AsyncEngine, AsyncError, Phase}; crate::{
use crate::backends::dummy::DummyOutput; acceptor::{Acceptor, AcceptorError},
use crate::cli::{GlobalArgs, RunArgs}; async_engine::{AsyncEngine, AsyncError, Phase},
use crate::client::Clients; backend,
use crate::clientmem::ClientMemError; backends::dummy::DummyOutput,
use crate::config::ConfigProxy; cli::{GlobalArgs, RunArgs},
use crate::dbus::Dbus; client::Clients,
use crate::event_loop::{EventLoop, EventLoopError}; clientmem::{self, ClientMemError},
use crate::globals::Globals; config::ConfigProxy,
use crate::ifs::wl_output::WlOutputGlobal; dbus::Dbus,
use crate::ifs::wl_surface::NoneSurfaceExt; event_loop::{EventLoop, EventLoopError},
use crate::logger::Logger; forker,
use crate::render::RenderError; globals::Globals,
use crate::sighand::SighandError; ifs::{wl_output::WlOutputGlobal, wl_surface::NoneSurfaceExt},
use crate::state::{ConnectorData, State}; leaks,
use crate::tree::{ logger::Logger,
container_layout, container_render_data, float_layout, float_titles, DisplayNode, NodeIds, render::{self, RenderError},
OutputNode, WorkspaceNode, sighand::{self, SighandError},
state::{ConnectorData, State},
tasks,
tree::{
container_layout, container_render_data, float_layout, float_titles, DisplayNode,
NodeIds, OutputNode, WorkspaceNode,
},
utils::{
clonecell::CloneCell, errorfmt::ErrorFmt, fdcloser::FdCloser, queue::AsyncQueue,
run_toplevel::RunToplevel,
},
wheel::{Wheel, WheelError},
xkbcommon::XkbContext,
xwayland,
},
forker::ForkerProxy,
std::{cell::Cell, ops::Deref, rc::Rc, sync::Arc},
thiserror::Error,
}; };
use crate::utils::clonecell::CloneCell;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::fdcloser::FdCloser;
use crate::utils::queue::AsyncQueue;
use crate::utils::run_toplevel::RunToplevel;
use crate::wheel::{Wheel, WheelError};
use crate::xkbcommon::XkbContext;
use crate::{backend, clientmem, forker, leaks, render, sighand, tasks, xwayland};
use forker::ForkerProxy;
use std::cell::Cell;
use std::ops::Deref;
use std::rc::Rc;
use std::sync::Arc;
use thiserror::Error;
pub const MAX_EXTENTS: i32 = (1 << 24) - 1; pub const MAX_EXTENTS: i32 = (1 << 24) - 1;
@ -115,6 +118,7 @@ fn main_(forker: Rc<ForkerProxy>, logger: Arc<Logger>, _args: &RunArgs) -> Resul
fdcloser: FdCloser::new(), fdcloser: FdCloser::new(),
logger, logger,
connectors: Default::default(), connectors: Default::default(),
outputs: Default::default(),
}); });
{ {
let dummy_output = Rc::new(OutputNode { let dummy_output = Rc::new(OutputNode {
@ -125,9 +129,7 @@ fn main_(forker: Rc<ForkerProxy>, logger: Arc<Logger>, _args: &RunArgs) -> Resul
connector: Rc::new(DummyOutput { connector: Rc::new(DummyOutput {
id: state.connector_ids.next(), id: state.connector_ids.next(),
}), }),
monitor_info: Default::default(),
handler: Cell::new(None), handler: Cell::new(None),
node: Default::default(),
connected: Cell::new(true), connected: Cell::new(true),
}), }),
0, 0,

View file

@ -1,21 +1,27 @@
mod handler; mod handler;
use crate::backend::{ConnectorId, InputDeviceId}; use {
use crate::config::handler::ConfigProxyHandler; crate::{
use crate::ifs::wl_seat::SeatId; backend::{ConnectorId, InputDeviceId},
use crate::state::State; config::handler::ConfigProxyHandler,
use crate::utils::numcell::NumCell; ifs::wl_seat::SeatId,
use crate::utils::ptr_ext::PtrExt; state::State,
use jay_config::_private::ipc::{InitMessage, ServerMessage, V1InitMessage}; utils::{numcell::NumCell, ptr_ext::PtrExt},
use jay_config::_private::{bincode_ops, ConfigEntry, VERSION}; },
use jay_config::drm::Connector; jay_config::{
use jay_config::input::{InputDevice, Seat}; _private::{
use jay_config::keyboard::ModifiedKeySym; bincode_ops,
use libloading::Library; ipc::{InitMessage, ServerMessage, V1InitMessage},
use std::cell::Cell; ConfigEntry, VERSION,
use std::ptr; },
use std::rc::Rc; drm::Connector,
use thiserror::Error; input::{InputDevice, Seat},
keyboard::ModifiedKeySym,
},
libloading::Library,
std::{cell::Cell, ptr, rc::Rc},
thiserror::Error,
};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum ConfigError { pub enum ConfigError {

View file

@ -1,37 +1,40 @@
use crate::backend; use {
use crate::backend::{ crate::{
ConnectorId, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, Mode, backend,
}; backend::{ConnectorId, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId},
use crate::compositor::MAX_EXTENTS; compositor::MAX_EXTENTS,
use crate::ifs::wl_seat::{SeatId, WlSeatGlobal}; ifs::wl_seat::{SeatId, WlSeatGlobal},
use crate::state::{ConnectorData, DeviceHandlerData, State}; state::{ConnectorData, DeviceHandlerData, OutputData, State},
use crate::tree::walker::NodeVisitorBase; tree::{ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase},
use crate::tree::{ContainerNode, ContainerSplit, FloatNode, Node}; utils::{
use crate::utils::copyhashmap::CopyHashMap; copyhashmap::CopyHashMap, debug_fn::debug_fn, errorfmt::ErrorFmt, numcell::NumCell,
use crate::utils::debug_fn::debug_fn; stack::Stack,
use crate::utils::errorfmt::ErrorFmt; },
use crate::utils::numcell::NumCell; xkbcommon::{XkbCommonError, XkbKeymap},
use crate::utils::stack::Stack; },
use crate::xkbcommon::{XkbCommonError, XkbKeymap}; bincode::error::DecodeError,
use bincode::error::DecodeError; jay_config::{
use jay_config::_private::bincode_ops; _private::{
use jay_config::_private::ipc::{ClientMessage, Response, ServerMessage}; bincode_ops,
use jay_config::drm::Connector; ipc::{ClientMessage, Response, ServerMessage},
use jay_config::input::acceleration::{AccelProfile, ACCEL_PROFILE_ADAPTIVE, ACCEL_PROFILE_FLAT}; },
use jay_config::input::capability::{ drm::Connector,
input::{
acceleration::{AccelProfile, ACCEL_PROFILE_ADAPTIVE, ACCEL_PROFILE_FLAT},
capability::{
Capability, CAP_GESTURE, CAP_KEYBOARD, CAP_POINTER, CAP_SWITCH, CAP_TABLET_PAD, Capability, CAP_GESTURE, CAP_KEYBOARD, CAP_POINTER, CAP_SWITCH, CAP_TABLET_PAD,
CAP_TABLET_TOOL, CAP_TOUCH, CAP_TABLET_TOOL, CAP_TOUCH,
},
InputDevice, Seat,
},
keyboard::{keymap::Keymap, mods::Modifiers, syms::KeySym},
Axis, Direction, LogLevel, Workspace,
},
libloading::Library,
log::Level,
std::{cell::Cell, rc::Rc},
thiserror::Error,
}; };
use jay_config::input::{InputDevice, Seat};
use jay_config::keyboard::keymap::Keymap;
use jay_config::keyboard::mods::Modifiers;
use jay_config::keyboard::syms::KeySym;
use jay_config::{Axis, Direction, LogLevel, Workspace};
use libloading::Library;
use log::Level;
use std::cell::Cell;
use std::rc::Rc;
use thiserror::Error;
pub(super) struct ConfigProxyHandler { pub(super) struct ConfigProxyHandler {
pub client_data: Cell<*const u8>, pub client_data: Cell<*const u8>,
@ -194,6 +197,17 @@ impl ConfigProxyHandler {
} }
} }
fn get_output(&self, connector: Connector) -> Result<Rc<OutputData>, CphError> {
let data = self
.state
.outputs
.get(&ConnectorId::from_raw(connector.0 as _));
match data {
Some(d) => Ok(d),
_ => Err(CphError::OutputDoesNotExist(connector)),
}
}
fn get_seat(&self, seat: Seat) -> Result<Rc<WlSeatGlobal>, CphError> { fn get_seat(&self, seat: Seat) -> Result<Rc<WlSeatGlobal>, CphError> {
let seats = self.state.globals.seats.lock(); let seats = self.state.globals.seats.lock();
for seat_global in seats.values() { for seat_global in seats.values() {
@ -320,11 +334,8 @@ impl ConfigProxyHandler {
} }
fn handle_connector_mode(&self, connector: Connector) -> Result<(), CphError> { fn handle_connector_mode(&self, connector: Connector) -> Result<(), CphError> {
let connector = self.get_connector(connector)?; let connector = self.get_output(connector)?;
let mut mode = Mode::default(); let mode = connector.node.global.mode.get();
if let Some(node) = connector.node.get() {
mode = node.global.mode.get();
}
self.respond(Response::ConnectorMode { self.respond(Response::ConnectorMode {
width: mode.width, width: mode.width,
height: mode.height, height: mode.height,
@ -339,13 +350,11 @@ impl ConfigProxyHandler {
x: i32, x: i32,
y: i32, y: i32,
) -> Result<(), CphError> { ) -> Result<(), CphError> {
let connector = self.get_connector(connector)?; let connector = self.get_output(connector)?;
if x < 0 || y < 0 || x > MAX_EXTENTS || y > MAX_EXTENTS { if x < 0 || y < 0 || x > MAX_EXTENTS || y > MAX_EXTENTS {
return Err(CphError::InvalidConnectorPosition(x, y)); return Err(CphError::InvalidConnectorPosition(x, y));
} }
if let Some(node) = connector.node.get() { connector.node.set_position(x, y);
node.set_position(x, y);
}
Ok(()) Ok(())
} }
@ -774,6 +783,8 @@ enum CphError {
DeviceDoesNotExist(InputDevice), DeviceDoesNotExist(InputDevice),
#[error("Connector {0:?} does not exist")] #[error("Connector {0:?} does not exist")]
ConnectorDoesNotExist(Connector), ConnectorDoesNotExist(Connector),
#[error("Connector {0:?} does not exist or is not connected")]
OutputDoesNotExist(Connector),
#[error("{0}x{1} is not a valid connector position")] #[error("{0}x{1} is not a valid connector position")]
InvalidConnectorPosition(i32, i32), InvalidConnectorPosition(i32, i32),
#[error("Keymap {0:?} does not exist")] #[error("Keymap {0:?} does not exist")]

View file

@ -1,22 +1,28 @@
use crate::format::ARGB8888; use {
use crate::rect::Rect; crate::{
use crate::render::{RenderContext, RenderError, Renderer, Texture}; format::ARGB8888,
use crate::utils::errorfmt::ErrorFmt; rect::Rect,
use crate::utils::numcell::NumCell; render::{RenderContext, RenderError, Renderer, Texture},
use ahash::AHashSet; utils::{errorfmt::ErrorFmt, numcell::NumCell},
use bstr::{BStr, BString, ByteSlice, ByteVec}; },
use byteorder::{LittleEndian, ReadBytesExt}; ahash::AHashSet,
use isnt::std_1::primitive::IsntSliceExt; bstr::{BStr, BString, ByteSlice, ByteVec},
use std::cell::Cell; byteorder::{LittleEndian, ReadBytesExt},
use std::convert::TryInto; isnt::std_1::primitive::IsntSliceExt,
use std::fmt::{Debug, Formatter}; std::{
use std::fs::File; cell::Cell,
use std::io::{BufRead, BufReader, Seek, SeekFrom}; convert::TryInto,
use std::mem::MaybeUninit; env,
use std::rc::Rc; fmt::{Debug, Formatter},
use std::{env, io, slice, str}; fs::File,
use thiserror::Error; io::{self, BufRead, BufReader, Seek, SeekFrom},
use uapi::c; mem::MaybeUninit,
rc::Rc,
slice, str,
},
thiserror::Error,
uapi::c,
};
const XCURSOR_MAGIC: u32 = 0x72756358; const XCURSOR_MAGIC: u32 = 0x72756358;
const XCURSOR_IMAGE_TYPE: u32 = 0xfffd0002; const XCURSOR_IMAGE_TYPE: u32 = 0xfffd0002;

View file

@ -1,25 +1,35 @@
use crate::async_engine::{AsyncEngine, AsyncError, AsyncFd, SpawnedFuture};
use crate::dbus::property::GetReply;
use crate::dbus::types::{ObjectPath, Signature, Variant};
use crate::utils::bufio::{BufIo, BufIoError};
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::numcell::NumCell;
use crate::utils::run_toplevel::RunToplevel;
use crate::utils::vecstorage::VecStorage;
use ahash::AHashMap;
use std::borrow::Cow;
use std::cell::{Cell, RefCell};
use std::fmt::{Debug, Display};
use std::future::Future;
use std::marker::PhantomData;
use std::mem;
use std::pin::Pin;
use std::rc::Rc;
use std::task::{Context, Poll, Waker};
use thiserror::Error;
pub use types::*; pub use types::*;
use uapi::OwnedFd; use {
crate::{
async_engine::{AsyncEngine, AsyncError, AsyncFd, SpawnedFuture},
dbus::{
property::GetReply,
types::{ObjectPath, Signature, Variant},
},
utils::{
bufio::{BufIo, BufIoError},
clonecell::CloneCell,
copyhashmap::CopyHashMap,
numcell::NumCell,
run_toplevel::RunToplevel,
vecstorage::VecStorage,
},
},
ahash::AHashMap,
std::{
borrow::Cow,
cell::{Cell, RefCell},
fmt::{Debug, Display},
future::Future,
marker::PhantomData,
mem,
pin::Pin,
rc::Rc,
task::{Context, Poll, Waker},
},
thiserror::Error,
uapi::OwnedFd,
};
mod auth; mod auth;
mod dynamic_type; mod dynamic_type;
@ -468,11 +478,12 @@ struct InterfaceSignalHandlers {
} }
pub mod prelude { pub mod prelude {
pub use super::{ pub use {
super::{
types::{Bool, DictEntry, ObjectPath, Signature, Variant}, types::{Bool, DictEntry, ObjectPath, Signature, Variant},
DbusError, DbusType, Formatter, Message, MethodCall, Parser, Property, Signal, DbusError, DbusType, Formatter, Message, MethodCall, Parser, Property, Signal,
},
std::{borrow::Cow, rc::Rc},
uapi::OwnedFd,
}; };
pub use std::borrow::Cow;
pub use std::rc::Rc;
pub use uapi::OwnedFd;
} }

View file

@ -1,11 +1,11 @@
use crate::dbus::incoming::handle_incoming; use {
use crate::dbus::outgoing::handle_outgoing; crate::{
use crate::dbus::{DbusError, DbusSocket}; dbus::{incoming::handle_incoming, outgoing::handle_outgoing, DbusError, DbusSocket},
use crate::utils::errorfmt::ErrorFmt; utils::{errorfmt::ErrorFmt, hex},
use crate::utils::hex; },
use std::io::Write; std::{io::Write, rc::Rc},
use std::rc::Rc; uapi::{c, Errno},
use uapi::{c, Errno}; };
pub(super) async fn handle_auth(socket: Rc<DbusSocket>) { pub(super) async fn handle_auth(socket: Rc<DbusSocket>) {
let mut auth = Auth { let mut auth = Auth {

View file

@ -1,10 +1,11 @@
use super::{ use {
super::{
TY_ARRAY, TY_BOOLEAN, TY_BYTE, TY_DOUBLE, TY_INT16, TY_INT32, TY_INT64, TY_OBJECT_PATH, TY_ARRAY, TY_BOOLEAN, TY_BYTE, TY_DOUBLE, TY_INT16, TY_INT32, TY_INT64, TY_OBJECT_PATH,
TY_SIGNATURE, TY_STRING, TY_UINT16, TY_UINT32, TY_UINT64, TY_UNIX_FD, TY_VARIANT, TY_SIGNATURE, TY_STRING, TY_UINT16, TY_UINT32, TY_UINT64, TY_UNIX_FD, TY_VARIANT,
},
crate::dbus::{types::Variant, DbusError, DynamicType, Parser},
std::ops::Deref,
}; };
use crate::dbus::types::Variant;
use crate::dbus::{DbusError, DynamicType, Parser};
use std::ops::Deref;
impl DynamicType { impl DynamicType {
pub fn from_signature<'a>(mut s: &'a [u8]) -> Result<(DynamicType, &'a [u8]), DbusError> { pub fn from_signature<'a>(mut s: &'a [u8]) -> Result<(DynamicType, &'a [u8]), DbusError> {

View file

@ -1,7 +1,8 @@
use crate::dbus::types::Variant; use {
use crate::dbus::{DbusType, Formatter}; crate::dbus::{types::Variant, DbusType, Formatter},
use std::rc::Rc; std::rc::Rc,
use uapi::{OwnedFd, Packed}; uapi::{OwnedFd, Packed},
};
impl<'a> Formatter<'a> { impl<'a> Formatter<'a> {
pub fn new(fds: &'a mut Vec<Rc<OwnedFd>>, buf: &'a mut Vec<u8>) -> Self { pub fn new(fds: &'a mut Vec<Rc<OwnedFd>>, buf: &'a mut Vec<u8>) -> Self {

View file

@ -1,14 +1,13 @@
use crate::async_engine::AsyncEngine; use {
use crate::dbus::auth::handle_auth; crate::{
use crate::dbus::{DbusError, DbusHolder, DbusSocket}; async_engine::AsyncEngine,
use crate::utils::bufio::BufIo; dbus::{auth::handle_auth, DbusError, DbusHolder, DbusSocket},
use crate::utils::errorfmt::ErrorFmt; utils::{bufio::BufIo, errorfmt::ErrorFmt, numcell::NumCell, run_toplevel::RunToplevel},
use crate::utils::numcell::NumCell; wire_dbus::org,
use crate::utils::run_toplevel::RunToplevel; },
use crate::wire_dbus::org; std::{cell::Cell, rc::Rc},
use std::cell::Cell; uapi::c,
use std::rc::Rc; };
use uapi::c;
impl DbusHolder { impl DbusHolder {
pub(super) fn get( pub(super) fn get(

View file

@ -1,16 +1,21 @@
use super::{ use {
super::{
HDR_DESTINATION, HDR_ERROR_NAME, HDR_INTERFACE, HDR_MEMBER, HDR_PATH, HDR_REPLY_SERIAL, HDR_DESTINATION, HDR_ERROR_NAME, HDR_INTERFACE, HDR_MEMBER, HDR_PATH, HDR_REPLY_SERIAL,
HDR_SENDER, HDR_SIGNATURE, HDR_UNIX_FDS, HDR_SENDER, HDR_SIGNATURE, HDR_UNIX_FDS,
},
crate::{
dbus::{
CallError, DbusError, DbusSocket, Headers, Parser, MSG_ERROR, MSG_METHOD_RETURN,
MSG_SIGNAL,
},
utils::{
bufio::BufIoIncoming,
errorfmt::ErrorFmt,
ptr_ext::{MutPtrExt, PtrExt},
},
},
std::{cell::UnsafeCell, ops::Deref, rc::Rc},
}; };
use crate::dbus::{
CallError, DbusError, DbusSocket, Headers, Parser, MSG_ERROR, MSG_METHOD_RETURN, MSG_SIGNAL,
};
use crate::utils::bufio::BufIoIncoming;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::ptr_ext::{MutPtrExt, PtrExt};
use std::cell::UnsafeCell;
use std::ops::Deref;
use std::rc::Rc;
pub async fn handle_incoming(socket: Rc<DbusSocket>) { pub async fn handle_incoming(socket: Rc<DbusSocket>) {
let mut incoming = Incoming { let mut incoming = Incoming {

View file

@ -1,6 +1,7 @@
use crate::dbus::DbusSocket; use {
use crate::utils::errorfmt::ErrorFmt; crate::{dbus::DbusSocket, utils::errorfmt::ErrorFmt},
use std::rc::Rc; std::rc::Rc,
};
pub async fn handle_outgoing(socket: Rc<DbusSocket>) { pub async fn handle_outgoing(socket: Rc<DbusSocket>) {
if let Err(e) = socket.bufio.clone().outgoing().await { if let Err(e) = socket.bufio.clone().outgoing().await {

View file

@ -1,10 +1,12 @@
use crate::dbus::types::{Bool, ObjectPath, Signature, Variant, FALSE, TRUE}; use {
use crate::dbus::{DbusError, DbusType, DynamicType, Parser}; crate::dbus::{
use bstr::ByteSlice; types::{Bool, ObjectPath, Signature, Variant, FALSE, TRUE},
use std::borrow::Cow; DbusError, DbusType, DynamicType, Parser,
use std::mem; },
use std::rc::Rc; bstr::ByteSlice,
use uapi::{OwnedFd, Pod}; std::{borrow::Cow, mem, rc::Rc},
uapi::{OwnedFd, Pod},
};
impl<'a> Parser<'a> { impl<'a> Parser<'a> {
pub fn new(buf: &'a [u8], fds: &'a [Rc<OwnedFd>]) -> Self { pub fn new(buf: &'a [u8], fds: &'a [Rc<OwnedFd>]) -> Self {

View file

@ -1,6 +1,7 @@
use crate::dbus::{DbusError, DbusType, Formatter, Message, MethodCall, Parser}; use {
use std::borrow::Cow; crate::dbus::{DbusError, DbusType, Formatter, Message, MethodCall, Parser},
use std::marker::PhantomData; std::{borrow::Cow, marker::PhantomData},
};
#[derive(Debug)] #[derive(Debug)]
pub struct Get<'a, T: DbusType<'static>> { pub struct Get<'a, T: DbusType<'static>> {

View file

@ -1,23 +1,23 @@
use crate::dbus::property::Get; use {
use crate::dbus::types::{ObjectPath, Signature, Variant}; crate::{
use crate::dbus::{ dbus::{
AsyncProperty, AsyncReply, AsyncReplySlot, DbusError, DbusSocket, DbusType, Formatter, Headers, property::Get,
InterfaceSignalHandlers, Message, MethodCall, Parser, Property, Reply, ReplyHandler, Signal, types::{ObjectPath, Signature, Variant},
SignalHandler, SignalHandlerApi, SignalHandlerData, BUS_DEST, BUS_PATH, HDR_DESTINATION, AsyncProperty, AsyncReply, AsyncReplySlot, DbusError, DbusSocket, DbusType, Formatter,
HDR_INTERFACE, HDR_MEMBER, HDR_PATH, HDR_SIGNATURE, HDR_UNIX_FDS, MSG_METHOD_CALL, Headers, InterfaceSignalHandlers, Message, MethodCall, Parser, Property, Reply,
NO_REPLY_EXPECTED, ReplyHandler, Signal, SignalHandler, SignalHandlerApi, SignalHandlerData, BUS_DEST,
BUS_PATH, HDR_DESTINATION, HDR_INTERFACE, HDR_MEMBER, HDR_PATH, HDR_SIGNATURE,
HDR_UNIX_FDS, MSG_METHOD_CALL, NO_REPLY_EXPECTED,
},
utils::{bufio::BufIoMessage, errorfmt::ErrorFmt},
wire_dbus::org,
},
std::{
cell::Cell, collections::hash_map::Entry, fmt::Write, marker::PhantomData, mem,
ops::DerefMut, rc::Rc,
},
uapi::c,
}; };
use crate::utils::bufio::BufIoMessage;
use crate::utils::errorfmt::ErrorFmt;
use crate::wire_dbus::org;
use std::cell::Cell;
use std::collections::hash_map::Entry;
use std::fmt::Write;
use std::marker::PhantomData;
use std::mem;
use std::ops::DerefMut;
use std::rc::Rc;
use uapi::c;
impl DbusSocket { impl DbusSocket {
pub(super) fn kill(self: &Rc<Self>) { pub(super) fn kill(self: &Rc<Self>) {

View file

@ -1,12 +1,12 @@
use crate::dbus::{ use {
DbusError, DbusType, DynamicType, Formatter, Parser, TY_ARRAY, TY_BOOLEAN, TY_BYTE, TY_DOUBLE, crate::dbus::{
TY_INT16, TY_INT32, TY_INT64, TY_OBJECT_PATH, TY_SIGNATURE, TY_STRING, TY_UINT16, TY_UINT32, DbusError, DbusType, DynamicType, Formatter, Parser, TY_ARRAY, TY_BOOLEAN, TY_BYTE,
TY_UINT64, TY_UNIX_FD, TY_VARIANT, TY_DOUBLE, TY_INT16, TY_INT32, TY_INT64, TY_OBJECT_PATH, TY_SIGNATURE, TY_STRING,
TY_UINT16, TY_UINT32, TY_UINT64, TY_UNIX_FD, TY_VARIANT,
},
std::{borrow::Cow, ops::Deref, rc::Rc},
uapi::{OwnedFd, Packed, Pod},
}; };
use std::borrow::Cow;
use std::ops::Deref;
use std::rc::Rc;
use uapi::{OwnedFd, Packed, Pod};
macro_rules! consume_signature_body { macro_rules! consume_signature_body {
($s:expr, $ty:expr) => {{ ($s:expr, $ty:expr) => {{

View file

@ -1,10 +1,12 @@
use crate::utils::bitflags::BitflagsExt; use {
use crate::utils::ptr_ext::PtrExt; crate::utils::{bitflags::BitflagsExt, ptr_ext::PtrExt, stack::Stack},
use crate::utils::stack::Stack; bstr::{BString, ByteSlice},
use bstr::{BString, ByteSlice}; std::{
use std::fmt::{Debug, Formatter}; fmt::{Debug, Formatter},
use std::rc::Rc; rc::Rc,
use thiserror::Error; },
thiserror::Error,
};
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub enum ColorBitDepth { pub enum ColorBitDepth {

View file

@ -1,11 +1,13 @@
use crate::utils::clonecell::UnsafeCellCloneSafe; use {
use crate::utils::copyhashmap::CopyHashMap; crate::utils::{clonecell::UnsafeCellCloneSafe, copyhashmap::CopyHashMap, numcell::NumCell},
use crate::utils::numcell::NumCell; std::{
use std::cell::{Cell, RefCell}; cell::{Cell, RefCell},
use std::collections::VecDeque; collections::VecDeque,
use std::rc::Rc; rc::Rc,
use thiserror::Error; },
use uapi::{c, Errno, OwnedFd}; thiserror::Error,
uapi::{c, Errno, OwnedFd},
};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum EventLoopError { pub enum EventLoopError {

View file

@ -1,5 +1,7 @@
use std::fmt::{Debug, Display, Formatter}; use std::{
use std::ops::{Add, AddAssign, Sub, SubAssign}; fmt::{Debug, Display, Formatter},
ops::{Add, AddAssign, Sub, SubAssign},
};
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
#[repr(transparent)] #[repr(transparent)]

View file

@ -1,32 +1,40 @@
mod clone3; mod clone3;
mod io; mod io;
use crate::async_engine::{AsyncEngine, AsyncFd, SpawnedFuture}; use {
use crate::event_loop::EventLoop; crate::{
use crate::forker::clone3::{fork_with_pidfd, Forked}; async_engine::{AsyncEngine, AsyncFd, SpawnedFuture},
use crate::forker::io::{IoIn, IoOut}; event_loop::EventLoop,
use crate::state::State; forker::{
use crate::utils::buffd::BufFdError; clone3::{fork_with_pidfd, Forked},
use crate::utils::copyhashmap::CopyHashMap; io::{IoIn, IoOut},
use crate::utils::errorfmt::ErrorFmt; },
use crate::utils::numcell::NumCell; state::State,
use crate::utils::queue::AsyncQueue; utils::{
use crate::wheel::Wheel; buffd::BufFdError, copyhashmap::CopyHashMap, errorfmt::ErrorFmt, numcell::NumCell,
use crate::xwayland; queue::AsyncQueue,
use bincode::error::{DecodeError, EncodeError}; },
use bincode::{Decode, Encode}; wheel::Wheel,
use jay_config::_private::bincode_ops; xwayland,
use log::Level; },
use std::cell::{Cell, RefCell}; bincode::{
use std::env; error::{DecodeError, EncodeError},
use std::ffi::OsStr; Decode, Encode,
use std::io::Read; },
use std::io::Write; jay_config::_private::bincode_ops,
use std::os::unix::ffi::OsStrExt; log::Level,
use std::rc::{Rc, Weak}; std::{
use std::task::{Poll, Waker}; cell::{Cell, RefCell},
use thiserror::Error; env,
use uapi::{c, pipe2, Errno, Fd, IntoUstr, OwnedFd, UstrPtr}; ffi::OsStr,
io::{Read, Write},
os::unix::ffi::OsStrExt,
rc::{Rc, Weak},
task::{Poll, Waker},
},
thiserror::Error,
uapi::{c, pipe2, Errno, Fd, IntoUstr, OwnedFd, UstrPtr},
};
pub struct ForkerProxy { pub struct ForkerProxy {
pidfd: Rc<OwnedFd>, pidfd: Rc<OwnedFd>,

View file

@ -1,6 +1,8 @@
use crate::forker::ForkerError; use {
use std::mem; crate::forker::ForkerError,
use uapi::{c, OwnedFd}; std::mem,
uapi::{c, OwnedFd},
};
#[derive(Default, Copy, Clone)] #[derive(Default, Copy, Clone)]
#[allow(non_camel_case_types, dead_code)] #[allow(non_camel_case_types, dead_code)]

View file

@ -1,13 +1,20 @@
use bincode::{Decode, Encode}; use {
use std::mem; bincode::{Decode, Encode},
use std::rc::Rc; std::{mem, rc::Rc},
};
use crate::async_engine::AsyncFd; use {
use crate::forker::ForkerError; crate::{
use crate::utils::buffd::{BufFdIn, BufFdOut}; async_engine::AsyncFd,
use crate::utils::vec_ext::VecExt; forker::ForkerError,
use jay_config::_private::bincode_ops; utils::{
use uapi::OwnedFd; buffd::{BufFdIn, BufFdOut},
vec_ext::VecExt,
},
},
jay_config::_private::bincode_ops,
uapi::OwnedFd,
};
pub struct IoIn { pub struct IoIn {
incoming: BufFdIn, incoming: BufFdIn,

View file

@ -1,8 +1,12 @@
use crate::render::sys::{GLint, GL_BGRA_EXT, GL_UNSIGNED_BYTE}; use {
use crate::utils::debug_fn::debug_fn; crate::{
use ahash::AHashMap; render::sys::{GLint, GL_BGRA_EXT, GL_UNSIGNED_BYTE},
use once_cell::sync::Lazy; utils::debug_fn::debug_fn,
use std::fmt::{Debug, Write}; },
ahash::AHashMap,
once_cell::sync::Lazy,
std::fmt::{Debug, Write},
};
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Format { pub struct Format {

View file

@ -1,28 +1,40 @@
use crate::client::Client; use {
use crate::ifs::ipc::wl_data_device_manager::WlDataDeviceManagerGlobal; crate::{
use crate::ifs::ipc::zwp_primary_selection_device_manager_v1::ZwpPrimarySelectionDeviceManagerV1Global; client::Client,
use crate::ifs::jay_compositor::JayCompositorGlobal; ifs::{
use crate::ifs::org_kde_kwin_server_decoration_manager::OrgKdeKwinServerDecorationManagerGlobal; ipc::{
use crate::ifs::wl_compositor::WlCompositorGlobal; wl_data_device_manager::WlDataDeviceManagerGlobal,
use crate::ifs::wl_drm::WlDrmGlobal; zwp_primary_selection_device_manager_v1::ZwpPrimarySelectionDeviceManagerV1Global,
use crate::ifs::wl_output::WlOutputGlobal; },
use crate::ifs::wl_registry::WlRegistry; jay_compositor::JayCompositorGlobal,
use crate::ifs::wl_seat::WlSeatGlobal; org_kde_kwin_server_decoration_manager::OrgKdeKwinServerDecorationManagerGlobal,
use crate::ifs::wl_shm::WlShmGlobal; wl_compositor::WlCompositorGlobal,
use crate::ifs::wl_subcompositor::WlSubcompositorGlobal; wl_drm::WlDrmGlobal,
use crate::ifs::xdg_wm_base::XdgWmBaseGlobal; wl_output::WlOutputGlobal,
use crate::ifs::zwlr_layer_shell_v1::ZwlrLayerShellV1Global; wl_registry::WlRegistry,
use crate::ifs::zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1Global; wl_seat::WlSeatGlobal,
use crate::ifs::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1Global; wl_shm::WlShmGlobal,
use crate::ifs::zxdg_output_manager_v1::ZxdgOutputManagerV1Global; wl_subcompositor::WlSubcompositorGlobal,
use crate::object::{Interface, ObjectId}; xdg_wm_base::XdgWmBaseGlobal,
use crate::state::State; zwlr_layer_shell_v1::ZwlrLayerShellV1Global,
use crate::utils::copyhashmap::{CopyHashMap, Locked}; zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1Global,
use crate::utils::numcell::NumCell; zxdg_decoration_manager_v1::ZxdgDecorationManagerV1Global,
use std::error::Error; zxdg_output_manager_v1::ZxdgOutputManagerV1Global,
use std::fmt::{Display, Formatter}; },
use std::rc::Rc; object::{Interface, ObjectId},
use thiserror::Error; state::State,
utils::{
copyhashmap::{CopyHashMap, Locked},
numcell::NumCell,
},
},
std::{
error::Error,
fmt::{Display, Formatter},
rc::Rc,
},
thiserror::Error,
};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum GlobalsError { pub enum GlobalsError {

View file

@ -1,16 +1,21 @@
use crate::client::{Client, ClientId, WaylandObject}; use {
use crate::ifs::wl_seat::WlSeatGlobal; crate::{
use crate::object::ObjectId; client::{Client, ClientId, WaylandObject},
use crate::utils::bitflags::BitflagsExt; ifs::wl_seat::WlSeatGlobal,
use crate::utils::clonecell::CloneCell; object::ObjectId,
use crate::utils::numcell::NumCell; utils::{
use crate::utils::smallmap::SmallMap; bitflags::BitflagsExt, clonecell::CloneCell, numcell::NumCell, smallmap::SmallMap,
use ahash::AHashSet; },
use std::cell::{Cell, RefCell}; },
use std::ops::Deref; ahash::AHashSet,
use std::rc::Rc; std::{
use thiserror::Error; cell::{Cell, RefCell},
use uapi::OwnedFd; ops::Deref,
rc::Rc,
},
thiserror::Error,
uapi::OwnedFd,
};
pub mod wl_data_device; pub mod wl_data_device;
pub mod wl_data_device_manager; pub mod wl_data_device_manager;

View file

@ -1,22 +1,25 @@
use crate::client::{Client, ClientError, ClientId}; use {
use crate::fixed::Fixed; crate::{
use crate::ifs::ipc::wl_data_device_manager::WlDataDeviceManager; client::{Client, ClientError, ClientId},
use crate::ifs::ipc::wl_data_offer::WlDataOffer; fixed::Fixed,
use crate::ifs::ipc::wl_data_source::WlDataSource; ifs::{
use crate::ifs::ipc::{ ipc::{
break_device_loops, destroy_device, DeviceData, OfferData, Role, SourceData, Vtable, break_device_loops, destroy_device, wl_data_device_manager::WlDataDeviceManager,
wl_data_offer::WlDataOffer, wl_data_source::WlDataSource, DeviceData, OfferData,
Role, SourceData, Vtable,
},
wl_seat::{WlSeat, WlSeatError, WlSeatGlobal},
wl_surface::{SurfaceRole, WlSurfaceError},
},
leaks::Tracker,
object::{Object, ObjectId},
utils::buffd::{MsgParser, MsgParserError},
wire::{wl_data_device::*, WlDataDeviceId, WlDataOfferId, WlSurfaceId},
},
std::rc::Rc,
thiserror::Error,
uapi::OwnedFd,
}; };
use crate::ifs::wl_seat::{WlSeat, WlSeatError, WlSeatGlobal};
use crate::ifs::wl_surface::{SurfaceRole, WlSurfaceError};
use crate::leaks::Tracker;
use crate::object::{Object, ObjectId};
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::wire::wl_data_device::*;
use crate::wire::{WlDataDeviceId, WlDataOfferId, WlSurfaceId};
use std::rc::Rc;
use thiserror::Error;
use uapi::OwnedFd;
#[allow(dead_code)] #[allow(dead_code)]
const ROLE: u32 = 0; const ROLE: u32 = 0;

View file

@ -1,15 +1,16 @@
use crate::client::{Client, ClientError}; use {
use crate::globals::{Global, GlobalName}; crate::{
use crate::ifs::ipc::wl_data_device::WlDataDevice; client::{Client, ClientError},
use crate::ifs::ipc::wl_data_source::WlDataSource; globals::{Global, GlobalName},
use crate::leaks::Tracker; ifs::ipc::{wl_data_device::WlDataDevice, wl_data_source::WlDataSource},
use crate::object::Object; leaks::Tracker,
use crate::utils::buffd::MsgParser; object::Object,
use crate::utils::buffd::MsgParserError; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::wl_data_device_manager::*; wire::{wl_data_device_manager::*, WlDataDeviceManagerId},
use crate::wire::WlDataDeviceManagerId; },
use std::rc::Rc; std::rc::Rc,
use thiserror::Error; thiserror::Error,
};
pub(super) const DND_NONE: u32 = 0; pub(super) const DND_NONE: u32 = 0;
#[allow(dead_code)] #[allow(dead_code)]

View file

@ -1,19 +1,22 @@
use crate::client::{Client, ClientError}; use {
use crate::ifs::ipc::wl_data_device::WlDataDevice; crate::{
use crate::ifs::ipc::wl_data_device_manager::DND_ALL; client::{Client, ClientError},
use crate::ifs::ipc::{ ifs::ipc::{
break_offer_loops, destroy_offer, receive, OfferData, Role, OFFER_STATE_ACCEPTED, break_offer_loops, destroy_offer, receive, wl_data_device::WlDataDevice,
wl_data_device_manager::DND_ALL, OfferData, Role, OFFER_STATE_ACCEPTED,
OFFER_STATE_DROPPED, OFFER_STATE_FINISHED, SOURCE_STATE_FINISHED, OFFER_STATE_DROPPED, OFFER_STATE_FINISHED, SOURCE_STATE_FINISHED,
},
leaks::Tracker,
object::Object,
utils::{
bitflags::BitflagsExt,
buffd::{MsgParser, MsgParserError},
},
wire::{wl_data_offer::*, WlDataOfferId},
},
std::rc::Rc,
thiserror::Error,
}; };
use crate::leaks::Tracker;
use crate::object::Object;
use crate::utils::bitflags::BitflagsExt;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::wire::wl_data_offer::*;
use crate::wire::WlDataOfferId;
use std::rc::Rc;
use thiserror::Error;
#[allow(dead_code)] #[allow(dead_code)]
const INVALID_FINISH: u32 = 0; const INVALID_FINISH: u32 = 0;

View file

@ -1,21 +1,25 @@
use crate::client::{Client, ClientError}; use {
use crate::ifs::ipc::wl_data_device::WlDataDevice; crate::{
use crate::ifs::ipc::wl_data_device_manager::{DND_ALL, DND_NONE}; client::{Client, ClientError},
use crate::ifs::ipc::wl_data_offer::WlDataOffer; ifs::ipc::{
use crate::ifs::ipc::{ add_mime_type, break_source_loops, cancel_offers, destroy_source,
add_mime_type, break_source_loops, cancel_offers, destroy_source, SharedState, SourceData, wl_data_device::WlDataDevice,
OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED, wl_data_device_manager::{DND_ALL, DND_NONE},
wl_data_offer::WlDataOffer,
SharedState, SourceData, OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED,
},
leaks::Tracker,
object::Object,
utils::{
bitflags::BitflagsExt,
buffd::{MsgParser, MsgParserError},
},
wire::{wl_data_source::*, WlDataSourceId},
},
std::rc::Rc,
thiserror::Error,
uapi::OwnedFd,
}; };
use crate::leaks::Tracker;
use crate::object::Object;
use crate::utils::bitflags::BitflagsExt;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::wire::wl_data_source::*;
use crate::wire::WlDataSourceId;
use std::rc::Rc;
use thiserror::Error;
use uapi::OwnedFd;
#[allow(dead_code)] #[allow(dead_code)]
const INVALID_ACTION_MASK: u32 = 0; const INVALID_ACTION_MASK: u32 = 0;

View file

@ -1,15 +1,19 @@
use crate::client::{Client, ClientError}; use {
use crate::globals::{Global, GlobalName}; crate::{
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1; client::{Client, ClientError},
use crate::ifs::ipc::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1; globals::{Global, GlobalName},
use crate::leaks::Tracker; ifs::ipc::{
use crate::object::Object; zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1,
use crate::utils::buffd::MsgParser; zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1,
use crate::utils::buffd::MsgParserError; },
use crate::wire::zwp_primary_selection_device_manager_v1::*; leaks::Tracker,
use crate::wire::ZwpPrimarySelectionDeviceManagerV1Id; object::Object,
use std::rc::Rc; utils::buffd::{MsgParser, MsgParserError},
use thiserror::Error; wire::{zwp_primary_selection_device_manager_v1::*, ZwpPrimarySelectionDeviceManagerV1Id},
},
std::rc::Rc,
thiserror::Error,
};
pub struct ZwpPrimarySelectionDeviceManagerV1Global { pub struct ZwpPrimarySelectionDeviceManagerV1Global {
name: GlobalName, name: GlobalName,

View file

@ -1,19 +1,28 @@
use crate::client::{Client, ClientError, ClientId}; use {
use crate::ifs::ipc::zwp_primary_selection_device_manager_v1::ZwpPrimarySelectionDeviceManagerV1; crate::{
use crate::ifs::ipc::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1; client::{Client, ClientError, ClientId},
use crate::ifs::ipc::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1; ifs::{
use crate::ifs::ipc::{ ipc::{
break_device_loops, destroy_device, DeviceData, OfferData, Role, SourceData, Vtable, break_device_loops, destroy_device,
zwp_primary_selection_device_manager_v1::ZwpPrimarySelectionDeviceManagerV1,
zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1,
zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1, DeviceData,
OfferData, Role, SourceData, Vtable,
},
wl_seat::{WlSeat, WlSeatError, WlSeatGlobal},
},
leaks::Tracker,
object::{Object, ObjectId},
utils::buffd::{MsgParser, MsgParserError},
wire::{
zwp_primary_selection_device_v1::*, ZwpPrimarySelectionDeviceV1Id,
ZwpPrimarySelectionOfferV1Id,
},
},
std::rc::Rc,
thiserror::Error,
uapi::OwnedFd,
}; };
use crate::ifs::wl_seat::{WlSeat, WlSeatError, WlSeatGlobal};
use crate::leaks::Tracker;
use crate::object::{Object, ObjectId};
use crate::utils::buffd::{MsgParser, MsgParserError};
use crate::wire::zwp_primary_selection_device_v1::*;
use crate::wire::{ZwpPrimarySelectionDeviceV1Id, ZwpPrimarySelectionOfferV1Id};
use std::rc::Rc;
use thiserror::Error;
use uapi::OwnedFd;
pub struct ZwpPrimarySelectionDeviceV1 { pub struct ZwpPrimarySelectionDeviceV1 {
pub id: ZwpPrimarySelectionDeviceV1Id, pub id: ZwpPrimarySelectionDeviceV1Id,

View file

@ -1,13 +1,18 @@
use crate::client::{Client, ClientError}; use {
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1; crate::{
use crate::ifs::ipc::{break_offer_loops, destroy_offer, receive, OfferData}; client::{Client, ClientError},
use crate::leaks::Tracker; ifs::ipc::{
use crate::object::Object; break_offer_loops, destroy_offer, receive,
use crate::utils::buffd::{MsgParser, MsgParserError}; zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1, OfferData,
use crate::wire::zwp_primary_selection_offer_v1::*; },
use crate::wire::ZwpPrimarySelectionOfferV1Id; leaks::Tracker,
use std::rc::Rc; object::Object,
use thiserror::Error; utils::buffd::{MsgParser, MsgParserError},
wire::{zwp_primary_selection_offer_v1::*, ZwpPrimarySelectionOfferV1Id},
},
std::rc::Rc,
thiserror::Error,
};
pub struct ZwpPrimarySelectionOfferV1 { pub struct ZwpPrimarySelectionOfferV1 {
pub id: ZwpPrimarySelectionOfferV1Id, pub id: ZwpPrimarySelectionOfferV1Id,

View file

@ -1,14 +1,19 @@
use crate::client::{Client, ClientError}; use {
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1; crate::{
use crate::ifs::ipc::{add_mime_type, break_source_loops, destroy_source, SourceData}; client::{Client, ClientError},
use crate::leaks::Tracker; ifs::ipc::{
use crate::object::Object; add_mime_type, break_source_loops, destroy_source,
use crate::utils::buffd::{MsgParser, MsgParserError}; zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1, SourceData,
use crate::wire::zwp_primary_selection_source_v1::*; },
use crate::wire::ZwpPrimarySelectionSourceV1Id; leaks::Tracker,
use std::rc::Rc; object::Object,
use thiserror::Error; utils::buffd::{MsgParser, MsgParserError},
use uapi::OwnedFd; wire::{zwp_primary_selection_source_v1::*, ZwpPrimarySelectionSourceV1Id},
},
std::rc::Rc,
thiserror::Error,
uapi::OwnedFd,
};
pub struct ZwpPrimarySelectionSourceV1 { pub struct ZwpPrimarySelectionSourceV1 {
pub id: ZwpPrimarySelectionSourceV1Id, pub id: ZwpPrimarySelectionSourceV1Id,

View file

@ -1,15 +1,18 @@
use crate::cli::CliLogLevel; use {
use crate::client::{Client, ClientError}; crate::{
use crate::globals::{Global, GlobalName}; cli::CliLogLevel,
use crate::ifs::jay_log_file::JayLogFile; client::{Client, ClientError},
use crate::leaks::Tracker; globals::{Global, GlobalName},
use crate::object::Object; ifs::jay_log_file::JayLogFile,
use crate::utils::buffd::{MsgParser, MsgParserError}; leaks::Tracker,
use crate::wire::jay_compositor::*; object::Object,
use crate::wire::JayCompositorId; utils::buffd::{MsgParser, MsgParserError},
use log::Level; wire::{jay_compositor::*, JayCompositorId},
use std::rc::Rc; },
use thiserror::Error; log::Level,
std::rc::Rc,
thiserror::Error,
};
pub struct JayCompositorGlobal { pub struct JayCompositorGlobal {
name: GlobalName, name: GlobalName,

View file

@ -1,12 +1,15 @@
use crate::client::{Client, ClientError}; use {
use crate::leaks::Tracker; crate::{
use crate::object::Object; client::{Client, ClientError},
use crate::utils::buffd::{MsgParser, MsgParserError}; leaks::Tracker,
use crate::wire::jay_log_file::*; object::Object,
use crate::wire::JayLogFileId; utils::buffd::{MsgParser, MsgParserError},
use bstr::BStr; wire::{jay_log_file::*, JayLogFileId},
use std::rc::Rc; },
use thiserror::Error; bstr::BStr,
std::rc::Rc,
thiserror::Error,
};
pub struct JayLogFile { pub struct JayLogFile {
pub id: JayLogFileId, pub id: JayLogFileId,

View file

@ -1,13 +1,14 @@
use crate::client::{Client, ClientError}; use {
use crate::leaks::Tracker; crate::{
use crate::object::Object; client::{Client, ClientError},
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::Object,
use crate::wire::org_kde_kwin_server_decoration::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::OrgKdeKwinServerDecorationId; wire::{org_kde_kwin_server_decoration::*, OrgKdeKwinServerDecorationId},
use std::cell::Cell; },
use std::rc::Rc; std::{cell::Cell, rc::Rc},
use thiserror::Error; thiserror::Error,
};
#[allow(dead_code)] #[allow(dead_code)]
const NONE: u32 = 0; const NONE: u32 = 0;

View file

@ -1,14 +1,16 @@
use crate::client::{Client, ClientError}; use {
use crate::globals::{Global, GlobalName}; crate::{
use crate::ifs::org_kde_kwin_server_decoration::OrgKdeKwinServerDecoration; client::{Client, ClientError},
use crate::leaks::Tracker; globals::{Global, GlobalName},
use crate::object::Object; ifs::org_kde_kwin_server_decoration::OrgKdeKwinServerDecoration,
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::Object,
use crate::wire::org_kde_kwin_server_decoration_manager::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::OrgKdeKwinServerDecorationManagerId; wire::{org_kde_kwin_server_decoration_manager::*, OrgKdeKwinServerDecorationManagerId},
use std::rc::Rc; },
use thiserror::Error; std::rc::Rc,
thiserror::Error,
};
#[allow(dead_code)] #[allow(dead_code)]
const NONE: u32 = 0; const NONE: u32 = 0;

View file

@ -1,18 +1,21 @@
use crate::client::{Client, ClientError}; use {
use crate::clientmem::{ClientMem, ClientMemError, ClientMemOffset}; crate::{
use crate::format::Format; client::{Client, ClientError},
use crate::leaks::Tracker; clientmem::{ClientMem, ClientMemError, ClientMemOffset},
use crate::object::Object; format::Format,
use crate::rect::Rect; leaks::Tracker,
use crate::render::{Image, RenderError, Texture}; object::Object,
use crate::utils::buffd::MsgParser; rect::Rect,
use crate::utils::buffd::MsgParserError; render::{Image, RenderError, Texture},
use crate::utils::clonecell::CloneCell; utils::{
use crate::wire::wl_buffer::*; buffd::{MsgParser, MsgParserError},
use crate::wire::WlBufferId; clonecell::CloneCell,
use std::cell::Cell; },
use std::rc::Rc; wire::{wl_buffer::*, WlBufferId},
use thiserror::Error; },
std::{cell::Cell, rc::Rc},
thiserror::Error,
};
pub enum WlBufferStorage { pub enum WlBufferStorage {
Shm { mem: ClientMemOffset, stride: i32 }, Shm { mem: ClientMemOffset, stride: i32 },

View file

@ -1,10 +1,13 @@
use crate::client::Client; use {
use crate::leaks::Tracker; crate::{
use crate::object::Object; client::Client,
use crate::wire::wl_callback::*; leaks::Tracker,
use crate::wire::WlCallbackId; object::Object,
use std::rc::Rc; wire::{wl_callback::*, WlCallbackId},
use thiserror::Error; },
std::rc::Rc,
thiserror::Error,
};
pub struct WlCallback { pub struct WlCallback {
client: Rc<Client>, client: Rc<Client>,

View file

@ -1,16 +1,17 @@
use crate::client::{Client, ClientError}; use {
use crate::globals::{Global, GlobalName}; crate::{
use crate::ifs::wl_region::WlRegion; client::{Client, ClientError},
use crate::ifs::wl_surface::WlSurface; globals::{Global, GlobalName},
use crate::leaks::Tracker; ifs::{wl_region::WlRegion, wl_surface::WlSurface},
use crate::object::Object; leaks::Tracker,
use crate::utils::buffd::MsgParser; object::Object,
use crate::utils::buffd::MsgParserError; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::wl_compositor::*; wire::{wl_compositor::*, WlCompositorId},
use crate::wire::WlCompositorId; xwayland::XWaylandEvent,
use crate::xwayland::XWaylandEvent; },
use std::rc::Rc; std::rc::Rc,
use thiserror::Error; thiserror::Error,
};
pub struct WlCompositorGlobal { pub struct WlCompositorGlobal {
name: GlobalName, name: GlobalName,

View file

@ -1,15 +1,16 @@
use crate::client::{Client, ClientError}; use {
use crate::globals::GlobalsError; crate::{
use crate::ifs::wl_callback::WlCallback; client::{Client, ClientError},
use crate::ifs::wl_registry::WlRegistry; globals::GlobalsError,
use crate::leaks::Tracker; ifs::{wl_callback::WlCallback, wl_registry::WlRegistry},
use crate::object::{Object, ObjectId, WL_DISPLAY_ID}; leaks::Tracker,
use crate::utils::buffd::MsgParser; object::{Object, ObjectId, WL_DISPLAY_ID},
use crate::utils::buffd::MsgParserError; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::wl_display::*; wire::{wl_display::*, WlDisplayId},
use crate::wire::WlDisplayId; },
use std::rc::Rc; std::rc::Rc,
use thiserror::Error; thiserror::Error,
};
const INVALID_OBJECT: u32 = 0; const INVALID_OBJECT: u32 = 0;
const INVALID_METHOD: u32 = 1; const INVALID_METHOD: u32 = 1;

View file

@ -1,19 +1,22 @@
use crate::client::{Client, ClientError}; use {
use crate::drm::dma::{DmaBuf, DmaBufPlane}; crate::{
use crate::drm::INVALID_MODIFIER; client::{Client, ClientError},
use crate::globals::{Global, GlobalName}; video::{
use crate::ifs::wl_buffer::WlBuffer; dma::{DmaBuf, DmaBufPlane},
use crate::leaks::Tracker; INVALID_MODIFIER,
use crate::object::Object; },
use crate::render::RenderError; globals::{Global, GlobalName},
use crate::utils::buffd::MsgParser; ifs::wl_buffer::WlBuffer,
use crate::utils::buffd::MsgParserError; leaks::Tracker,
use crate::wire::wl_drm::*; object::Object,
use crate::wire::WlDrmId; render::RenderError,
use bstr::ByteSlice; utils::buffd::{MsgParser, MsgParserError},
use std::ffi::CString; wire::{wl_drm::*, WlDrmId},
use std::rc::Rc; },
use thiserror::Error; bstr::ByteSlice,
std::{ffi::CString, rc::Rc},
thiserror::Error,
};
const PRIME: u32 = 1; const PRIME: u32 = 1;

View file

@ -1,23 +1,29 @@
use crate::backend; use {
use crate::client::{Client, ClientError, ClientId}; crate::{
use crate::globals::{Global, GlobalName}; backend,
use crate::ifs::zxdg_output_v1::ZxdgOutputV1; client::{Client, ClientError, ClientId},
use crate::leaks::Tracker; globals::{Global, GlobalName},
use crate::object::Object; ifs::zxdg_output_v1::ZxdgOutputV1,
use crate::rect::Rect; leaks::Tracker,
use crate::state::ConnectorData; object::Object,
use crate::tree::OutputNode; rect::Rect,
use crate::utils::buffd::MsgParser; state::ConnectorData,
use crate::utils::buffd::MsgParserError; tree::OutputNode,
use crate::utils::clonecell::CloneCell; utils::{
use crate::utils::copyhashmap::CopyHashMap; buffd::{MsgParser, MsgParserError},
use crate::wire::wl_output::*; clonecell::CloneCell,
use crate::wire::{WlOutputId, ZxdgOutputV1Id}; copyhashmap::CopyHashMap,
use ahash::AHashMap; },
use std::cell::{Cell, RefCell}; wire::{wl_output::*, WlOutputId, ZxdgOutputV1Id},
use std::collections::hash_map::Entry; },
use std::rc::Rc; ahash::AHashMap,
use thiserror::Error; std::{
cell::{Cell, RefCell},
collections::hash_map::Entry,
rc::Rc,
},
thiserror::Error,
};
const SP_UNKNOWN: i32 = 0; const SP_UNKNOWN: i32 = 0;
#[allow(dead_code)] #[allow(dead_code)]

View file

@ -1,14 +1,15 @@
use crate::client::{Client, ClientError}; use {
use crate::leaks::Tracker; crate::{
use crate::object::Object; client::{Client, ClientError},
use crate::rect::{Rect, Region, RegionBuilder}; leaks::Tracker,
use crate::utils::buffd::MsgParser; object::Object,
use crate::utils::buffd::MsgParserError; rect::{Rect, Region, RegionBuilder},
use crate::wire::wl_region::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::WlRegionId; wire::{wl_region::*, WlRegionId},
use std::cell::RefCell; },
use std::rc::Rc; std::{cell::RefCell, rc::Rc},
use thiserror::Error; thiserror::Error,
};
pub struct WlRegion { pub struct WlRegion {
id: WlRegionId, id: WlRegionId,

View file

@ -1,13 +1,15 @@
use crate::client::Client; use {
use crate::globals::{Global, GlobalName, GlobalsError}; crate::{
use crate::leaks::Tracker; client::Client,
use crate::object::{Interface, Object}; globals::{Global, GlobalName, GlobalsError},
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::{Interface, Object},
use crate::wire::wl_registry::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::WlRegistryId; wire::{wl_registry::*, WlRegistryId},
use std::rc::Rc; },
use thiserror::Error; std::rc::Rc,
thiserror::Error,
};
pub struct WlRegistry { pub struct WlRegistry {
id: WlRegistryId, id: WlRegistryId,

View file

@ -5,53 +5,62 @@ pub mod wl_keyboard;
pub mod wl_pointer; pub mod wl_pointer;
pub mod wl_touch; pub mod wl_touch;
use crate::async_engine::SpawnedFuture;
use crate::client::{Client, ClientError, ClientId};
use crate::cursor::{Cursor, KnownCursor};
use crate::fixed::Fixed;
use crate::globals::{Global, GlobalName};
use crate::ifs::ipc;
use crate::ifs::ipc::wl_data_device::WlDataDevice;
use crate::ifs::ipc::wl_data_source::WlDataSource;
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1;
use crate::ifs::ipc::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1;
use crate::ifs::ipc::IpcError;
use crate::ifs::wl_seat::kb_owner::KbOwnerHolder;
use crate::ifs::wl_seat::pointer_owner::PointerOwnerHolder;
use crate::ifs::wl_seat::wl_keyboard::{WlKeyboard, WlKeyboardError, REPEAT_INFO_SINCE};
use crate::ifs::wl_seat::wl_pointer::WlPointer;
use crate::ifs::wl_seat::wl_touch::WlTouch;
use crate::ifs::wl_surface::WlSurface;
use crate::leaks::Tracker;
use crate::object::{Object, ObjectId};
use crate::state::State;
use crate::tree::toplevel::ToplevelNode;
use crate::tree::{ContainerSplit, FloatNode, FoundNode, Node, OutputNode};
use crate::utils::asyncevent::AsyncEvent;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::linkedlist::{LinkedList, LinkedNode};
use crate::utils::numcell::NumCell;
use crate::utils::rc_eq::rc_eq;
use crate::wire::wl_seat::*;
use crate::wire::{
WlDataDeviceId, WlKeyboardId, WlPointerId, WlSeatId, ZwpPrimarySelectionDeviceV1Id,
};
use crate::xkbcommon::{XkbKeymap, XkbState};
use ahash::{AHashMap, AHashSet};
pub use event_handling::NodeSeatState; pub use event_handling::NodeSeatState;
use jay_config::keyboard::mods::Modifiers; use {
use jay_config::Direction; crate::{
use std::cell::{Cell, RefCell}; async_engine::SpawnedFuture,
use std::collections::hash_map::Entry; client::{Client, ClientError, ClientId},
use std::mem; cursor::{Cursor, KnownCursor},
use std::ops::DerefMut; fixed::Fixed,
use std::rc::Rc; globals::{Global, GlobalName},
use thiserror::Error; ifs::{
use uapi::{c, Errno, OwnedFd}; ipc,
ipc::{
wl_data_device::WlDataDevice, wl_data_source::WlDataSource,
zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1,
zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1, IpcError,
},
wl_seat::{
kb_owner::KbOwnerHolder,
pointer_owner::PointerOwnerHolder,
wl_keyboard::{WlKeyboard, WlKeyboardError, REPEAT_INFO_SINCE},
wl_pointer::WlPointer,
wl_touch::WlTouch,
},
wl_surface::WlSurface,
},
leaks::Tracker,
object::{Object, ObjectId},
state::State,
tree::{ContainerSplit, FloatNode, FoundNode, Node, OutputNode, ToplevelNode},
utils::{
asyncevent::AsyncEvent,
buffd::{MsgParser, MsgParserError},
clonecell::CloneCell,
copyhashmap::CopyHashMap,
errorfmt::ErrorFmt,
linkedlist::{LinkedList, LinkedNode},
numcell::NumCell,
rc_eq::rc_eq,
},
wire::{
wl_seat::*, WlDataDeviceId, WlKeyboardId, WlPointerId, WlSeatId,
ZwpPrimarySelectionDeviceV1Id,
},
xkbcommon::{XkbKeymap, XkbState},
},
ahash::{AHashMap, AHashSet},
jay_config::{keyboard::mods::Modifiers, Direction},
std::{
cell::{Cell, RefCell},
collections::hash_map::Entry,
mem,
ops::DerefMut,
rc::Rc,
},
thiserror::Error,
uapi::{c, Errno, OwnedFd},
};
const POINTER: u32 = 1; const POINTER: u32 = 1;
const KEYBOARD: u32 = 2; const KEYBOARD: u32 = 2;

View file

@ -1,27 +1,31 @@
use crate::backend::{ConnectorId, InputEvent, KeyState, ScrollAxis}; use {
use crate::client::{Client, ClientId}; crate::{
use crate::fixed::Fixed; backend::{ConnectorId, InputEvent, KeyState, ScrollAxis},
use crate::ifs::ipc; client::{Client, ClientId},
use crate::ifs::ipc::wl_data_device::WlDataDevice; fixed::Fixed,
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1; ifs::{
use crate::ifs::wl_seat::wl_keyboard::WlKeyboard; ipc,
use crate::ifs::wl_seat::wl_pointer::{WlPointer, POINTER_FRAME_SINCE_VERSION}; ipc::{
use crate::ifs::wl_seat::{wl_keyboard, wl_pointer, Dnd, SeatId, WlSeat, WlSeatGlobal}; wl_data_device::WlDataDevice,
use crate::ifs::wl_surface::xdg_surface::xdg_popup::XdgPopup; zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1,
use crate::ifs::wl_surface::WlSurface; },
use crate::object::ObjectId; wl_seat::{
use crate::tree::toplevel::ToplevelNode; wl_keyboard::{self, WlKeyboard},
use crate::tree::{FloatNode, Node, OutputNode}; wl_pointer::{self, WlPointer, POINTER_FRAME_SINCE_VERSION},
use crate::utils::clonecell::CloneCell; Dnd, SeatId, WlSeat, WlSeatGlobal,
use crate::utils::smallmap::SmallMap; },
use crate::wire::WlDataOfferId; wl_surface::{xdg_surface::xdg_popup::XdgPopup, WlSurface},
use crate::xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP}; },
use jay_config::keyboard::mods::Modifiers; object::ObjectId,
use jay_config::keyboard::syms::KeySym; tree::{FloatNode, Node, OutputNode, ToplevelNode},
use jay_config::keyboard::ModifiedKeySym; utils::{clonecell::CloneCell, smallmap::SmallMap},
use smallvec::SmallVec; wire::WlDataOfferId,
use std::ops::Deref; xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP},
use std::rc::Rc; },
jay_config::keyboard::{mods::Modifiers, syms::KeySym, ModifiedKeySym},
smallvec::SmallVec,
std::{ops::Deref, rc::Rc},
};
#[derive(Default)] #[derive(Default)]
pub struct NodeSeatState { pub struct NodeSeatState {
@ -126,23 +130,47 @@ impl WlSeatGlobal {
mut x: Fixed, mut x: Fixed,
mut y: Fixed, mut y: Fixed,
) { ) {
let output = match self.state.connectors.get(&connector) { let output = match self.state.outputs.get(&connector) {
Some(o) => o, Some(o) => o,
_ => return, _ => return,
}; };
let node = match output.node.get() { let pos = output.node.global.pos.get();
Some(n) => n,
_ => return,
};
let pos = node.global.pos.get();
x += Fixed::from_int(pos.x1()); x += Fixed::from_int(pos.x1());
y += Fixed::from_int(pos.y1()); y += Fixed::from_int(pos.y1());
self.set_new_position(x, y); self.set_new_position(x, y);
} }
fn motion_event(self: &Rc<Self>, dx: Fixed, dy: Fixed) { fn motion_event(self: &Rc<Self>, dx: Fixed, dy: Fixed) {
let (x, y) = self.pos.get(); let (mut x, mut y) = self.pos.get();
self.set_new_position(x + dx, y + dy); x += dx;
y += dy;
let output = self.output.get();
let pos = output.global.pos.get();
let mut x_int = x.round_down();
let mut y_int = y.round_down();
if !pos.contains(x_int, y_int) {
'warp: {
let outputs = self.state.outputs.lock();
for output in outputs.values() {
if output.node.global.pos.get().contains(x_int, y_int) {
break 'warp;
}
}
if x_int < pos.x1() {
x_int = pos.x1();
} else if x_int >= pos.x2() {
x_int = pos.x2() - 1;
}
if y_int < pos.y1() {
y_int = pos.y1();
} else if y_int >= pos.y2() {
y_int = pos.y2() - 1;
}
x = x.apply_fract(x_int);
y = y.apply_fract(y_int);
}
}
self.set_new_position(x, y);
} }
fn key_event(&self, key: u32, state: KeyState) { fn key_event(&self, key: u32, state: KeyState) {
@ -201,8 +229,10 @@ impl WlSeatGlobal {
} }
pub fn last_tiled_keyboard_toplevel(&self, new: &dyn Node) -> Option<Rc<dyn ToplevelNode>> { pub fn last_tiled_keyboard_toplevel(&self, new: &dyn Node) -> Option<Rc<dyn ToplevelNode>> {
let output = self.output.get(); let workspace = match self.output.get().workspace.get() {
let workspace = output.workspace.get().unwrap(); Some(ws) => ws,
_ => return None,
};
let is_container = new.is_container(); let is_container = new.is_container();
for tl in self.toplevel_focus_history.rev_iter() { for tl in self.toplevel_focus_history.rev_iter() {
match tl.as_node().get_workspace() { match tl.as_node().get_workspace() {
@ -448,10 +478,6 @@ impl WlSeatGlobal {
self.surface_pointer_event(0, n, |p| p.send_leave(serial, n.id)); self.surface_pointer_event(0, n, |p| p.send_leave(serial, n.id));
self.surface_pointer_frame(n); self.surface_pointer_frame(n);
} }
pub fn leave_output(&self) {
self.output.set(self.state.dummy_output.get().unwrap());
}
} }
// Unfocus callbacks // Unfocus callbacks

View file

@ -1,8 +1,11 @@
use crate::ifs::wl_seat::WlSeatGlobal; use {
use crate::tree::{Node, OutputNode}; crate::{
use crate::utils::clonecell::CloneCell; ifs::wl_seat::WlSeatGlobal,
use std::ops::Deref; tree::{Node, OutputNode},
use std::rc::Rc; utils::clonecell::CloneCell,
},
std::{ops::Deref, rc::Rc},
};
pub struct KbOwnerHolder { pub struct KbOwnerHolder {
default: Rc<DefaultKbOwner>, default: Rc<DefaultKbOwner>,

View file

@ -1,15 +1,18 @@
use crate::backend::{KeyState, ScrollAxis}; use {
use crate::fixed::Fixed; crate::{
use crate::ifs::ipc; backend::{KeyState, ScrollAxis},
use crate::ifs::ipc::wl_data_device::WlDataDevice; fixed::Fixed,
use crate::ifs::ipc::wl_data_source::WlDataSource; ifs::{
use crate::ifs::wl_seat::{Dnd, DroppedDnd, WlSeatError, WlSeatGlobal}; ipc,
use crate::ifs::wl_surface::WlSurface; ipc::{wl_data_device::WlDataDevice, wl_data_source::WlDataSource},
use crate::tree::{FoundNode, Node}; wl_seat::{Dnd, DroppedDnd, WlSeatError, WlSeatGlobal},
use crate::utils::clonecell::CloneCell; wl_surface::WlSurface,
use crate::utils::smallmap::SmallMap; },
use std::cell::Cell; tree::{FoundNode, Node},
use std::rc::Rc; utils::{clonecell::CloneCell, smallmap::SmallMap},
},
std::{cell::Cell, rc::Rc},
};
pub struct PointerOwnerHolder { pub struct PointerOwnerHolder {
default: Rc<DefaultPointerOwner>, default: Rc<DefaultPointerOwner>,

View file

@ -1,14 +1,16 @@
use crate::client::ClientError; use {
use crate::ifs::wl_seat::WlSeat; crate::{
use crate::leaks::Tracker; client::ClientError,
use crate::object::Object; ifs::wl_seat::WlSeat,
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::Object,
use crate::wire::wl_keyboard::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::{WlKeyboardId, WlSurfaceId}; wire::{wl_keyboard::*, WlKeyboardId, WlSurfaceId},
use std::rc::Rc; },
use thiserror::Error; std::rc::Rc,
use uapi::OwnedFd; thiserror::Error,
uapi::OwnedFd,
};
pub const REPEAT_INFO_SINCE: u32 = 4; pub const REPEAT_INFO_SINCE: u32 = 4;

View file

@ -1,16 +1,17 @@
use crate::client::ClientError; use {
use crate::cursor::Cursor; crate::{
use crate::fixed::Fixed; client::ClientError,
use crate::ifs::wl_seat::WlSeat; cursor::Cursor,
use crate::ifs::wl_surface::WlSurfaceError; fixed::Fixed,
use crate::leaks::Tracker; ifs::{wl_seat::WlSeat, wl_surface::WlSurfaceError},
use crate::object::Object; leaks::Tracker,
use crate::utils::buffd::MsgParser; object::Object,
use crate::utils::buffd::MsgParserError; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::wl_pointer::*; wire::{wl_pointer::*, WlPointerId, WlSurfaceId},
use crate::wire::{WlPointerId, WlSurfaceId}; },
use std::rc::Rc; std::rc::Rc,
use thiserror::Error; thiserror::Error,
};
#[allow(dead_code)] #[allow(dead_code)]
const ROLE: u32 = 0; const ROLE: u32 = 0;

View file

@ -1,13 +1,15 @@
use crate::client::ClientError; use {
use crate::ifs::wl_seat::WlSeat; crate::{
use crate::leaks::Tracker; client::ClientError,
use crate::object::Object; ifs::wl_seat::WlSeat,
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::Object,
use crate::wire::wl_touch::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::WlTouchId; wire::{wl_touch::*, WlTouchId},
use std::rc::Rc; },
use thiserror::Error; std::rc::Rc,
thiserror::Error,
};
#[allow(dead_code)] #[allow(dead_code)]
const DOWN: u32 = 0; const DOWN: u32 = 0;

View file

@ -1,15 +1,17 @@
use crate::client::{Client, ClientError}; use {
use crate::format::FORMATS; crate::{
use crate::globals::{Global, GlobalName}; client::{Client, ClientError},
use crate::ifs::wl_shm_pool::{WlShmPool, WlShmPoolError}; format::FORMATS,
use crate::leaks::Tracker; globals::{Global, GlobalName},
use crate::object::Object; ifs::wl_shm_pool::{WlShmPool, WlShmPoolError},
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::Object,
use crate::wire::wl_shm::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::WlShmId; wire::{wl_shm::*, WlShmId},
use std::rc::Rc; },
use thiserror::Error; std::rc::Rc,
thiserror::Error,
};
pub struct WlShmGlobal { pub struct WlShmGlobal {
name: GlobalName, name: GlobalName,

View file

@ -1,17 +1,21 @@
use crate::client::{Client, ClientError}; use {
use crate::clientmem::{ClientMem, ClientMemError}; crate::{
use crate::format::{formats, map_wayland_format_id}; client::{Client, ClientError},
use crate::ifs::wl_buffer::{WlBuffer, WlBufferError}; clientmem::{ClientMem, ClientMemError},
use crate::leaks::Tracker; format::{formats, map_wayland_format_id},
use crate::object::Object; ifs::wl_buffer::{WlBuffer, WlBufferError},
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::Object,
use crate::utils::clonecell::CloneCell; utils::{
use crate::wire::wl_shm_pool::*; buffd::{MsgParser, MsgParserError},
use crate::wire::WlShmPoolId; clonecell::CloneCell,
use std::rc::Rc; },
use thiserror::Error; wire::{wl_shm_pool::*, WlShmPoolId},
use uapi::OwnedFd; },
std::rc::Rc,
thiserror::Error,
uapi::OwnedFd,
};
pub struct WlShmPool { pub struct WlShmPool {
id: WlShmPoolId, id: WlShmPoolId,

View file

@ -1,14 +1,16 @@
use crate::client::{Client, ClientError}; use {
use crate::globals::{Global, GlobalName}; crate::{
use crate::ifs::wl_surface::wl_subsurface::{WlSubsurface, WlSubsurfaceError}; client::{Client, ClientError},
use crate::leaks::Tracker; globals::{Global, GlobalName},
use crate::object::Object; ifs::wl_surface::wl_subsurface::{WlSubsurface, WlSubsurfaceError},
use crate::utils::buffd::MsgParser; leaks::Tracker,
use crate::utils::buffd::MsgParserError; object::Object,
use crate::wire::wl_subcompositor::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::WlSubcompositorId; wire::{wl_subcompositor::*, WlSubcompositorId},
use std::rc::Rc; },
use thiserror::Error; std::rc::Rc,
thiserror::Error,
};
#[allow(dead_code)] #[allow(dead_code)]
const BAD_SURFACE: u32 = 0; const BAD_SURFACE: u32 = 0;

View file

@ -4,39 +4,49 @@ pub mod xdg_surface;
pub mod xwindow; pub mod xwindow;
pub mod zwlr_layer_surface_v1; pub mod zwlr_layer_surface_v1;
use crate::backend::{KeyState, ScrollAxis}; use {
use crate::client::{Client, ClientError, RequestParser}; crate::{
use crate::fixed::Fixed; backend::{KeyState, ScrollAxis},
use crate::ifs::wl_buffer::WlBuffer; client::{Client, ClientError, RequestParser},
use crate::ifs::wl_callback::WlCallback; fixed::Fixed,
use crate::ifs::wl_seat::{Dnd, NodeSeatState, SeatId, WlSeatGlobal}; ifs::{
use crate::ifs::wl_surface::cursor::CursorSurface; wl_buffer::WlBuffer,
use crate::ifs::wl_surface::wl_subsurface::WlSubsurface; wl_callback::WlCallback,
use crate::ifs::wl_surface::xdg_surface::XdgSurfaceError; wl_seat::{Dnd, NodeSeatState, SeatId, WlSeatGlobal},
use crate::ifs::wl_surface::zwlr_layer_surface_v1::ZwlrLayerSurfaceV1Error; wl_surface::{
use crate::leaks::Tracker; cursor::CursorSurface, wl_subsurface::WlSubsurface, xdg_surface::XdgSurfaceError,
use crate::object::Object; zwlr_layer_surface_v1::ZwlrLayerSurfaceV1Error,
use crate::rect::{Rect, Region}; },
use crate::render::Renderer; },
use crate::tree::toplevel::ToplevelNode; leaks::Tracker,
use crate::tree::walker::NodeVisitor; object::Object,
use crate::tree::{ContainerNode, ContainerSplit, Node, NodeId, WorkspaceNode}; rect::{Rect, Region},
use crate::utils::buffd::{MsgParser, MsgParserError}; render::Renderer,
use crate::utils::clonecell::CloneCell; tree::{
use crate::utils::linkedlist::LinkedList; ContainerNode, ContainerSplit, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor,
use crate::utils::numcell::NumCell; ToplevelNode, WorkspaceNode,
use crate::utils::smallmap::SmallMap; },
use crate::wire::wl_surface::*; utils::{
use crate::wire::{WlOutputId, WlSurfaceId}; buffd::{MsgParser, MsgParserError},
use crate::xkbcommon::ModifierState; clonecell::CloneCell,
use ahash::AHashMap; linkedlist::LinkedList,
use jay_config::Direction; numcell::NumCell,
use std::cell::{Cell, RefCell}; smallmap::SmallMap,
use std::fmt::{Debug, Formatter}; },
use std::mem; wire::{wl_surface::*, WlOutputId, WlSurfaceId},
use std::ops::{Deref, DerefMut}; xkbcommon::ModifierState,
use std::rc::Rc; },
use thiserror::Error; ahash::AHashMap,
jay_config::Direction,
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},
mem,
ops::{Deref, DerefMut},
rc::Rc,
},
thiserror::Error,
};
#[allow(dead_code)] #[allow(dead_code)]
const INVALID_SCALE: u32 = 0; const INVALID_SCALE: u32 = 0;
@ -365,7 +375,11 @@ impl WlSurface {
} }
*children = None; *children = None;
} }
self.buffer.set(None); if let Some(buffer) = self.buffer.set(None) {
if !buffer.destroyed() {
buffer.send_release();
}
}
self.frame_requests.borrow_mut().clear(); self.frame_requests.borrow_mut().clear();
self.toplevel.set(None); self.toplevel.set(None);
self.client.remove_obj(self)?; self.client.remove_obj(self)?;
@ -558,6 +572,16 @@ impl WlSurface {
} }
None None
} }
fn find_tree_at_(self: &Rc<Self>, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
match self.find_surface_at(x, y) {
Some((node, x, y)) => {
tree.push(FoundNode { node, x, y });
FindTreeResult::AcceptsInput
}
_ => FindTreeResult::Other,
}
}
} }
object_base! { object_base! {

View file

@ -1,11 +1,13 @@
use crate::cursor::Cursor; use {
use crate::ifs::wl_seat::WlSeatGlobal; crate::{
use crate::ifs::wl_surface::WlSurface; cursor::Cursor,
use crate::leaks::Tracker; ifs::{wl_seat::WlSeatGlobal, wl_surface::WlSurface},
use crate::rect::Rect; leaks::Tracker,
use crate::render::Renderer; rect::Rect,
use std::cell::Cell; render::Renderer,
use std::rc::Rc; },
std::{cell::Cell, rc::Rc},
};
pub struct CursorSurface { pub struct CursorSurface {
seat: Rc<WlSeatGlobal>, seat: Rc<WlSeatGlobal>,

View file

@ -1,21 +1,27 @@
use crate::client::ClientError; use {
use crate::ifs::wl_surface::{ crate::{
CommitAction, CommitContext, StackElement, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError, client::ClientError,
WlSurfaceId, ifs::wl_surface::{
CommitAction, CommitContext, StackElement, SurfaceExt, SurfaceRole, WlSurface,
WlSurfaceError, WlSurfaceId,
},
leaks::Tracker,
object::Object,
rect::Rect,
utils::{
buffd::{MsgParser, MsgParserError},
linkedlist::LinkedNode,
numcell::NumCell,
},
wire::{wl_subsurface::*, WlSubsurfaceId},
},
std::{
cell::{Cell, RefCell},
ops::Deref,
rc::Rc,
},
thiserror::Error,
}; };
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::linkedlist::LinkedNode;
use crate::utils::numcell::NumCell;
use crate::wire::wl_subsurface::*;
use crate::wire::WlSubsurfaceId;
use std::cell::{Cell, RefCell};
use std::ops::Deref;
use std::rc::Rc;
use thiserror::Error;
#[allow(dead_code)] #[allow(dead_code)]
const BAD_SURFACE: u32 = 0; const BAD_SURFACE: u32 = 0;

View file

@ -1,29 +1,35 @@
pub mod xdg_popup; pub mod xdg_popup;
pub mod xdg_toplevel; pub mod xdg_toplevel;
use crate::client::ClientError; use {
use crate::ifs::wl_seat::NodeSeatState; crate::{
use crate::ifs::wl_surface::xdg_surface::xdg_popup::{XdgPopup, XdgPopupError}; client::ClientError,
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel; ifs::{
use crate::ifs::wl_surface::{ wl_seat::NodeSeatState,
wl_surface::{
xdg_surface::{
xdg_popup::{XdgPopup, XdgPopupError},
xdg_toplevel::XdgToplevel,
},
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError, CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
},
xdg_wm_base::XdgWmBase,
},
leaks::Tracker,
object::Object,
rect::Rect,
tree::{FindTreeResult, FoundNode, Node, WorkspaceNode},
utils::{
buffd::{MsgParser, MsgParserError},
clonecell::CloneCell,
copyhashmap::CopyHashMap,
numcell::NumCell,
},
wire::{xdg_surface::*, WlSurfaceId, XdgPopupId, XdgSurfaceId},
},
std::{cell::Cell, fmt::Debug, rc::Rc},
thiserror::Error,
}; };
use crate::ifs::xdg_wm_base::XdgWmBase;
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::tree::{FindTreeResult, FoundNode, Node, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::numcell::NumCell;
use crate::wire::xdg_surface::*;
use crate::wire::{WlSurfaceId, XdgPopupId, XdgSurfaceId};
use std::cell::Cell;
use std::fmt::Debug;
use std::rc::Rc;
use thiserror::Error;
#[allow(dead_code)] #[allow(dead_code)]
const NOT_CONSTRUCTED: u32 = 1; const NOT_CONSTRUCTED: u32 = 1;
@ -284,13 +290,7 @@ impl XdgSurface {
x = xt; x = xt;
y = yt; y = yt;
} }
match self.surface.find_surface_at(x, y) { self.surface.find_tree_at_(x, y, tree)
Some((node, x, y)) => {
tree.push(FoundNode { node, x, y });
FindTreeResult::AcceptsInput
}
_ => FindTreeResult::Other,
}
} }
fn update_popup_positions(&self) { fn update_popup_positions(&self) {

View file

@ -1,25 +1,32 @@
use crate::client::{Client, ClientError}; use {
use crate::cursor::KnownCursor; crate::{
use crate::fixed::Fixed; client::{Client, ClientError},
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal}; cursor::KnownCursor,
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt}; fixed::Fixed,
use crate::ifs::xdg_positioner::{XdgPositioned, XdgPositioner, CA}; ifs::{
use crate::leaks::Tracker; wl_seat::{NodeSeatState, WlSeatGlobal},
use crate::object::Object; wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt},
use crate::rect::Rect; xdg_positioner::{XdgPositioned, XdgPositioner, CA},
use crate::render::Renderer; },
use crate::tree::walker::NodeVisitor; leaks::Tracker,
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode}; object::Object,
use crate::utils::buffd::MsgParser; rect::Rect,
use crate::utils::buffd::MsgParserError; render::Renderer,
use crate::utils::clonecell::CloneCell; tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, WorkspaceNode},
use crate::utils::linkedlist::LinkedNode; utils::{
use crate::wire::xdg_popup::*; buffd::{MsgParser, MsgParserError},
use crate::wire::XdgPopupId; clonecell::CloneCell,
use std::cell::{Cell, RefCell}; linkedlist::LinkedNode,
use std::fmt::{Debug, Formatter}; },
use std::rc::Rc; wire::{xdg_popup::*, XdgPopupId},
use thiserror::Error; },
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},
rc::Rc,
},
thiserror::Error,
};
#[allow(dead_code)] #[allow(dead_code)]
const INVALID_GRAB: u32 = 1; const INVALID_GRAB: u32 = 1;

View file

@ -1,33 +1,43 @@
use crate::bugs; use {
use crate::bugs::Bugs; crate::{
use crate::client::{Client, ClientError}; bugs,
use crate::cursor::KnownCursor; bugs::Bugs,
use crate::fixed::Fixed; client::{Client, ClientError},
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal}; cursor::KnownCursor,
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt}; fixed::Fixed,
use crate::ifs::wl_surface::WlSurface; ifs::{
use crate::leaks::Tracker; wl_seat::{NodeSeatState, WlSeatGlobal},
use crate::object::Object; wl_surface::{
use crate::rect::Rect; xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt},
use crate::render::Renderer; WlSurface,
use crate::tree::toplevel::{ToplevelData, ToplevelNode}; },
use crate::tree::walker::NodeVisitor; },
use crate::tree::FindTreeResult; leaks::Tracker,
use crate::tree::{FoundNode, Node, NodeId, ToplevelNodeId, WorkspaceNode}; object::Object,
use crate::utils::buffd::MsgParser; rect::Rect,
use crate::utils::buffd::MsgParserError; render::Renderer,
use crate::utils::clonecell::CloneCell; tree::{
use crate::wire::xdg_toplevel::*; FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
use crate::wire::XdgToplevelId; ToplevelNodeId, WorkspaceNode,
use ahash::{AHashMap, AHashSet}; },
use jay_config::Direction; utils::{
use num_derive::FromPrimitive; buffd::{MsgParser, MsgParserError},
use std::cell::{Cell, RefCell}; clonecell::CloneCell,
use std::fmt::{Debug, Formatter}; },
use std::mem; wire::{xdg_toplevel::*, XdgToplevelId},
use std::ops::Deref; },
use std::rc::Rc; ahash::{AHashMap, AHashSet},
use thiserror::Error; jay_config::Direction,
num_derive::FromPrimitive,
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},
mem,
ops::Deref,
rc::Rc,
},
thiserror::Error,
};
#[derive(Copy, Clone, Debug, FromPrimitive)] #[derive(Copy, Clone, Debug, FromPrimitive)]
pub enum ResizeEdge { pub enum ResizeEdge {

View file

@ -1,28 +1,36 @@
use crate::client::Client; use {
use crate::cursor::KnownCursor; crate::{
use crate::fixed::Fixed; client::Client,
use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal}; cursor::KnownCursor,
use crate::ifs::wl_surface::{SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError}; fixed::Fixed,
use crate::rect::Rect; ifs::{
use crate::render::Renderer; wl_seat::{NodeSeatState, SeatId, WlSeatGlobal},
use crate::state::State; wl_surface::{SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError},
use crate::tree::toplevel::{ToplevelData, ToplevelNode}; },
use crate::tree::walker::NodeVisitor; rect::Rect,
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode}; render::Renderer,
use crate::utils::clonecell::CloneCell; state::State,
use crate::utils::copyhashmap::CopyHashMap; tree::{
use crate::utils::linkedlist::LinkedNode; FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
use crate::utils::queue::AsyncQueue; WorkspaceNode,
use crate::utils::smallmap::SmallMap; },
use crate::wire::WlSurfaceId; utils::{
use crate::wire_xcon::CreateNotify; clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode,
use crate::xwayland::XWaylandEvent; queue::AsyncQueue, smallmap::SmallMap,
use bstr::BString; },
use jay_config::Direction; wire::WlSurfaceId,
use std::cell::{Cell, RefCell}; wire_xcon::CreateNotify,
use std::ops::{Deref, Not}; xwayland::XWaylandEvent,
use std::rc::Rc; },
use thiserror::Error; bstr::BString,
jay_config::Direction,
std::{
cell::{Cell, RefCell},
ops::{Deref, Not},
rc::Rc,
},
thiserror::Error,
};
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum XInputModel { pub enum XInputModel {
@ -275,20 +283,16 @@ impl Xwindow {
self.data.state.tree_changed(); self.data.state.tree_changed();
} }
Change::Map if self.data.info.wants_floating.get() => { Change::Map if self.data.info.wants_floating.get() => {
let ws = self let ws = match self.data.state.root.outputs.lock().values().cloned().next() {
Some(output) => output.ensure_workspace(),
_ => self
.data .data
.state .state
.root .dummy_output
.outputs
.lock()
.iter()
.next()
.unwrap()
.1
.workspace
.get() .get()
.unwrap(); .unwrap()
// todo .ensure_workspace(),
};
let ext = self.data.info.extents.get(); let ext = self.data.info.extents.get();
self.data self.data
.state .state

View file

@ -1,26 +1,29 @@
use crate::client::{Client, ClientError}; use {
use crate::ifs::wl_seat::NodeSeatState; crate::{
use crate::ifs::wl_surface::{ client::{Client, ClientError},
ifs::{
wl_seat::NodeSeatState,
wl_surface::{
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError, CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
},
zwlr_layer_shell_v1::{ZwlrLayerShellV1, OVERLAY},
},
leaks::Tracker,
object::Object,
rect::Rect,
render::Renderer,
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode},
utils::{
bitflags::BitflagsExt,
buffd::{MsgParser, MsgParserError},
linkedlist::LinkedNode,
numcell::NumCell,
},
wire::{zwlr_layer_surface_v1::*, WlSurfaceId, ZwlrLayerSurfaceV1Id},
},
std::{cell::Cell, ops::Deref, rc::Rc},
thiserror::Error,
}; };
use crate::ifs::zwlr_layer_shell_v1::{ZwlrLayerShellV1, OVERLAY};
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::walker::NodeVisitor;
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, OutputNode};
use crate::utils::bitflags::BitflagsExt;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::linkedlist::LinkedNode;
use crate::utils::numcell::NumCell;
use crate::wire::zwlr_layer_surface_v1::*;
use crate::wire::{WlSurfaceId, ZwlrLayerSurfaceV1Id};
use std::cell::Cell;
use std::ops::Deref;
use std::rc::Rc;
use thiserror::Error;
const KI_NONE: u32 = 0; const KI_NONE: u32 = 0;
#[allow(dead_code)] #[allow(dead_code)]
@ -65,6 +68,7 @@ struct Pending {
margin: Cell<Option<(i32, i32, i32, i32)>>, margin: Cell<Option<(i32, i32, i32, i32)>>,
keyboard_interactivity: Cell<Option<u32>>, keyboard_interactivity: Cell<Option<u32>>,
layer: Cell<Option<u32>>, layer: Cell<Option<u32>>,
any: Cell<bool>,
} }
impl ZwlrLayerSurfaceV1 { impl ZwlrLayerSurfaceV1 {
@ -132,6 +136,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending self.pending
.size .size
.set(Some((req.width as _, req.height as _))); .set(Some((req.width as _, req.height as _)));
self.pending.any.set(true);
Ok(()) Ok(())
} }
@ -141,12 +146,14 @@ impl ZwlrLayerSurfaceV1 {
return Err(SetAnchorError::UnknownAnchor(req.anchor)); return Err(SetAnchorError::UnknownAnchor(req.anchor));
} }
self.pending.anchor.set(Some(req.anchor)); self.pending.anchor.set(Some(req.anchor));
self.pending.any.set(true);
Ok(()) Ok(())
} }
fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), SetExclusiveZoneError> { fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), SetExclusiveZoneError> {
let req: SetExclusiveZone = self.client.parse(self, parser)?; let req: SetExclusiveZone = self.client.parse(self, parser)?;
self.pending.exclusive_zone.set(Some(req.zone)); self.pending.exclusive_zone.set(Some(req.zone));
self.pending.any.set(true);
Ok(()) Ok(())
} }
@ -155,6 +162,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending self.pending
.margin .margin
.set(Some((req.top, req.right, req.bottom, req.left))); .set(Some((req.top, req.right, req.bottom, req.left)));
self.pending.any.set(true);
Ok(()) Ok(())
} }
@ -171,6 +179,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending self.pending
.keyboard_interactivity .keyboard_interactivity
.set(Some(req.keyboard_interactivity)); .set(Some(req.keyboard_interactivity));
self.pending.any.set(true);
Ok(()) Ok(())
} }
@ -199,11 +208,12 @@ impl ZwlrLayerSurfaceV1 {
return Err(SetLayerError::UnknownLayer(req.layer)); return Err(SetLayerError::UnknownLayer(req.layer));
} }
self.pending.layer.set(Some(req.layer)); self.pending.layer.set(Some(req.layer));
self.pending.any.set(true);
Ok(()) Ok(())
} }
fn pre_commit(&self) -> Result<(), ZwlrLayerSurfaceV1Error> { fn pre_commit(&self) -> Result<(), ZwlrLayerSurfaceV1Error> {
let mut send_configure = false; let mut send_configure = self.pending.any.replace(false);
if let Some(size) = self.pending.size.take() { if let Some(size) = self.pending.size.take() {
self.size.set(size); self.size.set(size);
} }
@ -370,7 +380,7 @@ impl Node for ZwlrLayerSurfaceV1 {
x, x,
y, y,
}); });
self.surface.find_tree_at(x, y, tree) self.surface.find_tree_at_(x, y, tree)
} }
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) { fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {

View file

@ -1,16 +1,17 @@
use crate::client::{Client, ClientError}; use {
use crate::ifs::xdg_wm_base::XdgWmBase; crate::{
use crate::leaks::Tracker; client::{Client, ClientError},
use crate::object::Object; ifs::xdg_wm_base::XdgWmBase,
use crate::rect::Rect; leaks::Tracker,
use crate::utils::buffd::MsgParser; object::Object,
use crate::utils::buffd::MsgParserError; rect::Rect,
use crate::wire::xdg_positioner::*; utils::buffd::{MsgParser, MsgParserError},
use crate::wire::XdgPositionerId; wire::{xdg_positioner::*, XdgPositionerId},
use bitflags::bitflags; },
use std::cell::RefCell; bitflags::bitflags,
use std::rc::Rc; std::{cell::RefCell, rc::Rc},
use thiserror::Error; thiserror::Error,
};
const INVALID_INPUT: u32 = 0; const INVALID_INPUT: u32 = 0;

Some files were not shown because too many files have changed in this diff Show more