grab: pass the correct focus window to navigator

When ending a grab we want to have full control over what space and
window gains focus. So simply pass the window through navigator.finish
in addition to the space.
This commit is contained in:
Tor Hedin Brønner
2020-03-08 14:48:00 +01:00
parent b9a3f9d4a9
commit 3bfcb46405
2 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -461,7 +461,7 @@ var MoveGrab = class MoveGrab {
// metaWindow.change_workspace(space.workspace)
// space.workspace.activate(global.get_current_time());
Tiling.inGrab = false;
Navigator.getNavigator().finish(destSpace);
Navigator.getNavigator().finish(destSpace, metaWindow);
global.display.set_cursor(Meta.Cursor.DEFAULT);
}
+8 -5
View File
@@ -231,14 +231,14 @@ var Navigator = class Navigator {
this.was_accepted = true;
}
finish(space) {
finish(space, focus) {
if (grab)
return;
this.accept();
this.destroy(space);
this.destroy(space, focus);
}
destroy(space) {
destroy(space, focus) {
this.minimaps.forEach(m => {
if (typeof(m) === 'number')
Mainloop.source_remove(m);
@@ -304,8 +304,11 @@ var Navigator = class Navigator {
selected = this.space.indexOf(selected) !== -1 ? selected :
this.space.selectedWindow;
let focus = display.focus_window;
if (focus && focus.is_on_all_workspaces())
let curFocus = display.focus_window;
if (force && curFocus && curFocus.is_on_all_workspaces())
selected = curFocus;
if (focus)
selected = focus;
if (selected && !Tiling.inGrab) {