Move add window logic to add_filter

add_all_from_workspace needs the same logic as add_handler, so move it to the
common add_filter.

This fixes a regression from the last commit which caused scratch windows to
inserted in a space when restarting Gnome Shell.
This commit is contained in:
Tor Hedin Brønner
2017-12-26 18:14:45 +01:00
parent d15dbb0e99
commit 6510a78745
+35 -33
View File
@@ -524,12 +524,45 @@ function focus_wrapper(meta_window, user_data) {
}
function add_filter(meta_window) {
let add = true;
if (meta_window.window_type != Meta.WindowType.NORMAL
|| meta_window.get_transient_for() != null
) {
return false;
add = false;
}
return true;
let winprop = find_winprop(meta_window);
if (winprop) {
if (winprop.oneshot) {
// untested :)
winprops.splice(winprops.indexOf(winprop), 1);
}
if (winprop.float) {
// Let gnome-shell handle the placement
add = false;
}
if (winprop.scratch_layer) {
meta_window.stick();
meta_window.make_above();
add = false;
}
}
// If we're focusing a scratch window make on top and return
let focus_window = global.display.focus_window;
if (focus_window && focus_window.is_on_all_workspaces()) {
meta_window.stick();
meta_window.make_above();
add = false;
}
// If the window is a scratch window make it always on top
if (meta_window.is_on_all_workspaces()) {
meta_window.make_above();
add = false;
}
return add;
}
/**
@@ -591,37 +624,6 @@ function add_handler(ws, meta_window) {
return;
}
let winprop = find_winprop(meta_window);
if (winprop) {
if (winprop.oneshot) {
// untested :)
winprops.splice(winprops.indexOf(winprop), 1);
}
if (winprop.float) {
// Let gnome-shell handle the placement
return;
}
if (winprop.scratch_layer) {
meta_window.stick();
meta_window.make_above();
return;
}
}
// If we're focusing a scratch window make on top and return
let focus_window = global.display.focus_window;
if (focus_window && focus_window.is_on_all_workspaces()) {
meta_window.stick();
meta_window.make_above();
return;
}
// If the window is a scratch window make it always on top
if (meta_window.is_on_all_workspaces()) {
meta_window.make_above();
return;
}
let space = spaces.spaceOf(ws);
// Don't add already added windows