tree: add TileState
This commit is contained in:
parent
727a1bc68b
commit
c99a2dfafa
6 changed files with 46 additions and 14 deletions
|
|
@ -9,7 +9,7 @@ use {
|
||||||
config::handler::ConfigProxyHandler,
|
config::handler::ConfigProxyHandler,
|
||||||
ifs::wl_seat::SeatId,
|
ifs::wl_seat::SeatId,
|
||||||
state::State,
|
state::State,
|
||||||
tree::ToplevelData,
|
tree::{TileState, ToplevelData},
|
||||||
utils::{
|
utils::{
|
||||||
clonecell::CloneCell,
|
clonecell::CloneCell,
|
||||||
nice::{JAY_NO_REALTIME, dont_allow_config_so},
|
nice::{JAY_NO_REALTIME, dont_allow_config_so},
|
||||||
|
|
@ -29,7 +29,7 @@ use {
|
||||||
input::{InputDevice, Seat, SwitchEvent},
|
input::{InputDevice, Seat, SwitchEvent},
|
||||||
keyboard::{mods::Modifiers, syms::KeySym},
|
keyboard::{mods::Modifiers, syms::KeySym},
|
||||||
video::{Connector, DrmDevice},
|
video::{Connector, DrmDevice},
|
||||||
window::{self, TileState},
|
window::{self},
|
||||||
},
|
},
|
||||||
libloading::Library,
|
libloading::Library,
|
||||||
std::{cell::Cell, io, mem, path::Path, ptr, rc::Rc},
|
std::{cell::Cell, io, mem, path::Path, ptr, rc::Rc},
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,9 @@ use {
|
||||||
theme::{Color, ThemeSized},
|
theme::{Color, ThemeSized},
|
||||||
tree::{
|
tree::{
|
||||||
ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase, OutputNode,
|
ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase, OutputNode,
|
||||||
TearingMode, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode, toplevel_create_split,
|
TearingMode, TileState, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode,
|
||||||
toplevel_parent_container, toplevel_set_floating, toplevel_set_workspace,
|
toplevel_create_split, toplevel_parent_container, toplevel_set_floating,
|
||||||
|
toplevel_set_workspace,
|
||||||
},
|
},
|
||||||
utils::{
|
utils::{
|
||||||
asyncevent::AsyncEvent,
|
asyncevent::AsyncEvent,
|
||||||
|
|
@ -72,7 +73,7 @@ use {
|
||||||
Format as ConfigFormat, GfxApi, TearingMode as ConfigTearingMode, Transform,
|
Format as ConfigFormat, GfxApi, TearingMode as ConfigTearingMode, Transform,
|
||||||
VrrMode as ConfigVrrMode,
|
VrrMode as ConfigVrrMode,
|
||||||
},
|
},
|
||||||
window::{TileState, Window, WindowMatcher},
|
window::{TileState as ConfigTileState, Window, WindowMatcher},
|
||||||
workspace::WorkspaceDisplayOrder,
|
workspace::WorkspaceDisplayOrder,
|
||||||
xwayland::XScalingMode,
|
xwayland::XScalingMode,
|
||||||
},
|
},
|
||||||
|
|
@ -2289,8 +2290,11 @@ impl ConfigProxyHandler {
|
||||||
fn handle_set_window_matcher_initial_tile_state(
|
fn handle_set_window_matcher_initial_tile_state(
|
||||||
&self,
|
&self,
|
||||||
matcher: WindowMatcher,
|
matcher: WindowMatcher,
|
||||||
tile_state: TileState,
|
tile_state: ConfigTileState,
|
||||||
) -> Result<(), CphError> {
|
) -> Result<(), CphError> {
|
||||||
|
let Ok(tile_state) = tile_state.try_into() else {
|
||||||
|
return Err(CphError::UnknownTileState(tile_state));
|
||||||
|
};
|
||||||
let m = self.get_window_matcher(matcher)?;
|
let m = self.get_window_matcher(matcher)?;
|
||||||
self.window_matcher_initial_tile_state
|
self.window_matcher_initial_tile_state
|
||||||
.set(matcher, (m, tile_state));
|
.set(matcher, (m, tile_state));
|
||||||
|
|
@ -3542,6 +3546,8 @@ enum CphError {
|
||||||
UnknownGfxApi(GfxApi),
|
UnknownGfxApi(GfxApi),
|
||||||
#[error("Unknown fallback output mode {0:?}")]
|
#[error("Unknown fallback output mode {0:?}")]
|
||||||
UnknownFallbackOutputMode(FallbackOutputMode),
|
UnknownFallbackOutputMode(FallbackOutputMode),
|
||||||
|
#[error("Unknown tile state {0:?}")]
|
||||||
|
UnknownTileState(ConfigTileState),
|
||||||
}
|
}
|
||||||
|
|
||||||
trait WithRequestName {
|
trait WithRequestName {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use {
|
||||||
tree::{
|
tree::{
|
||||||
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
|
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
|
||||||
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, StackedNode, TileDragDestination,
|
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, StackedNode, TileDragDestination,
|
||||||
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode,
|
TileState, ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode,
|
||||||
default_tile_drag_destination,
|
default_tile_drag_destination,
|
||||||
},
|
},
|
||||||
utils::{clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode},
|
utils::{clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode},
|
||||||
|
|
@ -22,7 +22,6 @@ use {
|
||||||
xwayland::XWaylandEvent,
|
xwayland::XWaylandEvent,
|
||||||
},
|
},
|
||||||
bstr::BString,
|
bstr::BString,
|
||||||
jay_config::window::TileState,
|
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
ops::{Deref, Not},
|
ops::{Deref, Not},
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use {
|
||||||
state::State,
|
state::State,
|
||||||
tree::{
|
tree::{
|
||||||
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
|
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
|
||||||
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, TileDragDestination,
|
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, TileDragDestination, TileState,
|
||||||
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelNodeId, ToplevelType,
|
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelNodeId, ToplevelType,
|
||||||
WorkspaceNode, default_tile_drag_destination,
|
WorkspaceNode, default_tile_drag_destination,
|
||||||
},
|
},
|
||||||
|
|
@ -37,7 +37,6 @@ use {
|
||||||
},
|
},
|
||||||
ahash::AHashMap,
|
ahash::AHashMap,
|
||||||
arrayvec::ArrayVec,
|
arrayvec::ArrayVec,
|
||||||
jay_config::window::TileState,
|
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
fmt::{Debug, Formatter},
|
fmt::{Debug, Formatter},
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,8 @@ use {
|
||||||
tree::{
|
tree::{
|
||||||
ContainerNode, ContainerSplit, Direction, DisplayNode, FindTreeUsecase, FloatNode,
|
ContainerNode, ContainerSplit, Direction, DisplayNode, FindTreeUsecase, FloatNode,
|
||||||
FoundNode, LatchListener, Node, NodeIds, NodeVisitorBase, OutputNode, PlaceholderNode,
|
FoundNode, LatchListener, Node, NodeIds, NodeVisitorBase, OutputNode, PlaceholderNode,
|
||||||
TearingMode, ToplevelData, ToplevelNode, ToplevelNodeBase, VrrMode, WorkspaceNode,
|
TearingMode, TileState, ToplevelData, ToplevelNode, ToplevelNodeBase, VrrMode,
|
||||||
WsMoveConfig, generic_node_visitor, move_ws_to_output,
|
WorkspaceNode, WsMoveConfig, generic_node_visitor, move_ws_to_output,
|
||||||
},
|
},
|
||||||
udmabuf::UdmabufHolder,
|
udmabuf::UdmabufHolder,
|
||||||
utils::{
|
utils::{
|
||||||
|
|
@ -135,7 +135,7 @@ use {
|
||||||
},
|
},
|
||||||
ahash::AHashMap,
|
ahash::AHashMap,
|
||||||
bstr::ByteSlice,
|
bstr::ByteSlice,
|
||||||
jay_config::{PciId, video::Transform, window::TileState, workspace::WorkspaceDisplayOrder},
|
jay_config::{PciId, video::Transform, workspace::WorkspaceDisplayOrder},
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
fmt::{Debug, Formatter},
|
fmt::{Debug, Formatter},
|
||||||
|
|
|
||||||
30
src/tree.rs
30
src/tree.rs
|
|
@ -23,7 +23,7 @@ use {
|
||||||
renderer::Renderer,
|
renderer::Renderer,
|
||||||
utils::{linkedlist::NodeRef, numcell::NumCell},
|
utils::{linkedlist::NodeRef, numcell::NumCell},
|
||||||
},
|
},
|
||||||
jay_config::Direction as JayDirection,
|
jay_config::{Direction as JayDirection, window::TileState as ConfigTileState},
|
||||||
linearize::{Linearize, LinearizeExt},
|
linearize::{Linearize, LinearizeExt},
|
||||||
std::{
|
std::{
|
||||||
fmt::{Debug, Display},
|
fmt::{Debug, Display},
|
||||||
|
|
@ -46,6 +46,34 @@ mod toplevel;
|
||||||
mod walker;
|
mod walker;
|
||||||
mod workspace;
|
mod workspace;
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Linearize)]
|
||||||
|
pub enum TileState {
|
||||||
|
Tiled,
|
||||||
|
Floating,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFrom<ConfigTileState> for TileState {
|
||||||
|
type Error = ();
|
||||||
|
|
||||||
|
fn try_from(value: ConfigTileState) -> Result<Self, Self::Error> {
|
||||||
|
let v = match value {
|
||||||
|
ConfigTileState::Tiled => TileState::Tiled,
|
||||||
|
ConfigTileState::Floating => TileState::Floating,
|
||||||
|
_ => return Err(()),
|
||||||
|
};
|
||||||
|
Ok(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<ConfigTileState> for TileState {
|
||||||
|
fn into(self) -> ConfigTileState {
|
||||||
|
match self {
|
||||||
|
TileState::Tiled => ConfigTileState::Tiled,
|
||||||
|
TileState::Floating => ConfigTileState::Floating,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
pub enum Direction {
|
pub enum Direction {
|
||||||
Unspecified,
|
Unspecified,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue