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

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