From 96303542450ea15417f7e92efd811c0561e09854 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sun, 27 Mar 2022 01:36:44 +0100 Subject: [PATCH] autocommit 2022-03-27 01:36:44 CET --- src/ifs/wl_surface/xwindow.rs | 18 +++++++++++++++--- src/xwayland/xwm.rs | 5 +++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/ifs/wl_surface/xwindow.rs b/src/ifs/wl_surface/xwindow.rs index c82cadb0..2655a230 100644 --- a/src/ifs/wl_surface/xwindow.rs +++ b/src/ifs/wl_surface/xwindow.rs @@ -18,6 +18,7 @@ use crate::{AsyncQueue, CloneCell, State}; use bstr::BString; use jay_config::Direction; use std::cell::{Cell, RefCell}; +use std::ops::Deref; use std::rc::Rc; use thiserror::Error; @@ -83,7 +84,7 @@ pub struct XwindowInfo { pub extents: Cell, pub instance: RefCell>, pub class: RefCell>, - pub title: RefCell>, + pub title: RefCell>, pub role: RefCell>, pub protocols: CopyHashMap, pub window_types: CopyHashMap, @@ -174,6 +175,15 @@ impl XwindowData { } } } + + pub fn title_changed(&self) { + let title = self.info.title.borrow_mut(); + if let Some(w) = self.window.get() { + if let Some(p) = w.parent_node.get() { + p.child_title_changed(w.deref(), title.as_deref().unwrap_or("")); + } + } + } } pub enum Change { @@ -265,9 +275,11 @@ impl Xwindow { // todo let ext = self.data.info.extents.get(); self.data.state.map_floating(self.clone(), ext.width(), ext.height(), &ws); + self.data.title_changed(); }, Change::Map => { - self.data.state.map_tiled(self.clone()) + self.data.state.map_tiled(self.clone()); + self.data.title_changed(); }, } } @@ -303,6 +315,7 @@ impl Node for Xwindow { } fn destroy_node(&self, _detach: bool) { + self.toplevel_data.clear(); self.display_xlink.borrow_mut().take(); self.display_link.borrow_mut().take(); self.workspace.take(); @@ -312,7 +325,6 @@ impl Node for Xwindow { } self.surface.destroy_node(false); self.seat_state.destroy_node(self); - self.toplevel_data.clear(); } fn visit(self: Rc, visitor: &mut dyn NodeVisitor) { diff --git a/src/xwayland/xwm.rs b/src/xwayland/xwm.rs index 51960e1c..1062a21a 100644 --- a/src/xwayland/xwm.rs +++ b/src/xwayland/xwm.rs @@ -205,7 +205,7 @@ impl Wm { property: atoms._NET_WM_NAME, ty: atoms.UTF8_STRING, format: 8, - data: "wlroots wm".as_bytes(), + data: "jay wm".as_bytes(), }); c.call(&ChangeProperty { mode: PROP_MODE_REPLACE, @@ -571,7 +571,8 @@ impl Wm { return; } } - *data.info.title.borrow_mut() = Some(buf.into()); + *data.info.title.borrow_mut() = Some(buf.as_bstr().to_string()); + data.title_changed(); } async fn load_window_wm_name(&self, data: &Rc) {