Add support for experimental xx_foreign_toplevel_geometry_tracker_v1 (#1)
Co-authored-by: entailz <entail-wraps0r@icloud.com> Reviewed-on: wry/wry#1 Co-authored-by: entailz <entailzwrapped@proton.me> Co-committed-by: entailz <entailzwrapped@proton.me>
This commit is contained in:
parent
4e9b6def83
commit
f056727621
36 changed files with 497 additions and 243 deletions
|
|
@ -5,8 +5,7 @@ use {
|
|||
cursor_user::CursorUser,
|
||||
fixed::Fixed,
|
||||
ifs::wl_seat::{
|
||||
BTN_LEFT, NodeSeatState, SeatId, WlSeatGlobal, collect_kb_foci,
|
||||
collect_kb_foci2,
|
||||
BTN_LEFT, NodeSeatState, SeatId, WlSeatGlobal, collect_kb_foci, collect_kb_foci2,
|
||||
tablet::{TabletTool, TabletToolChanges, TabletToolId},
|
||||
wl_pointer::PendingScroll,
|
||||
},
|
||||
|
|
@ -19,7 +18,9 @@ use {
|
|||
ContainingNode, Direction, FindTreeResult, FindTreeUsecase, FloatNode, FoundNode, Node,
|
||||
NodeId, NodeLayerLink, NodeLocation, OutputNode, TddType, TileDragDestination,
|
||||
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode,
|
||||
default_tile_drag_bounds, tab_bar::{TabBar, TabBarEntry}, toplevel_set_workspace,
|
||||
default_tile_drag_bounds,
|
||||
tab_bar::{TabBar, TabBarEntry},
|
||||
toplevel_set_workspace,
|
||||
walker::NodeVisitor,
|
||||
},
|
||||
utils::{
|
||||
|
|
@ -399,11 +400,7 @@ impl ContainerNode {
|
|||
}
|
||||
ContainerSplit::Vertical => {
|
||||
let spacing = gap.max(bw);
|
||||
let content_h = self
|
||||
.height
|
||||
.get()
|
||||
.sub((nc - 1) * spacing)
|
||||
.max(0);
|
||||
let content_h = self.height.get().sub((nc - 1) * spacing).max(0);
|
||||
(self.width.get(), content_h / nc)
|
||||
}
|
||||
}
|
||||
|
|
@ -478,7 +475,6 @@ impl ContainerNode {
|
|||
self.schedule_compute_render_positions();
|
||||
self.layout_complete.trigger();
|
||||
if self.all_children_match_body() {
|
||||
|
||||
self.all_children_resized.trigger();
|
||||
if self.toplevel_data.visible.get() {
|
||||
self.damage();
|
||||
|
|
@ -574,11 +570,7 @@ impl ContainerNode {
|
|||
}
|
||||
ContainerSplit::Vertical => {
|
||||
let spacing = gap.max(border_width);
|
||||
let new_content_size = self
|
||||
.height
|
||||
.get()
|
||||
.sub((nc - 1) as i32 * spacing)
|
||||
.max(0);
|
||||
let new_content_size = self.height.get().sub((nc - 1) as i32 * spacing).max(0);
|
||||
self.content_height.set(new_content_size);
|
||||
self.content_width.set(self.width.get());
|
||||
}
|
||||
|
|
@ -741,7 +733,8 @@ impl ContainerNode {
|
|||
}
|
||||
}
|
||||
if self.toplevel_data.visible.get() {
|
||||
self.state.damage(Rect::new_sized_saturating(abs_x, abs_y, cwidth, cheight));
|
||||
self.state
|
||||
.damage(Rect::new_sized_saturating(abs_x, abs_y, cwidth, cheight));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -936,7 +929,15 @@ impl ContainerNode {
|
|||
let mono_ref = mono.as_ref().unwrap();
|
||||
let active_id = mono_ref.node.node_id();
|
||||
let height = self.state.theme.sizes.tab_bar_height.get();
|
||||
let render_scale = self.workspace.get().output.get().global.persistent.scale.get();
|
||||
let render_scale = self
|
||||
.workspace
|
||||
.get()
|
||||
.output
|
||||
.get()
|
||||
.global
|
||||
.persistent
|
||||
.scale
|
||||
.get();
|
||||
let mut bar = TabBar::new(height, render_scale);
|
||||
for child in self.children.iter() {
|
||||
let child_id = child.node.node_id();
|
||||
|
|
@ -982,12 +983,7 @@ impl ContainerNode {
|
|||
let was_ephemeral = self.ephemeral.replace(Ephemeral::Off);
|
||||
self.clone().cnode_remove_child2(&*focused_node, true);
|
||||
self.ephemeral.set(was_ephemeral);
|
||||
let sub = ContainerNode::new(
|
||||
&self.state,
|
||||
&self.workspace.get(),
|
||||
focused_node,
|
||||
split,
|
||||
);
|
||||
let sub = ContainerNode::new(&self.state, &self.workspace.get(), focused_node, split);
|
||||
if ephemeral {
|
||||
sub.ephemeral.set(Ephemeral::On);
|
||||
}
|
||||
|
|
@ -1451,8 +1447,7 @@ impl ContainerNode {
|
|||
};
|
||||
break 'res (
|
||||
SeatOpKind::Resize {
|
||||
dist_left: seat_data.x
|
||||
- prev.body.get().x2(),
|
||||
dist_left: seat_data.x - prev.body.get().x2(),
|
||||
dist_right: child.body.get().x1() - seat_data.x,
|
||||
},
|
||||
child,
|
||||
|
|
@ -1465,8 +1460,7 @@ impl ContainerNode {
|
|||
};
|
||||
break 'res (
|
||||
SeatOpKind::Resize {
|
||||
dist_left: seat_data.y
|
||||
- prev.body.get().y2(),
|
||||
dist_left: seat_data.y - prev.body.get().y2(),
|
||||
dist_right: child.body.get().y1() - seat_data.y,
|
||||
},
|
||||
child,
|
||||
|
|
@ -1477,10 +1471,7 @@ impl ContainerNode {
|
|||
}
|
||||
return;
|
||||
};
|
||||
seat_data.op = Some(SeatOp {
|
||||
child,
|
||||
kind,
|
||||
})
|
||||
seat_data.op = Some(SeatOp { child, kind })
|
||||
} else if !pressed {
|
||||
seat_data.op = None;
|
||||
drop(seat_datas);
|
||||
|
|
@ -1694,16 +1685,27 @@ pub async fn container_tab_render_textures(state: Rc<State>) {
|
|||
impl ContainerNode {
|
||||
fn update_tab_textures_phase1(
|
||||
self: &Rc<Self>,
|
||||
) -> (Rc<crate::utils::asyncevent::AsyncEvent>, Vec<Rc<RefCell<Option<TextTexture>>>>) {
|
||||
) -> (
|
||||
Rc<crate::utils::asyncevent::AsyncEvent>,
|
||||
Vec<Rc<RefCell<Option<TextTexture>>>>,
|
||||
) {
|
||||
let on_completed = Rc::new(OnDropEvent::default());
|
||||
let (entries, bar_height, render_scale) = {
|
||||
let tab_bar = self.tab_bar.borrow();
|
||||
let Some(tb) = tab_bar.as_ref() else {
|
||||
return (on_completed.event(), vec![]);
|
||||
};
|
||||
let entries: Vec<_> = tb.entries.iter().map(|e| {
|
||||
(e.title.clone(), TabBar::entry_colors(&self.state, e), e.title_texture.clone())
|
||||
}).collect();
|
||||
let entries: Vec<_> = tb
|
||||
.entries
|
||||
.iter()
|
||||
.map(|e| {
|
||||
(
|
||||
e.title.clone(),
|
||||
TabBar::entry_colors(&self.state, e),
|
||||
e.title_texture.clone(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
(entries, tb.height, tb.render_scale)
|
||||
};
|
||||
let Some(ctx) = self.state.render_ctx.get() else {
|
||||
|
|
@ -1864,7 +1866,6 @@ impl Node for ContainerNode {
|
|||
self.update_child_size(node, width, height);
|
||||
}
|
||||
if self.all_children_match_body() {
|
||||
|
||||
self.all_children_resized.trigger();
|
||||
if self.toplevel_data.visible.get() {
|
||||
self.damage();
|
||||
|
|
@ -2280,12 +2281,8 @@ impl ContainingNode for ContainerNode {
|
|||
ci = 1;
|
||||
}
|
||||
let (new_delta, between) = match split {
|
||||
ContainerSplit::Horizontal => {
|
||||
(self.abs_x1.get(), gap.max(bw))
|
||||
}
|
||||
ContainerSplit::Vertical => {
|
||||
(self.abs_y1.get(), gap.max(bw))
|
||||
}
|
||||
ContainerSplit::Horizontal => (self.abs_x1.get(), gap.max(bw)),
|
||||
ContainerSplit::Vertical => (self.abs_y1.get(), gap.max(bw)),
|
||||
};
|
||||
let new_i1 = new_i1.map(|v| v - new_delta);
|
||||
let new_i2 = new_i2.map(|v| v - new_delta);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue