From de4a31b0edcb3d31b4bcd3c4a245ddc8abab3e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Br=C3=B8nner?= Date: Mon, 27 Jan 2020 21:11:48 +0100 Subject: [PATCH] Ensure grab window remains focused when ending navigation before dnd --- navigator.js | 8 ++++++-- tiling.js | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/navigator.js b/navigator.js index ca7860c..d38da09 100644 --- a/navigator.js +++ b/navigator.js @@ -289,7 +289,11 @@ var Navigator = class Navigator { // again doesn't trigger a switch signal force && Tiling.spaces.animateToSpace(this.space); } else { - this.space.workspace.activate(global.get_current_time()); + if (Tiling.inGrab && Tiling.inGrab.window) { + this.space.workspace.activate_with_focus(Tiling.inGrab.window, global.get_current_time()); + } else { + this.space.workspace.activate(global.get_current_time()); + } } selected = this.space.indexOf(selected) !== -1 ? selected : @@ -299,7 +303,7 @@ var Navigator = class Navigator { if (focus && focus.is_on_all_workspaces()) selected = focus; - if (selected) { + if (selected && !Tiling.inGrab) { let hasFocus = selected && selected.has_focus(); selected.foreach_transient(mw => hasFocus = mw.has_focus() || hasFocus); if (hasFocus) { diff --git a/tiling.js b/tiling.js index d9f0cb0..af2c8d6 100644 --- a/tiling.js +++ b/tiling.js @@ -1625,6 +1625,10 @@ class Spaces extends Map { let toSpace = this.spaceOf(to); let fromSpace = this.spaceOf(from); + if (inGrab && inGrab.window) { + inGrab.window.change_workspace(toSpace.workspace); + } + for (let metaWindow of toSpace.getWindows()) { // Make sure all windows belong to the correct workspace. // Note: The 'switch-workspace' signal (this method) runs before mutter decides on focus window.