Fix cycle next/prev in monocle

This commit is contained in:
2023-05-15 00:23:15 +09:00
parent c8b260fac9
commit ffe9405097
2 changed files with 17 additions and 16 deletions
+7 -2
View File
@@ -53,8 +53,10 @@ var KeyboardManager = GObject.registerClass(
const state = this._state.monitors[mon];
const idx = this._state.workIndexByHandle(state.focused);
const newW = this._state.workIndex(mon, state.tags, idx + 1);
if (newW && newW.handle !== state.focused)
if (newW && newW.handle !== state.focused) {
this._state.focus(newW.handle);
this._renderer.render(mon);
}
});
this._addBinding("cycle-next", () => this._focusNext());
@@ -200,7 +202,10 @@ var KeyboardManager = GObject.registerClass(
const state = this._state.monitors[mon];
const idx = this._state.workIndexByHandle(state.focused);
const win = this._state.workIndex(mon, state.tags, idx - 1);
if (win && win.handle !== state.focused) this._state.focus(win.handle);
if (win && win.handle !== state.focused) {
this._state.focus(win.handle);
this._renderer.render(mon);
}
}
}
);
+10 -14
View File
@@ -108,20 +108,16 @@ var StateManager = GObject.registerClass(
* @param {Meta.Window} handle
*/
focus(handle) {
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
const mon = handle.get_monitor();
this.monitors[mon].focused = handle;
// This was focused without a zoom, removing the old zoom value.
this.monitors[mon].beforeZoom = null;
const mon = handle.get_monitor();
this.monitors[mon].focused = handle;
// This was focused without a zoom, removing the old zoom value.
this.monitors[mon].beforeZoom = null;
log("focusing window with title", handle.get_title());
handle.raise();
handle.focus(global.display.get_current_time());
handle.activate(global.display.get_current_time());
this.warpCursor(handle);
// Do not retrigger this idle.
return false;
});
log("focusing window with title", handle.get_title());
handle.raise();
handle.focus(global.display.get_current_time());
handle.activate(global.display.get_current_time());
this.warpCursor(handle);
}
/**
@@ -185,7 +181,7 @@ var StateManager = GObject.registerClass(
return [
{
...focused,
handle: focused.hanlde,
handle: focused.handle,
maximized: true,
minimized: false,
x: 0,