Fix caching of backend object, copy SystemBackground from GNOME magnifier implemenation
This commit is contained in:
parent
529e40a91e
commit
0e02c59340
|
|
@ -70,10 +70,10 @@ index 44b3f5f..fa65a4a 100644
|
|||
}
|
||||
|
||||
diff --git a/gnome-44-max/src/extension.js b/gnome-44-max/src/extension.js
|
||||
index 5f62bfd..d06f91c 100644
|
||||
index 29a38f1..0a7e9ae 100644
|
||||
--- a/gnome-44-max/src/extension.js
|
||||
+++ b/gnome-44-max/src/extension.js
|
||||
@@ -1,19 +1,21 @@
|
||||
@@ -1,20 +1,22 @@
|
||||
-import Clutter from 'gi://Clutter'
|
||||
-import Gio from 'gi://Gio';
|
||||
-import GLib from 'gi://GLib';
|
||||
|
|
@ -85,6 +85,7 @@ index 5f62bfd..d06f91c 100644
|
|||
-import Globals from './globals.js';
|
||||
-import { Logger } from './logger.js';
|
||||
-import { MonitorManager } from './monitormanager.js';
|
||||
-import { SystemBackground } from './systembackground.js';
|
||||
-import { isValidKeepAlive } from './time.js';
|
||||
-import { IPC_FILE_PATH, XREffect } from './xrEffect.js';
|
||||
-
|
||||
|
|
@ -106,12 +107,13 @@ index 5f62bfd..d06f91c 100644
|
|||
+const { CursorManager } = Me.imports.cursormanager;
|
||||
+const { Logger } = Me.imports.logger;
|
||||
+const { MonitorManager } = Me.imports.monitormanager;
|
||||
+const { SystemBackground } = Me.imports.systembackground;
|
||||
+const { isValidKeepAlive } = Me.imports.time;
|
||||
+const { IPC_FILE_PATH, XREffect } = Me.imports.xrEffect;
|
||||
|
||||
const NESTED_MONITOR_PRODUCT = 'MetaMonitor';
|
||||
const SUPPORTED_MONITOR_PRODUCTS = [
|
||||
@@ -29,11 +31,10 @@ const SUPPORTED_MONITOR_PRODUCTS = [
|
||||
@@ -30,11 +32,10 @@ const SUPPORTED_MONITOR_PRODUCTS = [
|
||||
NESTED_MONITOR_PRODUCT
|
||||
];
|
||||
|
||||
|
|
@ -127,7 +129,7 @@ index 5f62bfd..d06f91c 100644
|
|||
|
||||
// Set/destroyed by enable/disable
|
||||
this._cursor_manager = null;
|
||||
@@ -619,6 +620,6 @@ export default class BreezyDesktopExtension extends Extension {
|
||||
@@ -621,6 +622,6 @@ export default class BreezyDesktopExtension extends Extension {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +272,7 @@ index 125954e..c888f94 100644
|
|||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/gnome-44-max/src/monitormanager.js b/gnome-44-max/src/monitormanager.js
|
||||
index ca8a6a5..075ba63 100644
|
||||
index 6cf5532..580925c 100644
|
||||
--- a/gnome-44-max/src/monitormanager.js
|
||||
+++ b/gnome-44-max/src/monitormanager.js
|
||||
@@ -16,12 +16,15 @@
|
||||
|
|
@ -324,6 +326,31 @@ index f70c96d..352be40 100644
|
|||
const file = Gio.file_new_for_path(path);
|
||||
const data = file.load_contents(null);
|
||||
|
||||
diff --git a/gnome-44-max/src/systembackground.js b/gnome-44-max/src/systembackground.js
|
||||
index 23039b9..350f32d 100644
|
||||
--- a/gnome-44-max/src/systembackground.js
|
||||
+++ b/gnome-44-max/src/systembackground.js
|
||||
@@ -1,13 +1,14 @@
|
||||
-import Cogl from 'gi://Cogl';
|
||||
-import GLib from 'gi://GLib';
|
||||
-import GObject from 'gi://GObject';
|
||||
-import Meta from 'gi://Meta';
|
||||
+const Clutter = imports.gi.Clutter;
|
||||
+const Cogl = imports.gi.Cogl;
|
||||
+const GLib = imports.gi.GLib;
|
||||
+const GObject = imports.gi.GObject;
|
||||
+const Meta = imports.gi.Meta;
|
||||
|
||||
-const DEFAULT_BACKGROUND_COLOR = new Cogl.Color({red: 40, green: 40, blue: 40, alpha: 255});
|
||||
+const DEFAULT_BACKGROUND_COLOR = Clutter.Color.from_pixel(0x2e3436ff);
|
||||
|
||||
let _systemBackground;
|
||||
|
||||
-export const SystemBackground = GObject.registerClass({
|
||||
+var SystemBackground = GObject.registerClass({
|
||||
Signals: {'loaded': {}},
|
||||
}, class SystemBackground extends Meta.BackgroundActor {
|
||||
_init() {
|
||||
diff --git a/gnome-44-max/src/time.js b/gnome-44-max/src/time.js
|
||||
index 7883b9b..5478d2a 100644
|
||||
--- a/gnome-44-max/src/time.js
|
||||
|
|
@ -345,7 +372,7 @@ index 7883b9b..5478d2a 100644
|
|||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/gnome-44-max/src/xrEffect.js b/gnome-44-max/src/xrEffect.js
|
||||
index 6b1421b..7d36c46 100644
|
||||
index 8590e0f..4394f43 100644
|
||||
--- a/gnome-44-max/src/xrEffect.js
|
||||
+++ b/gnome-44-max/src/xrEffect.js
|
||||
@@ -1,13 +1,15 @@
|
||||
|
|
@ -401,7 +428,7 @@ index 6b1421b..7d36c46 100644
|
|||
Properties: {
|
||||
'supported-device-detected': GObject.ParamSpec.boolean(
|
||||
'supported-device-detected',
|
||||
@@ -372,8 +374,13 @@ export const XREffect = GObject.registerClass({
|
||||
@@ -380,8 +382,13 @@ export const XREffect = GObject.registerClass({
|
||||
if (!this._initialized) {
|
||||
this.set_uniform_float(this.get_uniform_location('screenTexture'), 1, [0]);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { CursorManager } from './cursormanager.js';
|
|||
import Globals from './globals.js';
|
||||
import { Logger } from './logger.js';
|
||||
import { MonitorManager } from './monitormanager.js';
|
||||
import { SystemBackground } from './systembackground.js';
|
||||
import { isValidKeepAlive } from './time.js';
|
||||
import { IPC_FILE_PATH, XREffect } from './xrEffect.js';
|
||||
|
||||
|
|
@ -250,24 +251,25 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this._cursor_manager = new CursorManager(Main.layoutManager.uiGroup, refreshRate);
|
||||
this._cursor_manager.enable();
|
||||
|
||||
this._overlay = new St.Bin();
|
||||
this._overlay.opacity = 255;
|
||||
const overlayContent = new Clutter.Actor({clip_to_allocation: true});
|
||||
|
||||
this._overlay = new St.Bin({
|
||||
child: overlayContent
|
||||
});
|
||||
this._overlay.set_position(targetMonitor.x, targetMonitor.y);
|
||||
this._overlay.set_size(targetMonitor.width, targetMonitor.height);
|
||||
Globals.logger.log_debug(`BreezyDesktopExtension _effect_enable overlay size: \
|
||||
${targetMonitor.width}x${targetMonitor.height} at ${targetMonitor.x},${targetMonitor.y}`);
|
||||
|
||||
const overlayContent = new Clutter.Actor({clip_to_allocation: true});
|
||||
global.stage.add_child(this._overlay);
|
||||
Shell.util_set_hidden_from_pick(this._overlay, true);
|
||||
|
||||
this._background = new SystemBackground();
|
||||
overlayContent.add_child(this._background);
|
||||
|
||||
const uiClone = new Clutter.Clone({ source: Main.layoutManager.uiGroup, clip_to_allocation: true });
|
||||
uiClone.x = -targetMonitor.x;
|
||||
uiClone.y = -targetMonitor.y;
|
||||
overlayContent.add_child(uiClone);
|
||||
|
||||
this._overlay.set_child(overlayContent);
|
||||
|
||||
Shell.util_set_hidden_from_pick(this._overlay, true);
|
||||
global.stage.add_child(this._overlay);
|
||||
|
||||
// In GS 45, use of "actor" was renamed to "child".
|
||||
const clutterContainer = Clutter.Container !== undefined;
|
||||
this._actor_added_connection = global.stage.connect(
|
||||
|
|
|
|||
|
|
@ -280,7 +280,6 @@ export const MonitorManager = GObject.registerClass({
|
|||
|
||||
this._monitorsChangedConnection = null;
|
||||
this._displayConfigProxy = null;
|
||||
this._backendManager = null;
|
||||
this._monitorProperties = null;
|
||||
this._changeHookFn = null;
|
||||
this._needsConfigCheck = this.use_optimal_monitor_config;
|
||||
|
|
@ -292,7 +291,6 @@ export const MonitorManager = GObject.registerClass({
|
|||
|
||||
enable() {
|
||||
Globals.logger.log_debug('MonitorManager enable');
|
||||
this._backendManager = global.backend.get_monitor_manager();
|
||||
newDisplayConfig(this.extension_path, ((proxy, error) => {
|
||||
if (error) {
|
||||
return;
|
||||
|
|
@ -310,7 +308,6 @@ export const MonitorManager = GObject.registerClass({
|
|||
|
||||
this._monitorsChangedConnection = null;
|
||||
this._displayConfigProxy = null;
|
||||
this._backendManager = null;
|
||||
this._monitorProperties = null;
|
||||
this._changeHookFn = null;
|
||||
}
|
||||
|
|
@ -402,7 +399,7 @@ export const MonitorManager = GObject.registerClass({
|
|||
const monitorProperties = [];
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
const [monitorName, connectorName, vendor, product, serial, refreshRate] = result[i];
|
||||
const monitorIndex = this._backendManager.get_monitor_for_connector(connectorName);
|
||||
const monitorIndex = global.backend.get_monitor_manager().get_monitor_for_connector(connectorName);
|
||||
Globals.logger.log_debug(`Found monitor ${monitorName}, vendor ${vendor}, product ${product}, serial ${serial}, connector ${connectorName}, index ${monitorIndex}`);
|
||||
if (monitorIndex >= 0) {
|
||||
monitorProperties[monitorIndex] = {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
import Cogl from 'gi://Cogl';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
import Meta from 'gi://Meta';
|
||||
|
||||
const DEFAULT_BACKGROUND_COLOR = new Cogl.Color({red: 40, green: 40, blue: 40, alpha: 255});
|
||||
|
||||
let _systemBackground;
|
||||
|
||||
export const SystemBackground = GObject.registerClass({
|
||||
Signals: {'loaded': {}},
|
||||
}, class SystemBackground extends Meta.BackgroundActor {
|
||||
_init() {
|
||||
if (_systemBackground == null) {
|
||||
_systemBackground = new Meta.Background({meta_display: global.display});
|
||||
_systemBackground.set_color(DEFAULT_BACKGROUND_COLOR);
|
||||
}
|
||||
|
||||
super._init({
|
||||
meta_display: global.display,
|
||||
monitor: 0,
|
||||
});
|
||||
this.content.background = _systemBackground;
|
||||
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
this.emit('loaded');
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] SystemBackground.loaded');
|
||||
}
|
||||
});
|
||||
Loading…
Reference in New Issue