autocommit 2022-02-20 22:21:41 CET
This commit is contained in:
parent
292fa50fe7
commit
a8505be462
6 changed files with 54 additions and 53 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::backend::{KeyboardId, MouseId};
|
||||
use crate::ifs::wl_seat::{SeatId, WlSeatGlobal};
|
||||
use crate::state::DeviceHandlerData;
|
||||
use crate::tree::walker::{NodeVisitorBase};
|
||||
use crate::tree::walker::NodeVisitorBase;
|
||||
use crate::tree::{ContainerNode, ContainerSplit, FloatNode, Node};
|
||||
use crate::utils::copyhashmap::CopyHashMap;
|
||||
use crate::utils::debug_fn::debug_fn;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ use crate::ifs::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1Global;
|
|||
use crate::render::RenderError;
|
||||
use crate::sighand::SighandError;
|
||||
use crate::state::State;
|
||||
use crate::tree::{container_layout, container_titles, DisplayNode, float_layout, float_titles, NodeIds};
|
||||
use crate::tree::{
|
||||
container_layout, container_titles, float_layout, float_titles, DisplayNode, NodeIds,
|
||||
};
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
use crate::utils::errorfmt::ErrorFmt;
|
||||
use crate::utils::numcell::NumCell;
|
||||
|
|
@ -169,7 +171,8 @@ fn main_() -> Result<(), MainError> {
|
|||
let _global_event_handler = engine.spawn(tasks::handle_backend_events(state.clone()));
|
||||
let _slow_client_handler = engine.spawn(tasks::handle_slow_clients(state.clone()));
|
||||
let _container_do_layout = engine.spawn2(Phase::Layout, container_layout(state.clone()));
|
||||
let _container_render_titles = engine.spawn2(Phase::PostLayout, container_titles(state.clone()));
|
||||
let _container_render_titles =
|
||||
engine.spawn2(Phase::PostLayout, container_titles(state.clone()));
|
||||
let _float_do_layout = engine.spawn2(Phase::Layout, float_layout(state.clone()));
|
||||
let _float_render_titles = engine.spawn2(Phase::PostLayout, float_titles(state.clone()));
|
||||
let socket_path = Acceptor::install(&state)?;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use crate::render::gl::sys::{
|
|||
use crate::render::renderer::context::RenderContext;
|
||||
use crate::render::sys::{glDisable, glEnable, GL_BLEND};
|
||||
use crate::render::Texture;
|
||||
use crate::theme::Color;
|
||||
use crate::tree::{
|
||||
ContainerFocus, ContainerNode, ContainerSplit, FloatNode, OutputNode, WorkspaceNode,
|
||||
};
|
||||
|
|
@ -20,7 +21,6 @@ use crate::State;
|
|||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use std::slice;
|
||||
use crate::theme::Color;
|
||||
|
||||
const NON_COLOR: Color = Color::from_rgbaf(0.2, 0.2, 0.2, 1.0);
|
||||
const CHILD_COLOR: Color = Color::from_rgbaf(0.8, 0.8, 0.8, 1.0);
|
||||
|
|
@ -366,23 +366,26 @@ impl Renderer<'_> {
|
|||
let uc = theme.underline_color.get();
|
||||
let borders = [
|
||||
Rect::new_sized(x, y, pos.width(), bw).unwrap(),
|
||||
Rect::new_sized(x, y, bw, pos.height()).unwrap(),
|
||||
Rect::new_sized(x + pos.width() - bw, y, bw, pos.height()).unwrap(),
|
||||
Rect::new_sized(x, y + pos.height() - bw, pos.width(), bw).unwrap(),
|
||||
Rect::new_sized(x, y + bw, bw, pos.height() - bw).unwrap(),
|
||||
Rect::new_sized(x + pos.width() - bw, y + bw, bw, pos.height() - bw).unwrap(),
|
||||
Rect::new_sized(x + bw, y + pos.height() - bw, pos.width() - 2 * bw, bw).unwrap(),
|
||||
];
|
||||
self.fill_boxes(&borders, &bc);
|
||||
let title = [
|
||||
Rect::new_sized(x + bw, y + bw, pos.width() - 2 * bw, th).unwrap(),
|
||||
];
|
||||
let title = [Rect::new_sized(x + bw, y + bw, pos.width() - 2 * bw, th).unwrap()];
|
||||
self.fill_boxes(&title, &tc);
|
||||
let title_underline = [
|
||||
Rect::new_sized(x + bw, y + bw + th, pos.width() - 2 * bw, 1).unwrap(),
|
||||
];
|
||||
let title_underline =
|
||||
[Rect::new_sized(x + bw, y + bw + th, pos.width() - 2 * bw, 1).unwrap()];
|
||||
self.fill_boxes(&title_underline, &uc);
|
||||
if let Some(title) = floating.title_texture.get() {
|
||||
self.render_texture(&title, x + bw, y + bw, ARGB8888);
|
||||
}
|
||||
let body = Rect::new_sized(x + bw, y + bw + th + 1, pos.width() - 2 * bw, pos.height() - 2 * bw - th - 1).unwrap();
|
||||
let body = Rect::new_sized(
|
||||
x + bw,
|
||||
y + bw + th + 1,
|
||||
pos.width() - 2 * bw,
|
||||
pos.height() - 2 * bw - th - 1,
|
||||
)
|
||||
.unwrap();
|
||||
unsafe {
|
||||
with_scissor(&body, || {
|
||||
child.render(self, body.x1(), body.y1());
|
||||
|
|
|
|||
|
|
@ -32,12 +32,7 @@ impl Color {
|
|||
}
|
||||
|
||||
pub const fn from_rgbaf(r: f32, g: f32, b: f32, a: f32) -> Self {
|
||||
Self {
|
||||
r,
|
||||
g,
|
||||
b,
|
||||
a,
|
||||
}
|
||||
Self { r, g, b, a }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,16 @@
|
|||
use crate::cursor::KnownCursor;
|
||||
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
|
||||
use crate::rect::Rect;
|
||||
use crate::render::{Renderer, Texture};
|
||||
use crate::theme::Color;
|
||||
use crate::tree::walker::NodeVisitor;
|
||||
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
|
||||
use crate::utils::linkedlist::LinkedNode;
|
||||
use crate::{text, CloneCell, ErrorFmt, State};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use i4config::Direction;
|
||||
use crate::{CloneCell, ErrorFmt, State, text};
|
||||
use crate::backend::{KeyState, ScrollAxis};
|
||||
use crate::client::{Client, ClientId};
|
||||
use crate::cursor::KnownCursor;
|
||||
use crate::fixed::Fixed;
|
||||
use crate::ifs::wl_seat::{Dnd, NodeSeatState, WlSeatGlobal};
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::{Renderer, Texture};
|
||||
use crate::theme::Color;
|
||||
use crate::tree::{ContainerNode, ContainerSplit, FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
|
||||
use crate::tree::walker::NodeVisitor;
|
||||
use crate::utils::linkedlist::LinkedNode;
|
||||
use crate::xkbcommon::ModifierState;
|
||||
|
||||
tree_id!(FloatNodeId);
|
||||
pub struct FloatNode {
|
||||
|
|
@ -55,7 +49,12 @@ pub async fn float_titles(state: Rc<State>) {
|
|||
}
|
||||
|
||||
impl FloatNode {
|
||||
pub fn new(state: &Rc<State>, ws: &Rc<WorkspaceNode>, position: Rect, child: Rc<dyn Node>) -> Rc<Self> {
|
||||
pub fn new(
|
||||
state: &Rc<State>,
|
||||
ws: &Rc<WorkspaceNode>,
|
||||
position: Rect,
|
||||
child: Rc<dyn Node>,
|
||||
) -> Rc<Self> {
|
||||
let floater = Rc::new(FloatNode {
|
||||
id: state.node_ids.next(),
|
||||
state: state.clone(),
|
||||
|
|
@ -112,7 +111,8 @@ impl FloatNode {
|
|||
pos.y1() + bw + th + 1,
|
||||
(pos.width() - 2 * bw).max(0),
|
||||
(pos.height() - 2 * bw - th - 1).max(0),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
child.clone().change_extents(&cpos);
|
||||
self.layout_scheduled.set(false);
|
||||
self.schedule_render_titles();
|
||||
|
|
@ -181,6 +181,15 @@ impl Node for FloatNode {
|
|||
}
|
||||
}
|
||||
|
||||
fn child_title_changed(self: Rc<Self>, _child: &dyn Node, title: &str) {
|
||||
let mut t = self.title.borrow_mut();
|
||||
if t.deref() != title {
|
||||
t.clear();
|
||||
t.push_str(title);
|
||||
self.schedule_render_titles();
|
||||
}
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
self.position.get()
|
||||
}
|
||||
|
|
@ -216,6 +225,10 @@ impl Node for FloatNode {
|
|||
self.workspace_link.set(None);
|
||||
}
|
||||
|
||||
fn child_active_changed(&self, _child: &dyn Node, active: bool) {
|
||||
self.active.set(active);
|
||||
}
|
||||
|
||||
fn pointer_target(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
seat.set_known_cursor(KnownCursor::Default);
|
||||
}
|
||||
|
|
@ -244,17 +257,4 @@ impl Node for FloatNode {
|
|||
.set(Some(ws.stacked.add_last(self.clone())));
|
||||
self.workspace.set(ws.clone());
|
||||
}
|
||||
|
||||
fn child_active_changed(&self, _child: &dyn Node, active: bool) {
|
||||
self.active.set(active);
|
||||
}
|
||||
|
||||
fn child_title_changed(self: Rc<Self>, child: &dyn Node, title: &str) {
|
||||
let mut t = self.title.borrow_mut();
|
||||
if t.deref() != title {
|
||||
t.clear();
|
||||
t.push_str(title);
|
||||
self.schedule_render_titles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,22 +10,22 @@ use crate::render::Renderer;
|
|||
use crate::tree::walker::NodeVisitor;
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
use crate::utils::copyhashmap::CopyHashMap;
|
||||
use crate::utils::linkedlist::{LinkedList};
|
||||
use crate::utils::linkedlist::LinkedList;
|
||||
use crate::xkbcommon::ModifierState;
|
||||
use crate::NumCell;
|
||||
pub use container::*;
|
||||
pub use float::*;
|
||||
use i4config::Direction;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
pub use workspace::*;
|
||||
pub use float::*;
|
||||
|
||||
mod container;
|
||||
mod float;
|
||||
pub mod walker;
|
||||
mod workspace;
|
||||
mod float;
|
||||
|
||||
pub struct NodeIds {
|
||||
next: NumCell<u32>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue