workspace: Use generic _addWindow function to add new clones
Now that we handle all ClutterClones belonging to the WindowClone pretty much the same, we can add a generic _addWindow function to WindowClone which creates the ClutterClone and adds it to the layout manager. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1297
This commit is contained in:
parent
a2545d186a
commit
cc5ed2fbf5
@ -182,14 +182,6 @@ var WindowClone = GObject.registerClass({
|
|||||||
this.metaWindow._delegate = this;
|
this.metaWindow._delegate = this;
|
||||||
this._workspace = workspace;
|
this._workspace = workspace;
|
||||||
|
|
||||||
this._windowClone = new Clutter.Clone({ source: realWindow });
|
|
||||||
// We expect this to be used for all interaction rather than
|
|
||||||
// this._windowClone; as the former is reactive and the latter
|
|
||||||
// is not, this just works for most cases. However, for DND all
|
|
||||||
// actors are picked, so DND operations would operate on the clone.
|
|
||||||
// To avoid this, we hide it from pick.
|
|
||||||
Shell.util_set_hidden_from_pick(this._windowClone, true);
|
|
||||||
|
|
||||||
// The MetaShapedTexture that we clone has a size that includes
|
// The MetaShapedTexture that we clone has a size that includes
|
||||||
// the invisible border; this is inconvenient; rather than trying
|
// the invisible border; this is inconvenient; rather than trying
|
||||||
// to compensate all over the place we insert a ClutterActor into
|
// to compensate all over the place we insert a ClutterActor into
|
||||||
@ -203,7 +195,7 @@ var WindowClone = GObject.registerClass({
|
|||||||
|
|
||||||
this.set_offscreen_redirect(Clutter.OffscreenRedirect.AUTOMATIC_FOR_OPACITY);
|
this.set_offscreen_redirect(Clutter.OffscreenRedirect.AUTOMATIC_FOR_OPACITY);
|
||||||
|
|
||||||
this.layout_manager.addWindow(this._windowClone, this.metaWindow);
|
this._addWindow(realWindow.meta_window);
|
||||||
|
|
||||||
this._delegate = this;
|
this._delegate = this;
|
||||||
|
|
||||||
@ -242,6 +234,20 @@ var WindowClone = GObject.registerClass({
|
|||||||
this._closeRequested = false;
|
this._closeRequested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_addWindow(metaWindow) {
|
||||||
|
const windowActor = metaWindow.get_compositor_private();
|
||||||
|
const clone = new Clutter.Clone({ source: windowActor });
|
||||||
|
|
||||||
|
// We expect this to be used for all interaction rather than
|
||||||
|
// the ClutterClone; as the former is reactive and the latter
|
||||||
|
// is not, this just works for most cases. However, for DND all
|
||||||
|
// actors are picked, so DND operations would operate on the clone.
|
||||||
|
// To avoid this, we hide it from pick.
|
||||||
|
Shell.util_set_hidden_from_pick(clone, true);
|
||||||
|
|
||||||
|
this.layout_manager.addWindow(clone, metaWindow);
|
||||||
|
}
|
||||||
|
|
||||||
vfunc_has_overlaps() {
|
vfunc_has_overlaps() {
|
||||||
return this.hasAttachedDialogs();
|
return this.hasAttachedDialogs();
|
||||||
}
|
}
|
||||||
@ -278,7 +284,7 @@ var WindowClone = GObject.registerClass({
|
|||||||
|
|
||||||
// Display dialog if it is attached to our metaWindow
|
// Display dialog if it is attached to our metaWindow
|
||||||
if (win.is_attached_dialog() && parent == this.metaWindow)
|
if (win.is_attached_dialog() && parent == this.metaWindow)
|
||||||
this._doAddAttachedDialog(win, win.get_compositor_private());
|
this._addWindow(win);
|
||||||
|
|
||||||
// The dialog popped up after the user tried to close the window,
|
// The dialog popped up after the user tried to close the window,
|
||||||
// assume it's a close confirmation and leave the overview
|
// assume it's a close confirmation and leave the overview
|
||||||
@ -290,14 +296,6 @@ var WindowClone = GObject.registerClass({
|
|||||||
return this.get_n_children() > 1;
|
return this.get_n_children() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_doAddAttachedDialog(metaWin, realWin) {
|
|
||||||
let clone = new Clutter.Clone({ source: realWin });
|
|
||||||
|
|
||||||
Shell.util_set_hidden_from_pick(clone, true);
|
|
||||||
|
|
||||||
this.layout_manager.addWindow(clone, metaWin);
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateAttachedDialogs() {
|
_updateAttachedDialogs() {
|
||||||
let iter = win => {
|
let iter = win => {
|
||||||
let actor = win.get_compositor_private();
|
let actor = win.get_compositor_private();
|
||||||
@ -307,7 +305,7 @@ var WindowClone = GObject.registerClass({
|
|||||||
if (!win.is_attached_dialog())
|
if (!win.is_attached_dialog())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this._doAddAttachedDialog(win, actor);
|
this._addWindow(win);
|
||||||
win.foreach_transient(iter);
|
win.foreach_transient(iter);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user