layout: Fix several issues with the background management code
If monitor-changed fires at startup, it will destroy all of the backgrounds, but since this._isStartup is true, won't recreate any of them. Additionally, since _bgManagers is indexed by monitor index, if the primary index is not 0, it could become a sparse array (e.g. [undefined, undefined, primaryBackground]), and our for loop will crash trying to access properties of undefined. Fix both of these issues by always creating background managers for every monitor, hiding them on startup but only showing them after the startup animation is complete. One thing we need to watch out for is that while LayoutManager is constructing, Main.uiGroup / Main.layoutManager will be undefined, so addBackgroundMenu will fail. Fix this by passing down the uiGroup to the background menu code. https://bugzilla.gnome.org/show_bug.cgi?id=709313
This commit is contained in:
@ -13,7 +13,7 @@ const BackgroundMenu = new Lang.Class({
|
||||
Name: 'BackgroundMenu',
|
||||
Extends: PopupMenu.PopupMenu,
|
||||
|
||||
_init: function(source) {
|
||||
_init: function(source, layoutManager) {
|
||||
this.parent(source, 0, St.Side.TOP);
|
||||
|
||||
this.addSettingsAction(_("Settings"), 'gnome-control-center.desktop');
|
||||
@ -22,17 +22,17 @@ const BackgroundMenu = new Lang.Class({
|
||||
|
||||
this.actor.add_style_class_name('background-menu');
|
||||
|
||||
Main.uiGroup.add_actor(this.actor);
|
||||
layoutManager.uiGroup.add_actor(this.actor);
|
||||
this.actor.hide();
|
||||
}
|
||||
});
|
||||
|
||||
function addBackgroundMenu(actor) {
|
||||
function addBackgroundMenu(actor, layoutManager) {
|
||||
let cursor = new St.Bin({ opacity: 0 });
|
||||
Main.uiGroup.add_actor(cursor);
|
||||
layoutManager.uiGroup.add_actor(cursor);
|
||||
|
||||
actor.reactive = true;
|
||||
actor._backgroundMenu = new BackgroundMenu(cursor);
|
||||
actor._backgroundMenu = new BackgroundMenu(cursor, layoutManager);
|
||||
actor._backgroundManager = new PopupMenu.PopupMenuManager({ actor: actor });
|
||||
actor._backgroundManager.addMenu(actor._backgroundMenu);
|
||||
|
||||
|
Reference in New Issue
Block a user