From 07dfccaddd284c95c8ee4f514b4ebd0e7429f054 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 21 Jul 2021 08:54:27 -0700 Subject: [PATCH] window: x11: avoid extraneous title updates Avoid setting the title again if it matches the last thing we set; this in turn avoids receiving a property update from the window manager to tell us that we set the title. refs: #964 (but isn't the root cause) --- window/src/os/x11/window.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index 6ebc0254f..0038cc05a 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -62,6 +62,7 @@ pub(crate) struct XWindowInner { copy_and_paste: CopyAndPaste, config: ConfigHandle, appearance: Appearance, + title: String, } impl Drop for XWindowInner { @@ -745,6 +746,7 @@ impl XWindow { let appearance = conn.get_appearance(); Arc::new(Mutex::new(XWindowInner { + title: String::new(), appearance, window_id, conn: Rc::downgrade(&conn), @@ -842,6 +844,10 @@ impl XWindowInner { /// Change the title for the window manager fn set_title(&mut self, title: &str) { + if title == self.title { + return; + } + self.title = title.to_string(); // Ideally, we'd simply call this: // xcb_util::icccm::set_wm_name(self.conn().conn(), self.window_id, title); // However, it uses ATOM_STRING internally, rather than UTF8_STRING