1
0
Fork 0
forked from wry/wry

config: add documentation

This commit is contained in:
Julian Orth 2022-05-16 18:21:56 +02:00
parent 6916f03e94
commit fe80440f38
36 changed files with 620 additions and 199 deletions

View file

@ -19,9 +19,9 @@ use {
ipc::{InitMessage, ServerMessage, V1InitMessage},
ConfigEntry, VERSION,
},
drm::{Connector, DrmDevice},
input::{InputDevice, Seat},
keyboard::ModifiedKeySym,
video::{Connector, DrmDevice},
},
libloading::Library,
std::{cell::Cell, mem, ptr, rc::Rc},

View file

@ -27,7 +27,6 @@ use {
bincode_ops,
ipc::{ClientMessage, Response, ServerMessage},
},
drm::{Connector, DrmDevice},
input::{
acceleration::{AccelProfile, ACCEL_PROFILE_ADAPTIVE, ACCEL_PROFILE_FLAT},
capability::{
@ -36,9 +35,12 @@ use {
},
InputDevice, Seat,
},
keyboard::{keymap::Keymap, mods::Modifiers, syms::KeySym},
keyboard::{mods::Modifiers, syms::KeySym, Keymap},
logging::LogLevel,
theme::{colors::Colorable, sized::Resizable},
Axis, Direction, LogLevel, Workspace,
timer::Timer as JayTimer,
video::{Connector, DrmDevice},
Axis, Direction, Workspace,
},
libloading::Library,
log::Level,
@ -254,14 +256,14 @@ impl ConfigProxyHandler {
self.state.set_status(status);
}
fn get_timer(&self, timer: jay_config::Timer) -> Result<Rc<TimerData>, CphError> {
fn get_timer(&self, timer: JayTimer) -> Result<Rc<TimerData>, CphError> {
match self.timers_by_id.get(&timer.0) {
Some(t) => Ok(t),
_ => Err(CphError::TimerDoesNotExist(timer)),
}
}
fn handle_remove_timer(&self, timer: jay_config::Timer) -> Result<(), CphError> {
fn handle_remove_timer(&self, timer: JayTimer) -> Result<(), CphError> {
let timer = self.get_timer(timer)?;
self.timers_by_id.remove(&timer.id);
self.timers_by_name.remove(&timer.name);
@ -276,7 +278,7 @@ impl ConfigProxyHandler {
fn handle_program_timer(
&self,
timer: jay_config::Timer,
timer: JayTimer,
initial: Option<Duration>,
periodic: Option<Duration>,
) -> Result<(), CphError> {
@ -289,7 +291,7 @@ impl ConfigProxyHandler {
let name = Rc::new(name.to_owned());
if let Some(t) = self.timers_by_name.get(&name) {
self.respond(Response::GetTimer {
timer: jay_config::Timer(t.id),
timer: JayTimer(t.id),
});
return Ok(());
}
@ -302,7 +304,7 @@ impl ConfigProxyHandler {
loop {
match timer.expired(&slf.state.ring).await {
Ok(_) => slf.send(&ServerMessage::TimerExpired {
timer: jay_config::Timer(id),
timer: JayTimer(id),
}),
Err(e) => {
log::error!("Could not wait for timer expiration: {}", ErrorFmt(e));
@ -324,7 +326,7 @@ impl ConfigProxyHandler {
self.timers_by_name.set(name.clone(), td.clone());
self.timers_by_id.set(id, td.clone());
self.respond(Response::GetTimer {
timer: jay_config::Timer(id),
timer: JayTimer(id),
});
Ok(())
}
@ -337,13 +339,13 @@ impl ConfigProxyHandler {
fn handle_focus(&self, seat: Seat, direction: Direction) -> Result<(), CphError> {
let seat = self.get_seat(seat)?;
seat.move_focus(direction);
seat.move_focus(direction.into());
Ok(())
}
fn handle_move(&self, seat: Seat, direction: Direction) -> Result<(), CphError> {
let seat = self.get_seat(seat)?;
seat.move_focused(direction);
seat.move_focused(direction.into());
Ok(())
}
@ -592,7 +594,7 @@ impl ConfigProxyHandler {
fn handle_get_connector(
&self,
ty: jay_config::drm::connector_type::ConnectorType,
ty: jay_config::video::connector_type::ConnectorType,
idx: u32,
) -> Result<(), CphError> {
let connectors = self.state.connectors.lock();
@ -1101,7 +1103,7 @@ enum CphError {
#[error("Connector {0:?} does not exist")]
ConnectorDoesNotExist(Connector),
#[error("Timer {0:?} does not exist")]
TimerDoesNotExist(jay_config::Timer),
TimerDoesNotExist(JayTimer),
#[error("Connector {0:?} does not exist or is not connected")]
OutputDoesNotExist(Connector),
#[error("{0}x{1} is not a valid connector position")]

View file

@ -40,8 +40,8 @@ use {
object::Object,
state::State,
tree::{
generic_node_visitor, ContainerNode, ContainerSplit, FloatNode, FoundNode, Node,
OutputNode, WorkspaceNode,
generic_node_visitor, ContainerNode, ContainerSplit, Direction, FloatNode, FoundNode,
Node, OutputNode, WorkspaceNode,
},
utils::{
asyncevent::AsyncEvent,
@ -60,7 +60,7 @@ use {
xkbcommon::{XkbKeymap, XkbState},
},
ahash::{AHashMap, AHashSet},
jay_config::{keyboard::mods::Modifiers, Direction},
jay_config::keyboard::mods::Modifiers,
smallvec::SmallVec,
std::{
cell::{Cell, RefCell},

View file

@ -23,15 +23,12 @@ use {
},
wl_surface::{xdg_surface::xdg_popup::XdgPopup, WlSurface},
},
tree::{FloatNode, Node, ToplevelNode},
tree::{Direction, FloatNode, Node, ToplevelNode},
utils::{bitflags::BitflagsExt, clonecell::CloneCell, smallmap::SmallMap},
wire::WlDataOfferId,
xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP},
},
jay_config::{
keyboard::{mods::Modifiers, syms::KeySym, ModifiedKeySym},
Direction,
},
jay_config::keyboard::{mods::Modifiers, syms::KeySym, ModifiedKeySym},
smallvec::SmallVec,
std::rc::Rc,
};

View file

@ -15,8 +15,8 @@ use {
render::Renderer,
state::State,
tree::{
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
ToplevelNodeId, WorkspaceNode,
Direction, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData,
ToplevelNode, ToplevelNodeId, WorkspaceNode,
},
utils::{
buffd::{MsgParser, MsgParserError},
@ -25,7 +25,6 @@ use {
wire::{xdg_toplevel::*, XdgToplevelId},
},
ahash::{AHashMap, AHashSet},
jay_config::Direction,
num_derive::FromPrimitive,
std::{
cell::{Cell, RefCell},

View file

@ -11,8 +11,8 @@ use {
render::Renderer,
state::State,
tree::{
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, StackedNode, ToplevelData,
ToplevelNode,
Direction, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, StackedNode,
ToplevelData, ToplevelNode,
},
utils::{clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode},
wire::WlSurfaceId,
@ -20,7 +20,6 @@ use {
xwayland::XWaylandEvent,
},
bstr::BString,
jay_config::Direction,
std::{
cell::{Cell, RefCell},
ops::{Deref, Not},

View file

@ -13,7 +13,7 @@ use {
ConfigEntry, VERSION,
},
input::{InputDevice, Seat},
keyboard::{keymap::Keymap, ModifiedKeySym},
keyboard::{Keymap, ModifiedKeySym},
Axis, Direction,
},
std::{cell::Cell, ops::Deref, ptr, rc::Rc},

View file

@ -1,5 +1,6 @@
xkb_keymap {
# See the file keycodes.xkb for a full list of keycodes.
xkb_keycodes {
<1> = 9; # ESC

View file

@ -30,8 +30,8 @@ use {
render::RenderContext,
theme::Theme,
tree::{
ContainerNode, ContainerSplit, DisplayNode, FloatNode, Node, NodeIds, NodeVisitorBase,
OutputNode, PlaceholderNode, ToplevelNode, WorkspaceNode,
ContainerNode, ContainerSplit, Direction, DisplayNode, FloatNode, Node, NodeIds,
NodeVisitorBase, OutputNode, PlaceholderNode, ToplevelNode, WorkspaceNode,
},
utils::{
asyncevent::AsyncEvent, clonecell::CloneCell, copyhashmap::CopyHashMap,
@ -43,7 +43,7 @@ use {
xwayland::{self, XWaylandEvent},
},
ahash::AHashMap,
jay_config::{Direction, PciId},
jay_config::PciId,
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},

View file

@ -12,7 +12,7 @@ use {
utils::numcell::NumCell,
xkbcommon::ModifierState,
},
jay_config::Direction,
jay_config::Direction as JayDirection,
std::{
fmt::{Debug, Display},
rc::Rc,
@ -34,6 +34,26 @@ mod toplevel;
mod walker;
mod workspace;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Direction {
Unspecified,
Left,
Down,
Up,
Right,
}
impl From<JayDirection> for Direction {
fn from(d: JayDirection) -> Self {
match d {
JayDirection::Left => Self::Left,
JayDirection::Down => Self::Down,
JayDirection::Up => Self::Up,
JayDirection::Right => Self::Right,
}
}
}
pub struct NodeIds {
next: NumCell<u32>,
}

View file

@ -12,8 +12,8 @@ use {
state::State,
text,
tree::{
walker::NodeVisitor, ContainingNode, FindTreeResult, FoundNode, Node, NodeId,
ToplevelData, ToplevelNode, WorkspaceNode,
walker::NodeVisitor, ContainingNode, Direction, FindTreeResult, FoundNode, Node,
NodeId, ToplevelData, ToplevelNode, WorkspaceNode,
},
utils::{
clonecell::CloneCell,
@ -25,7 +25,7 @@ use {
},
},
ahash::AHashMap,
jay_config::{Axis, Direction},
jay_config::Axis,
smallvec::SmallVec,
std::{
cell::{Cell, RefCell},

View file

@ -12,12 +12,13 @@ use {
render::{Renderer, Texture},
state::State,
text,
tree::{walker::NodeVisitor, FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode},
tree::{
walker::NodeVisitor, Direction, FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode,
},
utils::{
clonecell::CloneCell, errorfmt::ErrorFmt, linkedlist::LinkedList, scroller::Scroller,
},
},
jay_config::Direction,
smallvec::SmallVec,
std::{
cell::{Cell, RefCell},

View file

@ -8,10 +8,12 @@ use {
render::{Renderer, Texture},
state::State,
text,
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode},
tree::{
Direction, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData,
ToplevelNode,
},
utils::{clonecell::CloneCell, errorfmt::ErrorFmt},
},
jay_config::Direction,
std::{cell::Cell, ops::Deref, rc::Rc},
};

View file

@ -4,10 +4,9 @@ use {
ifs::wl_seat::{collect_kb_foci, collect_kb_foci2, NodeSeatState, SeatId},
rect::Rect,
state::State,
tree::{ContainingNode, Node, OutputNode, PlaceholderNode, WorkspaceNode},
tree::{ContainingNode, Direction, Node, OutputNode, PlaceholderNode, WorkspaceNode},
utils::{clonecell::CloneCell, numcell::NumCell, smallmap::SmallMap},
},
jay_config::Direction,
std::{
cell::{Cell, RefCell},
ops::Deref,

View file

@ -5,15 +5,14 @@ use {
rect::Rect,
render::Renderer,
tree::{
container::ContainerNode, walker::NodeVisitor, ContainingNode, FindTreeResult,
FoundNode, Node, NodeId, OutputNode, StackedNode, ToplevelNode,
container::ContainerNode, walker::NodeVisitor, ContainingNode, Direction,
FindTreeResult, FoundNode, Node, NodeId, OutputNode, StackedNode, ToplevelNode,
},
utils::{
clonecell::CloneCell,
linkedlist::{LinkedList, LinkedNode},
},
},
jay_config::Direction,
std::{cell::Cell, fmt::Debug, rc::Rc},
};

View file

@ -803,8 +803,8 @@ impl ConnectorType {
}
}
pub fn to_config(self) -> jay_config::drm::connector_type::ConnectorType {
use jay_config::drm::connector_type::*;
pub fn to_config(self) -> jay_config::video::connector_type::ConnectorType {
use jay_config::video::connector_type::*;
match self {
Self::Unknown(_) => CON_UNKNOWN,
Self::VGA => CON_VGA,