From fbe848f24dad9cfe32207ce9e812199444449df2 Mon Sep 17 00:00:00 2001 From: lenemter Date: Tue, 3 Dec 2024 19:54:38 +0300 Subject: [PATCH] Fix crash and some visibility issues --- src/HidableWindow.vala | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/src/HidableWindow.vala b/src/HidableWindow.vala index efc28ae22..a55900268 100644 --- a/src/HidableWindow.vala +++ b/src/HidableWindow.vala @@ -35,26 +35,23 @@ public class Gala.HidableWindow : GLib.Object { window.position_changed.connect (on_window_position_changed); } - private void on_window_position_changed (Meta.Window? _window) { - if (_window == null) { - return; - } - - var rect = _window.get_frame_rect (); + private void on_window_position_changed () { + var rect = window.get_frame_rect (); if (rect.x != OUT_OF_BOUNDS) { actual_x = rect.x; Idle.add_once (() => { - unowned var actor = (Meta.WindowActor) _window.get_compositor_private (); + unowned var actor = (Meta.WindowActor) window.get_compositor_private (); if (actor != null) { x = actor.x; } }); } + if (rect.y != OUT_OF_BOUNDS) { actual_y = rect.y; Idle.add_once (() => { - unowned var actor = (Meta.WindowActor) _window.get_compositor_private (); + unowned var actor = (Meta.WindowActor) window.get_compositor_private (); if (actor != null) { y = actor.y; } @@ -63,27 +60,23 @@ public class Gala.HidableWindow : GLib.Object { } public void hide_window () { - if (Meta.Util.is_wayland_compositor ()) { - unowned var actor = (Meta.WindowActor) _window.get_compositor_private (); - if (actor == null) { - return; - } - - actor.visible = false; - } else { + unowned var actor = (Meta.WindowActor) _window.get_compositor_private (); + if (actor != null) { + actor.visible = false;; + } + + if (!Meta.Util.is_wayland_compositor ()) { window.move_frame (false, HidableWindow.OUT_OF_BOUNDS, HidableWindow.OUT_OF_BOUNDS); } } public void show_window () { - if (Meta.Util.is_wayland_compositor ()) { - unowned var actor = (Meta.WindowActor) _window.get_compositor_private (); - if (actor == null) { - return; - } - + unowned var actor = (Meta.WindowActor) _window.get_compositor_private (); + if (actor != null) { actor.visible = true; - } else { + } + + if (!Meta.Util.is_wayland_compositor ()) { window.move_frame (false, actual_x, actual_y); } }