Blame SOURCES/0001-classification-banner-Handle-fullscreen-monitors.patch

77f9b1
From ffba821e1142c3cb96b9ced24dd1f161f0609d2a Mon Sep 17 00:00:00 2001
77f9b1
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
77f9b1
Date: Wed, 14 Dec 2022 16:55:51 +0100
77f9b1
Subject: [PATCH] classification-banner: Handle fullscreen monitors
77f9b1
77f9b1
When a monitor is in fullscreen, we don't want its classification
77f9b1
banner to be offset by an imaginary panel, but at the top of the
77f9b1
screen.
77f9b1
---
77f9b1
 extensions/classification-banner/extension.js | 22 +++++++++++++++----
77f9b1
 1 file changed, 18 insertions(+), 4 deletions(-)
77f9b1
77f9b1
diff --git a/extensions/classification-banner/extension.js b/extensions/classification-banner/extension.js
77f9b1
index cc046e01..ea788022 100644
77f9b1
--- a/extensions/classification-banner/extension.js
77f9b1
+++ b/extensions/classification-banner/extension.js
77f9b1
@@ -27,16 +27,19 @@ const Main = imports.ui.main;
77f9b1
 const ClassificationBanner = GObject.registerClass(
77f9b1
 class ClassificationBanner extends Clutter.Actor {
77f9b1
     _init(index) {
77f9b1
+        const constraint = new Layout.MonitorConstraint({index});
77f9b1
         super._init({
77f9b1
             layout_manager: new Clutter.BinLayout(),
77f9b1
-            constraints: new Layout.MonitorConstraint({
77f9b1
-                work_area: true,
77f9b1
-                index,
77f9b1
-            }),
77f9b1
+            constraints: constraint,
77f9b1
         });
77f9b1
+        this._monitorConstraint = constraint;
77f9b1
 
77f9b1
         this._settings = ExtensionUtils.getSettings();
77f9b1
         this.connect('destroy', () => {
77f9b1
+            if (this._fullscreenChangedId)
77f9b1
+                global.display.disconnect(this._fullscreenChangedId);
77f9b1
+            delete this._fullscreenChangedId;
77f9b1
+
77f9b1
             this._settings?.run_dispose();
77f9b1
             this._settings = null;
77f9b1
         });
77f9b1
@@ -94,6 +97,11 @@ class ClassificationBanner extends Clutter.Actor {
77f9b1
             userLabel, 'visible',
77f9b1
             Gio.SettingsBindFlags.GET);
77f9b1
 
77f9b1
+        this._fullscreenChangedId =
77f9b1
+            global.display.connect('in-fullscreen-changed',
77f9b1
+                () => this._updateMonitorConstraint());
77f9b1
+        this._updateMonitorConstraint();
77f9b1
+
77f9b1
         this._settings.connect('changed::color',
77f9b1
             () => this._updateStyles());
77f9b1
         this._settings.connect('changed::background-color',
77f9b1
@@ -110,6 +118,12 @@ class ClassificationBanner extends Clutter.Actor {
77f9b1
         return `${key}: rgba(${red},${green},${blue},${alpha / 255});`;
77f9b1
     }
77f9b1
 
77f9b1
+    _updateMonitorConstraint() {
77f9b1
+        const {index} = this._monitorConstraint;
77f9b1
+        this._monitorConstraint.work_area =
77f9b1
+            !global.display.get_monitor_in_fullscreen(index);
77f9b1
+    }
77f9b1
+
77f9b1
     _updateStyles() {
77f9b1
         const bgStyle = this._getColorSetting('background-color');
77f9b1
         const fgStyle = this._getColorSetting('color');
77f9b1
-- 
77f9b1
2.38.1
77f9b1