workspace: Initialize WindowPreview using a MetaWindow
MetaWindow is Mutters representation of a window and provides all the APIs about it, MetaWindowActor is just the ClutterActor that's drawing that window. So use a MetaWindow to create a WindowPreview instead of the window actor. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1307
This commit is contained in:
parent
8c49f45ac8
commit
6bef9334b7
@ -214,10 +214,10 @@ var WindowPreview = GObject.registerClass({
|
|||||||
'size-changed': {},
|
'size-changed': {},
|
||||||
},
|
},
|
||||||
}, class WindowPreview extends St.Widget {
|
}, class WindowPreview extends St.Widget {
|
||||||
_init(realWindow, workspace) {
|
_init(metaWindow, workspace) {
|
||||||
this.realWindow = realWindow;
|
this.metaWindow = metaWindow;
|
||||||
this.metaWindow = realWindow.meta_window;
|
|
||||||
this.metaWindow._delegate = this;
|
this.metaWindow._delegate = this;
|
||||||
|
this.realWindow = metaWindow.get_compositor_private();
|
||||||
this._workspace = workspace;
|
this._workspace = workspace;
|
||||||
|
|
||||||
super._init({
|
super._init({
|
||||||
@ -1167,7 +1167,7 @@ class Workspace extends St.Widget {
|
|||||||
this._windows = [];
|
this._windows = [];
|
||||||
for (let i = 0; i < windows.length; i++) {
|
for (let i = 0; i < windows.length; i++) {
|
||||||
if (this._isOverviewWindow(windows[i]))
|
if (this._isOverviewWindow(windows[i]))
|
||||||
this._addWindowClone(windows[i].get_compositor_private(), true);
|
this._addWindowClone(windows[i], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track window changes
|
// Track window changes
|
||||||
@ -1534,7 +1534,7 @@ class Workspace extends St.Widget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let clone = this._addWindowClone(win, false);
|
let clone = this._addWindowClone(metaWin, false);
|
||||||
|
|
||||||
if (metaWin._overviewHint) {
|
if (metaWin._overviewHint) {
|
||||||
let x = metaWin._overviewHint.x - this.x;
|
let x = metaWin._overviewHint.x - this.x;
|
||||||
@ -1812,20 +1812,20 @@ class Workspace extends St.Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a clone of a (non-desktop) window and add it to the window list
|
// Create a clone of a (non-desktop) window and add it to the window list
|
||||||
_addWindowClone(win, positioned) {
|
_addWindowClone(metaWindow, positioned) {
|
||||||
let clone = new WindowPreview(win, this);
|
let clone = new WindowPreview(metaWindow, this);
|
||||||
clone.positioned = positioned;
|
clone.positioned = positioned;
|
||||||
|
|
||||||
clone.connect('selected',
|
clone.connect('selected',
|
||||||
this._onCloneSelected.bind(this));
|
this._onCloneSelected.bind(this));
|
||||||
clone.connect('drag-begin', () => {
|
clone.connect('drag-begin', () => {
|
||||||
Main.overview.beginWindowDrag(clone.metaWindow);
|
Main.overview.beginWindowDrag(metaWindow);
|
||||||
});
|
});
|
||||||
clone.connect('drag-cancelled', () => {
|
clone.connect('drag-cancelled', () => {
|
||||||
Main.overview.cancelledWindowDrag(clone.metaWindow);
|
Main.overview.cancelledWindowDrag(metaWindow);
|
||||||
});
|
});
|
||||||
clone.connect('drag-end', () => {
|
clone.connect('drag-end', () => {
|
||||||
Main.overview.endWindowDrag(clone.metaWindow);
|
Main.overview.endWindowDrag(metaWindow);
|
||||||
});
|
});
|
||||||
clone.connect('size-changed', () => {
|
clone.connect('size-changed', () => {
|
||||||
this._recalculateWindowPositions(WindowPositionFlags.NONE);
|
this._recalculateWindowPositions(WindowPositionFlags.NONE);
|
||||||
@ -1841,7 +1841,7 @@ class Workspace extends St.Widget {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
clone.connect('destroy', () => {
|
clone.connect('destroy', () => {
|
||||||
this._removeWindowClone(clone.metaWindow);
|
this._removeWindowClone(metaWindow);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add_child(clone);
|
this.add_child(clone);
|
||||||
|
Loading…
Reference in New Issue
Block a user