summaryrefslogtreecommitdiff
path: root/core/src/widget/window.vala
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/widget/window.vala')
-rw-r--r--core/src/widget/window.vala28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/src/widget/window.vala b/core/src/widget/window.vala
index 17dc76d..f1a377f 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,31 @@ 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 override void show() {
+ base.show();
+ if(inhibit) {
+ inhibitor = inhibit_manager.inhibit(this);
+ }
}
public string namespace {