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:17:47 +01:00
parent d1e594e6cf
commit 7bc192a6d4
2 changed files with 9 additions and 6 deletions

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);
}

View File

@ -235,14 +235,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);
@ -308,8 +308,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) {