1
0
Fork 0
forked from wry/wry

tree: add TileState

This commit is contained in:
Julian Orth 2026-02-24 20:06:08 +01:00
parent 727a1bc68b
commit c99a2dfafa
6 changed files with 46 additions and 14 deletions

View file

@ -9,7 +9,7 @@ use {
config::handler::ConfigProxyHandler,
ifs::wl_seat::SeatId,
state::State,
tree::ToplevelData,
tree::{TileState, ToplevelData},
utils::{
clonecell::CloneCell,
nice::{JAY_NO_REALTIME, dont_allow_config_so},
@ -29,7 +29,7 @@ use {
input::{InputDevice, Seat, SwitchEvent},
keyboard::{mods::Modifiers, syms::KeySym},
video::{Connector, DrmDevice},
window::{self, TileState},
window::{self},
},
libloading::Library,
std::{cell::Cell, io, mem, path::Path, ptr, rc::Rc},

View file

@ -29,8 +29,9 @@ use {
theme::{Color, ThemeSized},
tree::{
ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase, OutputNode,
TearingMode, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode, toplevel_create_split,
toplevel_parent_container, toplevel_set_floating, toplevel_set_workspace,
TearingMode, TileState, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode,
toplevel_create_split, toplevel_parent_container, toplevel_set_floating,
toplevel_set_workspace,
},
utils::{
asyncevent::AsyncEvent,
@ -72,7 +73,7 @@ use {
Format as ConfigFormat, GfxApi, TearingMode as ConfigTearingMode, Transform,
VrrMode as ConfigVrrMode,
},
window::{TileState, Window, WindowMatcher},
window::{TileState as ConfigTileState, Window, WindowMatcher},
workspace::WorkspaceDisplayOrder,
xwayland::XScalingMode,
},
@ -2289,8 +2290,11 @@ impl ConfigProxyHandler {
fn handle_set_window_matcher_initial_tile_state(
&self,
matcher: WindowMatcher,
tile_state: TileState,
tile_state: ConfigTileState,
) -> Result<(), CphError> {
let Ok(tile_state) = tile_state.try_into() else {
return Err(CphError::UnknownTileState(tile_state));
};
let m = self.get_window_matcher(matcher)?;
self.window_matcher_initial_tile_state
.set(matcher, (m, tile_state));
@ -3542,6 +3546,8 @@ enum CphError {
UnknownGfxApi(GfxApi),
#[error("Unknown fallback output mode {0:?}")]
UnknownFallbackOutputMode(FallbackOutputMode),
#[error("Unknown tile state {0:?}")]
UnknownTileState(ConfigTileState),
}
trait WithRequestName {

View file

@ -13,7 +13,7 @@ use {
tree::{
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, StackedNode, TileDragDestination,
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode,
TileState, ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode,
default_tile_drag_destination,
},
utils::{clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode},
@ -22,7 +22,6 @@ use {
xwayland::XWaylandEvent,
},
bstr::BString,
jay_config::window::TileState,
std::{
cell::{Cell, RefCell},
ops::{Deref, Not},

View file

@ -26,7 +26,7 @@ use {
state::State,
tree::{
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, TileDragDestination,
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, TileDragDestination, TileState,
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelNodeId, ToplevelType,
WorkspaceNode, default_tile_drag_destination,
},
@ -37,7 +37,6 @@ use {
},
ahash::AHashMap,
arrayvec::ArrayVec,
jay_config::window::TileState,
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},

View file

@ -96,8 +96,8 @@ use {
tree::{
ContainerNode, ContainerSplit, Direction, DisplayNode, FindTreeUsecase, FloatNode,
FoundNode, LatchListener, Node, NodeIds, NodeVisitorBase, OutputNode, PlaceholderNode,
TearingMode, ToplevelData, ToplevelNode, ToplevelNodeBase, VrrMode, WorkspaceNode,
WsMoveConfig, generic_node_visitor, move_ws_to_output,
TearingMode, TileState, ToplevelData, ToplevelNode, ToplevelNodeBase, VrrMode,
WorkspaceNode, WsMoveConfig, generic_node_visitor, move_ws_to_output,
},
udmabuf::UdmabufHolder,
utils::{
@ -135,7 +135,7 @@ use {
},
ahash::AHashMap,
bstr::ByteSlice,
jay_config::{PciId, video::Transform, window::TileState, workspace::WorkspaceDisplayOrder},
jay_config::{PciId, video::Transform, workspace::WorkspaceDisplayOrder},
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},

View file

@ -23,7 +23,7 @@ use {
renderer::Renderer,
utils::{linkedlist::NodeRef, numcell::NumCell},
},
jay_config::Direction as JayDirection,
jay_config::{Direction as JayDirection, window::TileState as ConfigTileState},
linearize::{Linearize, LinearizeExt},
std::{
fmt::{Debug, Display},
@ -46,6 +46,34 @@ mod toplevel;
mod walker;
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)]
pub enum Direction {
Unspecified,