workspacesView: Disable workspace switching while in search

WorkspacesDisplay connects to key-press-event on the stage to switch
workspaces when page up or down is pressed and nothing else intercepts
these keys. This means that it is still possible to switch workspaces
while they are hidden behind the search.

So only allow these keybinding while the WorkspacesDisplay is reactive
which gets updated by ControlsManager depending on whether there is an
active search or not. Also set it as initially reactive, because
otherwise the keybindings would only work after performing an initial
search.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2204>
This commit is contained in:
Sebastian Keller 2022-02-20 16:53:43 +01:00
parent 05b0b4c432
commit 23047b6d80

View File

@ -833,6 +833,7 @@ class WorkspacesDisplay extends St.Widget {
_init(controls, scrollAdjustment, overviewAdjustment) {
super._init({
layout_manager: new Clutter.BinLayout(),
reactive: true,
});
this._controls = controls;
@ -1150,6 +1151,9 @@ class WorkspacesDisplay extends St.Widget {
if (this._overviewAdjustment.value !== ControlsState.WINDOW_PICKER)
return Clutter.EVENT_PROPAGATE;
if (!this.reactive)
return Clutter.EVENT_PROPAGATE;
const { workspaceManager } = global;
const vertical = workspaceManager.layout_rows === -1;
const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;