From 122112c320e62e52b3f0acc5d03c445c44bd8c4c Mon Sep 17 00:00:00 2001 From: kotontrion Date: Tue, 24 Sep 2024 10:47:14 +0200 Subject: core: add window inhibit property --- core/src/widget/window.vala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'core/src/widget') diff --git a/core/src/widget/window.vala b/core/src/widget/window.vala index 17dc76d..73a4f5d 100644 --- a/core/src/widget/window.vala +++ b/core/src/widget/window.vala @@ -38,6 +38,9 @@ public class Window : Gtk.Window { return false; } + private InhibitManager? inhibit_manager; + private Inhibitor? inhibitor; + construct { if (check("initialize layer shell")) return; @@ -45,6 +48,24 @@ public class Window : Gtk.Window { height_request = 1; width_request = 1; init_for_window(this); + inhibit_manager = InhibitManager.get_default(); + } + + public bool inhibit { + set { + if(inhibit_manager == null) { + return; + } + if(value && inhibitor == null) { + inhibitor = inhibit_manager.inhibit(this); + } + else if(!value && inhibitor != null){ + inhibitor = null; + } + } + get { + return inhibitor != null; + } } public string namespace { -- cgit v1.2.3