[gnome-shell] workspace: Add API to get windows and metaWindow to WindowCloneLayout
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspace: Add API to get windows and metaWindow to WindowCloneLayout
- Date: Thu, 11 Jun 2020 18:58:03 +0000 (UTC)
commit df149524d444ef415858d04ff96f4c7edf4f7861
Author: Jonas Dreßler <verdre v0yd nl>
Date: Mon Jun 8 14:47:43 2020 +0200
workspace: Add API to get windows and metaWindow to WindowCloneLayout
This will allow us to remove the remaining parts of the WindowClone
looping through children in favour of simply getting an array with the
windows or metaWindows and looping through that.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1298
js/ui/workspace.js | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index fccb5c5608..c815ebec8b 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -159,6 +159,36 @@ var WindowCloneLayout = GObject.registerClass({
this._layoutChanged();
}
+ /**
+ * getWindows:
+ *
+ * Gets an array of all ClutterActors that were added to the layout
+ * using addWindow(), ordered by the insertion order.
+ *
+ * @returns {Array} An array including all windows
+ */
+ getWindows() {
+ return [...this._windows.keys()];
+ }
+
+ /**
+ * getMetaWindow:
+ * @param {Clutter.Actor} window: the window to get the MetaWindow for
+ *
+ * Gets the MetaWindow associated to the ClutterActor @window that was
+ * added to the layout using addWindow(). If @window is not found,
+ * null is returned.
+ *
+ * @returns {Meta.Window} The metaWindow of the window
+ */
+ getMetaWindow(window) {
+ const windowInfo = this._windows.get(window);
+ if (!windowInfo)
+ return null;
+
+ return windowInfo.metaWindow;
+ }
+
// eslint-disable-next-line camelcase
get bounding_box() {
return this._boundingBox;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]