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);
|
||||
|
|
|
|||
|
|
@ -515,12 +515,7 @@ impl FloatNode {
|
|||
let theme = &self.state.theme.sizes;
|
||||
let bw = theme.border_width.get();
|
||||
let pos = self.position.get();
|
||||
let body = Rect::new(
|
||||
pos.x1() + bw,
|
||||
pos.y1() + bw,
|
||||
pos.x2() - bw,
|
||||
pos.y2() - bw,
|
||||
)?;
|
||||
let body = Rect::new(pos.x1() + bw, pos.y1() + bw, pos.x2() - bw, pos.y2() - bw)?;
|
||||
child.tl_tile_drag_destination(source, None, body, abs_x, abs_y)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
use {
|
||||
crate::{
|
||||
scale::Scale,
|
||||
state::State,
|
||||
text::TextTexture,
|
||||
theme::Color,
|
||||
tree::NodeId,
|
||||
crate::{scale::Scale, state::State, text::TextTexture, theme::Color, tree::NodeId},
|
||||
std::{
|
||||
cell::{Cell, RefCell},
|
||||
rc::Rc,
|
||||
},
|
||||
std::{cell::{Cell, RefCell}, rc::Rc},
|
||||
};
|
||||
|
||||
/// A single entry (tab) within a tab bar.
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use {
|
|||
xdg_surface::xdg_toplevel::XdgToplevelToplevelData,
|
||||
},
|
||||
wp_content_type_v1::ContentType,
|
||||
xx_foreign_toplevel_geometry_tracker_v1::XxForeignToplevelGeometryTrackerV1,
|
||||
zwlr_foreign_toplevel_handle_v1::ZwlrForeignToplevelHandleV1,
|
||||
zwlr_foreign_toplevel_manager_v1::ZwlrForeignToplevelManagerV1,
|
||||
},
|
||||
|
|
@ -37,7 +38,7 @@ use {
|
|||
},
|
||||
wire::{
|
||||
ExtForeignToplevelHandleV1Id, ExtImageCopyCaptureSessionV1Id, JayScreencastId,
|
||||
JayToplevelId, ZwlrForeignToplevelHandleV1Id,
|
||||
JayToplevelId, XxForeignToplevelGeometryTrackerV1Id, ZwlrForeignToplevelHandleV1Id,
|
||||
},
|
||||
},
|
||||
jay_config::{window, window::WindowType},
|
||||
|
|
@ -195,7 +196,13 @@ impl<T: ToplevelNodeBase> ToplevelNode for T {
|
|||
data.float_width.set(rect.width());
|
||||
data.float_height.set(rect.height());
|
||||
}
|
||||
self.tl_change_extents_impl(rect)
|
||||
let _ = data;
|
||||
let slf = self.clone();
|
||||
self.tl_change_extents_impl(rect);
|
||||
let data = slf.tl_data();
|
||||
for tracker in data.geometry_trackers.lock().values() {
|
||||
tracker.send_geometry_update(rect, &data.state);
|
||||
}
|
||||
}
|
||||
|
||||
fn tl_set_visible(&self, visible: bool) {
|
||||
|
|
@ -401,6 +408,10 @@ pub struct ToplevelData {
|
|||
pub identifier: Cell<ToplevelIdentifier>,
|
||||
pub handles:
|
||||
CopyHashMap<(ClientId, ExtForeignToplevelHandleV1Id), Rc<ExtForeignToplevelHandleV1>>,
|
||||
pub geometry_trackers: CopyHashMap<
|
||||
(ClientId, XxForeignToplevelGeometryTrackerV1Id),
|
||||
Rc<XxForeignToplevelGeometryTrackerV1>,
|
||||
>,
|
||||
pub manager_handles:
|
||||
CopyHashMap<(ClientId, ZwlrForeignToplevelHandleV1Id), Rc<ZwlrForeignToplevelHandleV1>>,
|
||||
pub render_highlight: NumCell<u32>,
|
||||
|
|
@ -459,6 +470,7 @@ impl ToplevelData {
|
|||
app_id: Default::default(),
|
||||
identifier: Cell::new(id),
|
||||
handles: Default::default(),
|
||||
geometry_trackers: Default::default(),
|
||||
manager_handles: Default::default(),
|
||||
render_highlight: Default::default(),
|
||||
jay_toplevels: Default::default(),
|
||||
|
|
@ -563,6 +575,12 @@ impl ToplevelData {
|
|||
handle.send_closed();
|
||||
}
|
||||
}
|
||||
{
|
||||
let mut trackers = self.geometry_trackers.lock();
|
||||
for tracker in trackers.drain_values() {
|
||||
tracker.send_finished();
|
||||
}
|
||||
}
|
||||
self.detach_node(node);
|
||||
self.property_changed(TL_CHANGED_DESTROYED);
|
||||
}
|
||||
|
|
@ -951,7 +969,6 @@ impl ToplevelData {
|
|||
};
|
||||
parent.node_is_workspace()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Drop for ToplevelData {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue