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;
use std::fs::{File, OpenOptions};
use std::io::BufWriter;
use std::path::PathBuf;
use std::{env, io};
use std::{
env,
fs::{File, OpenOptions},
io::{self, BufWriter},
path::PathBuf,
};
mod egl;
mod enums;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,17 +1,26 @@
use jay_config::drm::{get_connector, on_connector_connected, on_new_connector};
use jay_config::embedded::grab_input_device;
use jay_config::input::capability::{CAP_KEYBOARD, CAP_POINTER};
use jay_config::input::{create_seat, input_devices, on_new_input_device, InputDevice, Seat};
use jay_config::keyboard::mods::{Modifiers, ALT, CTRL, SHIFT};
use jay_config::keyboard::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,
use jay_config::{
config,
drm::{get_connector, on_connector_connected, on_new_connector},
embedded::grab_input_device,
get_workspace,
input::{
capability::{CAP_KEYBOARD, CAP_POINTER},
create_seat, input_devices, on_new_input_device, InputDevice, Seat,
},
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;
@ -95,7 +104,7 @@ pub fn configure() {
input_devices().into_iter().for_each(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 right = get_connector("DP-1");
if left.connected() && right.connected() {
@ -103,9 +112,9 @@ pub fn configure() {
right.set_position(left.width(), 0);
}
};
on_new_connector(move |_| connectors_changed());
on_connector_connected(move |_| connectors_changed());
connectors_changed();
on_new_connector(move |_| handle_connectors_changed());
on_connector_connected(move |_| handle_connectors_changed());
handle_connectors_changed();
}
config!(configure);

View file

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

View file

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

View file

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

View file

@ -1,10 +1,13 @@
use crate::drm::connector_type::{
ConnectorType, CON_9PIN_DIN, CON_COMPONENT, CON_COMPOSITE, CON_DISPLAY_PORT, CON_DPI, 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,
use {
crate::drm::connector_type::{
ConnectorType, CON_9PIN_DIN, CON_COMPONENT, CON_COMPOSITE, CON_DISPLAY_PORT, CON_DPI,
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)]
pub struct Mode {

View file

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

View file

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

View file

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

View file

@ -1,7 +1,8 @@
use crate::keyboard::keymap::Keymap;
use crate::keyboard::ModifiedKeySym;
use bincode::{Decode, Encode};
use std::collections::HashMap;
use {
crate::keyboard::{keymap::Keymap, ModifiedKeySym},
bincode::{Decode, Encode},
std::collections::HashMap,
};
#[macro_use]
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 crate::event_loop::{EventLoopDispatcher, EventLoopError, EventLoopId};
use crate::state::State;
use crate::utils::errorfmt::ErrorFmt;
use std::rc::Rc;
use thiserror::Error;
use uapi::{c, format_ustr, Errno, OwnedFd, Ustring};
use {
crate::{
client::ClientError,
event_loop::{EventLoopDispatcher, EventLoopError, EventLoopId},
state::State,
utils::errorfmt::ErrorFmt,
},
std::rc::Rc,
thiserror::Error,
uapi::{c, format_ustr, Errno, OwnedFd, Ustring},
};
#[derive(Debug, Error)]
pub enum AcceptorError {

View file

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

View file

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

View file

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

View file

@ -2,40 +2,50 @@ mod input;
mod monitor;
mod video;
use crate::async_engine::{AsyncError, AsyncFd};
use crate::backend::{
Backend, InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId,
InputEvent, KeyState,
use {
crate::{
async_engine::{AsyncError, AsyncFd},
backend::{
Backend, InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId,
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)]
pub enum MetalError {

View file

@ -1,13 +1,19 @@
use crate::async_engine::FdStatus;
use crate::backend::{InputEvent, KeyState, ScrollAxis};
use crate::backends::metal::MetalBackend;
use crate::libinput::consts::{
LIBINPUT_BUTTON_STATE_PRESSED, LIBINPUT_KEY_STATE_PRESSED,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
use {
crate::{
async_engine::FdStatus,
backend::{InputEvent, KeyState, ScrollAxis},
backends::metal::MetalBackend,
libinput::{
consts::{
LIBINPUT_BUTTON_STATE_PRESSED, LIBINPUT_KEY_STATE_PRESSED,
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 {
($slf:expr, $ev:expr) => {{

View file

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

View file

@ -1,34 +1,40 @@
use crate::async_engine::{AsyncFd, SpawnedFuture};
use crate::backend::{
BackendEvent, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId, MonitorInfo,
use {
crate::{
async_engine::{AsyncFd, SpawnedFuture},
backend::{
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 id: DrmId,

View file

@ -1,49 +1,59 @@
use crate::async_engine::{Phase, SpawnedFuture};
use crate::backend::{
Backend, BackendEvent, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId, InputDevice,
InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, InputEvent, KeyState, Mode,
MonitorInfo, ScrollAxis,
use {
crate::{
async_engine::{Phase, SpawnedFuture},
backend::{
Backend, BackendEvent, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId,
InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, InputEvent,
KeyState, Mode, MonitorInfo, ScrollAxis,
},
video::{
drm::{ConnectorType, Drm, DrmError},
gbm::{GbmDevice, GbmError, GBM_BO_USE_RENDERING},
ModifiedFormat, INVALID_MODIFIER,
},
fixed::Fixed,
format::XRGB8888,
render::{Framebuffer, RenderContext, RenderError},
state::State,
utils::{
clonecell::CloneCell, copyhashmap::CopyHashMap, errorfmt::ErrorFmt, numcell::NumCell,
queue::AsyncQueue, syncqueue::SyncQueue,
},
wire_xcon::{
ChangeProperty, ChangeWindowAttributes, ConfigureNotify, CreateCursor, CreatePixmap,
CreateWindow, CreateWindowValues, DestroyNotify, Dri3Open, Dri3PixmapFromBuffer,
Dri3QueryVersion, Extension, FreePixmap, MapWindow, PresentCompleteNotify,
PresentIdleNotify, PresentPixmap, PresentQueryVersion, PresentSelectInput,
XiButtonPress, XiButtonRelease, XiDeviceInfo, XiEnter, XiEventMask,
XiGetDeviceButtonMapping, XiGrabDevice, XiHierarchy, XiKeyPress, XiKeyRelease,
XiMotion, XiQueryDevice, XiQueryVersion, XiSelectEvents, XiUngrabDevice,
XkbPerClientFlags, XkbUseExtension,
},
xcon::{
consts::{
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, INPUT_DEVICE_ALL_MASTER, INPUT_DEVICE_TYPE_MASTER_KEYBOARD,
INPUT_HIERARCHY_MASK_MASTER_ADDED, INPUT_HIERARCHY_MASK_MASTER_REMOVED,
PRESENT_EVENT_MASK_COMPLETE_NOTIFY, PRESENT_EVENT_MASK_IDLE_NOTIFY,
PROP_MODE_REPLACE, WINDOW_CLASS_INPUT_OUTPUT, XI_EVENT_MASK_BUTTON_PRESS,
XI_EVENT_MASK_BUTTON_RELEASE, XI_EVENT_MASK_ENTER, XI_EVENT_MASK_FOCUS_IN,
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,
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::drm::drm::{ConnectorType, Drm, DrmError};
use crate::drm::gbm::{GbmDevice, GbmError, GBM_BO_USE_RENDERING};
use crate::drm::{ModifiedFormat, INVALID_MODIFIER};
use crate::fixed::Fixed;
use crate::format::XRGB8888;
use crate::render::{Framebuffer, RenderContext, RenderError};
use crate::state::State;
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::numcell::NumCell;
use crate::utils::queue::AsyncQueue;
use crate::utils::syncqueue::SyncQueue;
use crate::wire_xcon::{
ChangeProperty, ChangeWindowAttributes, ConfigureNotify, CreateCursor, CreatePixmap,
CreateWindow, CreateWindowValues, DestroyNotify, Dri3Open, Dri3PixmapFromBuffer,
Dri3QueryVersion, Extension, FreePixmap, MapWindow, PresentCompleteNotify, PresentIdleNotify,
PresentPixmap, PresentQueryVersion, PresentSelectInput, XiButtonPress, XiButtonRelease,
XiDeviceInfo, XiEnter, XiEventMask, XiGetDeviceButtonMapping, XiGrabDevice, XiHierarchy,
XiKeyPress, XiKeyRelease, XiMotion, XiQueryDevice, XiQueryVersion, XiSelectEvents,
XiUngrabDevice, XkbPerClientFlags, XkbUseExtension,
};
use crate::xcon::consts::{
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,
INPUT_DEVICE_ALL_MASTER, INPUT_DEVICE_TYPE_MASTER_KEYBOARD, INPUT_HIERARCHY_MASK_MASTER_ADDED,
INPUT_HIERARCHY_MASK_MASTER_REMOVED, PRESENT_EVENT_MASK_COMPLETE_NOTIFY,
PRESENT_EVENT_MASK_IDLE_NOTIFY, PROP_MODE_REPLACE, WINDOW_CLASS_INPUT_OUTPUT,
XI_EVENT_MASK_BUTTON_PRESS, XI_EVENT_MASK_BUTTON_RELEASE, XI_EVENT_MASK_ENTER,
XI_EVENT_MASK_FOCUS_IN, 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,
XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT,
};
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)]
pub enum XBackendError {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,11 @@
use crate::cli::{GlobalArgs, SetLogArgs};
use crate::tools::tool_client::ToolClient;
use crate::wire::jay_compositor::SetLogLevel;
use std::rc::Rc;
use {
crate::{
cli::{GlobalArgs, SetLogArgs},
tools::tool_client::ToolClient,
wire::jay_compositor::SetLogLevel,
},
std::rc::Rc,
};
pub fn main(global: GlobalArgs, args: SetLogArgs) {
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};
use std::cell::{Cell, RefCell};
use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
use std::mem;
use std::ops::DerefMut;
use std::rc::Rc;
use uapi::{c, OwnedFd};
use {
crate::{
async_engine::{AsyncFd, SpawnedFuture},
client::{error::LookupError, objects::Objects},
ifs::{wl_callback::WlCallback, wl_display::WlDisplay, wl_registry::WlRegistry},
leaks::Tracker,
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 objects;

View file

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

View file

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

View file

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

View file

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

View file

@ -1,37 +1,40 @@
use crate::acceptor::{Acceptor, AcceptorError};
use crate::async_engine::{AsyncEngine, AsyncError, Phase};
use crate::backends::dummy::DummyOutput;
use crate::cli::{GlobalArgs, RunArgs};
use crate::client::Clients;
use crate::clientmem::ClientMemError;
use crate::config::ConfigProxy;
use crate::dbus::Dbus;
use crate::event_loop::{EventLoop, EventLoopError};
use crate::globals::Globals;
use crate::ifs::wl_output::WlOutputGlobal;
use crate::ifs::wl_surface::NoneSurfaceExt;
use crate::logger::Logger;
use crate::render::RenderError;
use crate::sighand::SighandError;
use crate::state::{ConnectorData, State};
use crate::tree::{
container_layout, container_render_data, float_layout, float_titles, DisplayNode, NodeIds,
OutputNode, WorkspaceNode,
use {
crate::{
acceptor::{Acceptor, AcceptorError},
async_engine::{AsyncEngine, AsyncError, Phase},
backend,
backends::dummy::DummyOutput,
cli::{GlobalArgs, RunArgs},
client::Clients,
clientmem::{self, ClientMemError},
config::ConfigProxy,
dbus::Dbus,
event_loop::{EventLoop, EventLoopError},
forker,
globals::Globals,
ifs::{wl_output::WlOutputGlobal, wl_surface::NoneSurfaceExt},
leaks,
logger::Logger,
render::{self, RenderError},
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;
@ -115,6 +118,7 @@ fn main_(forker: Rc<ForkerProxy>, logger: Arc<Logger>, _args: &RunArgs) -> Resul
fdcloser: FdCloser::new(),
logger,
connectors: Default::default(),
outputs: Default::default(),
});
{
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 {
id: state.connector_ids.next(),
}),
monitor_info: Default::default(),
handler: Cell::new(None),
node: Default::default(),
connected: Cell::new(true),
}),
0,

View file

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

View file

@ -1,37 +1,40 @@
use crate::backend;
use crate::backend::{
ConnectorId, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, Mode,
use {
crate::{
backend,
backend::{ConnectorId, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId},
compositor::MAX_EXTENTS,
ifs::wl_seat::{SeatId, WlSeatGlobal},
state::{ConnectorData, DeviceHandlerData, OutputData, State},
tree::{ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase},
utils::{
copyhashmap::CopyHashMap, debug_fn::debug_fn, errorfmt::ErrorFmt, numcell::NumCell,
stack::Stack,
},
xkbcommon::{XkbCommonError, XkbKeymap},
},
bincode::error::DecodeError,
jay_config::{
_private::{
bincode_ops,
ipc::{ClientMessage, Response, ServerMessage},
},
drm::Connector,
input::{
acceleration::{AccelProfile, ACCEL_PROFILE_ADAPTIVE, ACCEL_PROFILE_FLAT},
capability::{
Capability, CAP_GESTURE, CAP_KEYBOARD, CAP_POINTER, CAP_SWITCH, CAP_TABLET_PAD,
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 crate::compositor::MAX_EXTENTS;
use crate::ifs::wl_seat::{SeatId, WlSeatGlobal};
use crate::state::{ConnectorData, DeviceHandlerData, State};
use crate::tree::walker::NodeVisitorBase;
use crate::tree::{ContainerNode, ContainerSplit, FloatNode, Node};
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::debug_fn::debug_fn;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::numcell::NumCell;
use crate::utils::stack::Stack;
use crate::xkbcommon::{XkbCommonError, XkbKeymap};
use bincode::error::DecodeError;
use jay_config::_private::bincode_ops;
use jay_config::_private::ipc::{ClientMessage, Response, ServerMessage};
use jay_config::drm::Connector;
use jay_config::input::acceleration::{AccelProfile, ACCEL_PROFILE_ADAPTIVE, ACCEL_PROFILE_FLAT};
use jay_config::input::capability::{
Capability, CAP_GESTURE, CAP_KEYBOARD, CAP_POINTER, CAP_SWITCH, CAP_TABLET_PAD,
CAP_TABLET_TOOL, CAP_TOUCH,
};
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 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> {
let seats = self.state.globals.seats.lock();
for seat_global in seats.values() {
@ -320,11 +334,8 @@ impl ConfigProxyHandler {
}
fn handle_connector_mode(&self, connector: Connector) -> Result<(), CphError> {
let connector = self.get_connector(connector)?;
let mut mode = Mode::default();
if let Some(node) = connector.node.get() {
mode = node.global.mode.get();
}
let connector = self.get_output(connector)?;
let mode = connector.node.global.mode.get();
self.respond(Response::ConnectorMode {
width: mode.width,
height: mode.height,
@ -339,13 +350,11 @@ impl ConfigProxyHandler {
x: i32,
y: i32,
) -> 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 {
return Err(CphError::InvalidConnectorPosition(x, y));
}
if let Some(node) = connector.node.get() {
node.set_position(x, y);
}
connector.node.set_position(x, y);
Ok(())
}
@ -774,6 +783,8 @@ enum CphError {
DeviceDoesNotExist(InputDevice),
#[error("Connector {0:?} does not exist")]
ConnectorDoesNotExist(Connector),
#[error("Connector {0:?} does not exist or is not connected")]
OutputDoesNotExist(Connector),
#[error("{0}x{1} is not a valid connector position")]
InvalidConnectorPosition(i32, i32),
#[error("Keymap {0:?} does not exist")]

View file

@ -1,22 +1,28 @@
use crate::format::ARGB8888;
use crate::rect::Rect;
use crate::render::{RenderContext, RenderError, Renderer, Texture};
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::numcell::NumCell;
use ahash::AHashSet;
use bstr::{BStr, BString, ByteSlice, ByteVec};
use byteorder::{LittleEndian, ReadBytesExt};
use isnt::std_1::primitive::IsntSliceExt;
use std::cell::Cell;
use std::convert::TryInto;
use std::fmt::{Debug, Formatter};
use std::fs::File;
use std::io::{BufRead, BufReader, Seek, SeekFrom};
use std::mem::MaybeUninit;
use std::rc::Rc;
use std::{env, io, slice, str};
use thiserror::Error;
use uapi::c;
use {
crate::{
format::ARGB8888,
rect::Rect,
render::{RenderContext, RenderError, Renderer, Texture},
utils::{errorfmt::ErrorFmt, numcell::NumCell},
},
ahash::AHashSet,
bstr::{BStr, BString, ByteSlice, ByteVec},
byteorder::{LittleEndian, ReadBytesExt},
isnt::std_1::primitive::IsntSliceExt,
std::{
cell::Cell,
convert::TryInto,
env,
fmt::{Debug, Formatter},
fs::File,
io::{self, BufRead, BufReader, Seek, SeekFrom},
mem::MaybeUninit,
rc::Rc,
slice, str,
},
thiserror::Error,
uapi::c,
};
const XCURSOR_MAGIC: u32 = 0x72756358;
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::*;
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 dynamic_type;
@ -468,11 +478,12 @@ struct InterfaceSignalHandlers {
}
pub mod prelude {
pub use super::{
types::{Bool, DictEntry, ObjectPath, Signature, Variant},
DbusError, DbusType, Formatter, Message, MethodCall, Parser, Property, Signal,
pub use {
super::{
types::{Bool, DictEntry, ObjectPath, Signature, Variant},
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 crate::dbus::outgoing::handle_outgoing;
use crate::dbus::{DbusError, DbusSocket};
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::hex;
use std::io::Write;
use std::rc::Rc;
use uapi::{c, Errno};
use {
crate::{
dbus::{incoming::handle_incoming, outgoing::handle_outgoing, DbusError, DbusSocket},
utils::{errorfmt::ErrorFmt, hex},
},
std::{io::Write, rc::Rc},
uapi::{c, Errno},
};
pub(super) async fn handle_auth(socket: Rc<DbusSocket>) {
let mut auth = Auth {

View file

@ -1,10 +1,11 @@
use super::{
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,
use {
super::{
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,
},
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 {
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 crate::dbus::{DbusType, Formatter};
use std::rc::Rc;
use uapi::{OwnedFd, Packed};
use {
crate::dbus::{types::Variant, DbusType, Formatter},
std::rc::Rc,
uapi::{OwnedFd, Packed},
};
impl<'a> Formatter<'a> {
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 crate::dbus::auth::handle_auth;
use crate::dbus::{DbusError, DbusHolder, DbusSocket};
use crate::utils::bufio::BufIo;
use crate::utils::errorfmt::ErrorFmt;
use crate::utils::numcell::NumCell;
use crate::utils::run_toplevel::RunToplevel;
use crate::wire_dbus::org;
use std::cell::Cell;
use std::rc::Rc;
use uapi::c;
use {
crate::{
async_engine::AsyncEngine,
dbus::{auth::handle_auth, DbusError, DbusHolder, DbusSocket},
utils::{bufio::BufIo, errorfmt::ErrorFmt, numcell::NumCell, run_toplevel::RunToplevel},
wire_dbus::org,
},
std::{cell::Cell, rc::Rc},
uapi::c,
};
impl DbusHolder {
pub(super) fn get(

View file

@ -1,16 +1,21 @@
use super::{
HDR_DESTINATION, HDR_ERROR_NAME, HDR_INTERFACE, HDR_MEMBER, HDR_PATH, HDR_REPLY_SERIAL,
HDR_SENDER, HDR_SIGNATURE, HDR_UNIX_FDS,
use {
super::{
HDR_DESTINATION, HDR_ERROR_NAME, HDR_INTERFACE, HDR_MEMBER, HDR_PATH, HDR_REPLY_SERIAL,
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>) {
let mut incoming = Incoming {

View file

@ -1,6 +1,7 @@
use crate::dbus::DbusSocket;
use crate::utils::errorfmt::ErrorFmt;
use std::rc::Rc;
use {
crate::{dbus::DbusSocket, utils::errorfmt::ErrorFmt},
std::rc::Rc,
};
pub async fn handle_outgoing(socket: Rc<DbusSocket>) {
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 crate::dbus::{DbusError, DbusType, DynamicType, Parser};
use bstr::ByteSlice;
use std::borrow::Cow;
use std::mem;
use std::rc::Rc;
use uapi::{OwnedFd, Pod};
use {
crate::dbus::{
types::{Bool, ObjectPath, Signature, Variant, FALSE, TRUE},
DbusError, DbusType, DynamicType, Parser,
},
bstr::ByteSlice,
std::{borrow::Cow, mem, rc::Rc},
uapi::{OwnedFd, Pod},
};
impl<'a> Parser<'a> {
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 std::borrow::Cow;
use std::marker::PhantomData;
use {
crate::dbus::{DbusError, DbusType, Formatter, Message, MethodCall, Parser},
std::{borrow::Cow, marker::PhantomData},
};
#[derive(Debug)]
pub struct Get<'a, T: DbusType<'static>> {

View file

@ -1,23 +1,23 @@
use crate::dbus::property::Get;
use crate::dbus::types::{ObjectPath, Signature, Variant};
use crate::dbus::{
AsyncProperty, AsyncReply, AsyncReplySlot, DbusError, DbusSocket, DbusType, Formatter, Headers,
InterfaceSignalHandlers, Message, MethodCall, Parser, Property, Reply, 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,
use {
crate::{
dbus::{
property::Get,
types::{ObjectPath, Signature, Variant},
AsyncProperty, AsyncReply, AsyncReplySlot, DbusError, DbusSocket, DbusType, Formatter,
Headers, InterfaceSignalHandlers, Message, MethodCall, Parser, Property, Reply,
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 {
pub(super) fn kill(self: &Rc<Self>) {

View file

@ -1,12 +1,12 @@
use crate::dbus::{
DbusError, DbusType, DynamicType, Formatter, Parser, 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,
use {
crate::dbus::{
DbusError, DbusType, DynamicType, Formatter, Parser, 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,
},
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 {
($s:expr, $ty:expr) => {{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,22 +1,25 @@
use crate::client::{Client, ClientError, ClientId};
use crate::fixed::Fixed;
use crate::ifs::ipc::wl_data_device_manager::WlDataDeviceManager;
use crate::ifs::ipc::wl_data_offer::WlDataOffer;
use crate::ifs::ipc::wl_data_source::WlDataSource;
use crate::ifs::ipc::{
break_device_loops, destroy_device, DeviceData, OfferData, Role, SourceData, Vtable,
use {
crate::{
client::{Client, ClientError, ClientId},
fixed::Fixed,
ifs::{
ipc::{
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)]
const ROLE: u32 = 0;

View file

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

View file

@ -1,19 +1,22 @@
use crate::client::{Client, ClientError};
use crate::ifs::ipc::wl_data_device::WlDataDevice;
use crate::ifs::ipc::wl_data_device_manager::DND_ALL;
use crate::ifs::ipc::{
break_offer_loops, destroy_offer, receive, OfferData, Role, OFFER_STATE_ACCEPTED,
OFFER_STATE_DROPPED, OFFER_STATE_FINISHED, SOURCE_STATE_FINISHED,
use {
crate::{
client::{Client, ClientError},
ifs::ipc::{
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,
},
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)]
const INVALID_FINISH: u32 = 0;

View file

@ -1,21 +1,25 @@
use crate::client::{Client, ClientError};
use crate::ifs::ipc::wl_data_device::WlDataDevice;
use crate::ifs::ipc::wl_data_device_manager::{DND_ALL, DND_NONE};
use crate::ifs::ipc::wl_data_offer::WlDataOffer;
use crate::ifs::ipc::{
add_mime_type, break_source_loops, cancel_offers, destroy_source, SharedState, SourceData,
OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED,
use {
crate::{
client::{Client, ClientError},
ifs::ipc::{
add_mime_type, break_source_loops, cancel_offers, destroy_source,
wl_data_device::WlDataDevice,
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)]
const INVALID_ACTION_MASK: u32 = 0;

View file

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

View file

@ -1,19 +1,28 @@
use crate::client::{Client, ClientError, ClientId};
use crate::ifs::ipc::zwp_primary_selection_device_manager_v1::ZwpPrimarySelectionDeviceManagerV1;
use crate::ifs::ipc::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1;
use crate::ifs::ipc::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1;
use crate::ifs::ipc::{
break_device_loops, destroy_device, DeviceData, OfferData, Role, SourceData, Vtable,
use {
crate::{
client::{Client, ClientError, ClientId},
ifs::{
ipc::{
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 id: ZwpPrimarySelectionDeviceV1Id,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,53 +5,62 @@ pub mod wl_keyboard;
pub mod wl_pointer;
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;
use jay_config::keyboard::mods::Modifiers;
use jay_config::Direction;
use std::cell::{Cell, RefCell};
use std::collections::hash_map::Entry;
use std::mem;
use std::ops::DerefMut;
use std::rc::Rc;
use thiserror::Error;
use uapi::{c, Errno, OwnedFd};
use {
crate::{
async_engine::SpawnedFuture,
client::{Client, ClientError, ClientId},
cursor::{Cursor, KnownCursor},
fixed::Fixed,
globals::{Global, GlobalName},
ifs::{
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 KEYBOARD: u32 = 2;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,21 +1,27 @@
use crate::client::ClientError;
use crate::ifs::wl_surface::{
CommitAction, CommitContext, StackElement, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
WlSurfaceId,
use {
crate::{
client::ClientError,
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)]
const BAD_SURFACE: u32 = 0;

View file

@ -1,29 +1,35 @@
pub mod xdg_popup;
pub mod xdg_toplevel;
use crate::client::ClientError;
use crate::ifs::wl_seat::NodeSeatState;
use crate::ifs::wl_surface::xdg_surface::xdg_popup::{XdgPopup, XdgPopupError};
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel;
use crate::ifs::wl_surface::{
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
use {
crate::{
client::ClientError,
ifs::{
wl_seat::NodeSeatState,
wl_surface::{
xdg_surface::{
xdg_popup::{XdgPopup, XdgPopupError},
xdg_toplevel::XdgToplevel,
},
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)]
const NOT_CONSTRUCTED: u32 = 1;
@ -284,13 +290,7 @@ impl XdgSurface {
x = xt;
y = yt;
}
match self.surface.find_surface_at(x, y) {
Some((node, x, y)) => {
tree.push(FoundNode { node, x, y });
FindTreeResult::AcceptsInput
}
_ => FindTreeResult::Other,
}
self.surface.find_tree_at_(x, y, tree)
}
fn update_popup_positions(&self) {

View file

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

View file

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

View file

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

View file

@ -1,26 +1,29 @@
use crate::client::{Client, ClientError};
use crate::ifs::wl_seat::NodeSeatState;
use crate::ifs::wl_surface::{
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
use {
crate::{
client::{Client, ClientError},
ifs::{
wl_seat::NodeSeatState,
wl_surface::{
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;
#[allow(dead_code)]
@ -65,6 +68,7 @@ struct Pending {
margin: Cell<Option<(i32, i32, i32, i32)>>,
keyboard_interactivity: Cell<Option<u32>>,
layer: Cell<Option<u32>>,
any: Cell<bool>,
}
impl ZwlrLayerSurfaceV1 {
@ -132,6 +136,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending
.size
.set(Some((req.width as _, req.height as _)));
self.pending.any.set(true);
Ok(())
}
@ -141,12 +146,14 @@ impl ZwlrLayerSurfaceV1 {
return Err(SetAnchorError::UnknownAnchor(req.anchor));
}
self.pending.anchor.set(Some(req.anchor));
self.pending.any.set(true);
Ok(())
}
fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), SetExclusiveZoneError> {
let req: SetExclusiveZone = self.client.parse(self, parser)?;
self.pending.exclusive_zone.set(Some(req.zone));
self.pending.any.set(true);
Ok(())
}
@ -155,6 +162,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending
.margin
.set(Some((req.top, req.right, req.bottom, req.left)));
self.pending.any.set(true);
Ok(())
}
@ -171,6 +179,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending
.keyboard_interactivity
.set(Some(req.keyboard_interactivity));
self.pending.any.set(true);
Ok(())
}
@ -199,11 +208,12 @@ impl ZwlrLayerSurfaceV1 {
return Err(SetLayerError::UnknownLayer(req.layer));
}
self.pending.layer.set(Some(req.layer));
self.pending.any.set(true);
Ok(())
}
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() {
self.size.set(size);
}
@ -370,7 +380,7 @@ impl Node for ZwlrLayerSurfaceV1 {
x,
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) {

View file

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

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