From 71670bad3b63d63f058c2b3225e6403838585fae Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 15 Feb 2013 02:05:53 -0500 Subject: [PATCH] layout: Add different groups in the LayoutManager for discrete UI components This helps take cruft out of the uiGroup, and ensures that components remain stacked properly on top of each other. In the future, we'll use this group to ensure that grabs are ordered properly, as well. --- js/gdm/loginDialog.js | 2 +- js/ui/appDisplay.js | 2 +- js/ui/backgroundMenu.js | 2 +- js/ui/layout.js | 12 ++++++++++++ js/ui/messageTray.js | 2 +- js/ui/modalDialog.js | 2 +- js/ui/osdWindow.js | 2 +- js/ui/panelMenu.js | 2 +- js/ui/screenshot.js | 8 ++++---- js/ui/shellEntry.js | 2 +- js/ui/switcherPopup.js | 2 +- js/ui/workspaceSwitcherPopup.js | 2 +- 12 files changed, 26 insertions(+), 14 deletions(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 7810b03e4..a9e6f2ce2 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -274,7 +274,7 @@ const SessionMenuButton = new Lang.Class({ this.actor = new St.Bin({ child: this._button }); this._menu = new PopupMenu.PopupMenu(this._button, 0, St.Side.TOP); - Main.uiGroup.add_actor(this._menu.actor); + Main.layoutManager.menuGroup.add_actor(this._menu.actor); this._menu.actor.hide(); this._menu.connect('open-state-changed', diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index f23d054ad..4935bf03c 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -1525,7 +1525,7 @@ const AppIconMenu = new Lang.Class({ })); source.actor.connect('destroy', Lang.bind(this, function () { this.actor.destroy(); })); - Main.uiGroup.add_actor(this.actor); + Main.layoutManager.menuGroup.add_actor(this.actor); }, _redisplay: function() { diff --git a/js/ui/backgroundMenu.js b/js/ui/backgroundMenu.js index 71251e5bb..6a7495b8b 100644 --- a/js/ui/backgroundMenu.js +++ b/js/ui/backgroundMenu.js @@ -22,7 +22,7 @@ const BackgroundMenu = new Lang.Class({ this.actor.add_style_class_name('background-menu'); - layoutManager.uiGroup.add_actor(this.actor); + layoutManager.menuGroup.add_actor(this.actor); this.actor.hide(); } }); diff --git a/js/ui/layout.js b/js/ui/layout.js index 0609ff2e0..c34050622 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -219,6 +219,18 @@ const LayoutManager = new Lang.Class({ this.addChrome(this.keyboardBox); this._keyboardHeightNotifyId = 0; + this.menuGroup = new St.Widget(); + this.uiGroup.add_actor(this.menuGroup); + + this.osdGroup = new St.Widget(); + this.uiGroup.add_actor(this.osdGroup); + + this.switcherPopupGroup = new St.Widget(); + this.uiGroup.add_actor(this.switcherPopupGroup); + + this.dialogGroup = new St.Widget(); + this.uiGroup.add_actor(this.dialogGroup); + // A dummy actor that tracks the mouse or text cursor, based on the // position set in setDummyCursorPosition. this.dummyCursor = new St.Widget({ width: 0, height: 0 }); diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 53e838eb4..03f8db074 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -1611,7 +1611,7 @@ const MessageTrayMenu = new Lang.Class({ this._accountManager.prepare_async(null, Lang.bind(this, this._onIMPresenceChanged)); this.actor.hide(); - Main.layoutManager.addChrome(this.actor); + Main.layoutManager.menuGroup.add_child(this.actor); this._busyItem = new PopupMenu.PopupSwitchMenuItem(_("Notifications")); this._busyItem.connect('toggled', Lang.bind(this, this._updatePresence)); diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index 366e42530..38cba6a3f 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -41,7 +41,7 @@ const ModalDialog = new Lang.Class({ _init: function(params) { params = Params.parse(params, { shellReactive: false, styleClass: null, - parentActor: Main.uiGroup, + parentActor: Main.layoutManager.dialogGroup, keybindingMode: Shell.KeyBindingMode.SYSTEM_MODAL, shouldFadeIn: true, destroyOnClose: true }); diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js index 1d10f800a..3d427dab9 100644 --- a/js/ui/osdWindow.js +++ b/js/ui/osdWindow.js @@ -110,7 +110,7 @@ const OsdWindow = new Lang.Class({ Lang.bind(this, this._monitorsChanged)); this._monitorsChanged(); - Main.uiGroup.add_child(this.actor); + Main.layoutManager.osdGroup.add_child(this.actor); }, setIcon: function(icon) { diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index 9bb1f1bc4..c1bd0ea89 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -130,7 +130,7 @@ const Button = new Lang.Class({ this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged)); this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress)); - Main.uiGroup.add_actor(this.menu.actor); + Main.layoutManager.menuGroup.add_actor(this.menu.actor); this.menu.actor.hide(); } }, diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 432a39d5e..5daf6679c 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -146,7 +146,7 @@ const SelectArea = new Lang.Class({ reactive: true, x: 0, y: 0 }); - Main.uiGroup.add_actor(this._group); + Main.layoutManager.osdGroup.add_actor(this._group); this._group.connect('button-press-event', Lang.bind(this, this._onButtonPress)); @@ -259,9 +259,9 @@ const Flashspot = new Lang.Class({ Extends: Lightbox.Lightbox, _init: function(area) { - this.parent(Main.uiGroup, { inhibitEvents: true, - width: area.width, - height: area.height }); + this.parent(Main.layoutManager.osdGroup, { inhibitEvents: true, + width: area.width, + height: area.height }); this.actor.style_class = 'flashspot'; this.actor.set_position(area.x, area.y); diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js index 055e3c5fa..d4f43dfd0 100644 --- a/js/ui/shellEntry.js +++ b/js/ui/shellEntry.js @@ -36,7 +36,7 @@ const EntryMenu = new Lang.Class({ this._passwordItem = null; - Main.uiGroup.add_actor(this.actor); + Main.layoutManager.menuGroup.add_actor(this.actor); this.actor.hide(); }, diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index 176bc6aba..bec6836c7 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -54,7 +54,7 @@ const SwitcherPopup = new Lang.Class({ this.actor.connect('allocate', Lang.bind(this, this._allocate)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); - Main.uiGroup.add_actor(this.actor); + Main.layoutManager.switcherPopupGroup.add_child(this.actor); this._haveModal = false; this._modifierMask = 0; diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js index cf3042192..298499ab9 100644 --- a/js/ui/workspaceSwitcherPopup.js +++ b/js/ui/workspaceSwitcherPopup.js @@ -25,7 +25,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({ width: global.screen_width, height: global.screen_height, style_class: 'workspace-switcher-group' }); - Main.uiGroup.add_actor(this.actor); + Main.layoutManager.osdGroup.add_child(this.actor); this._container = new St.BoxLayout({ style_class: 'workspace-switcher-container' }); this._list = new Shell.GenericContainer({ style_class: 'workspace-switcher' });