popupMenu: Avoid intermediate focus changes on menu switch
Currently when switching from a popup menu to another in the same manager, we first show the new menu, then hide the old menu and remove its grab, then create a new grab for the just shown menu. This briefly ungrabbed moment will still trigger keyboard focus changes, that might have other visible effects. In order to fix this, change the grabbing order so first the new grab is created then the old one is dismissed. This ensures focus moves from the old menu to the new menu without gaps in between. Since a grab is tied to an active menu, but close/grab are now slightly decoupled, also ensure closing a menu only tears down its own grab. This is necessary for correct accounting while doing the grab shuffling. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5039 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2166>
This commit is contained in:
parent
00e41383c7
commit
c13d44439f
@ -1356,12 +1356,14 @@ var PopupMenuManager = class {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (open) {
|
if (open) {
|
||||||
if (this.activeMenu)
|
const oldMenu = this.activeMenu;
|
||||||
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
const oldGrab = this._grab;
|
||||||
this._grab = Main.pushModal(menu.actor, this._grabParams);
|
this._grab = Main.pushModal(menu.actor, this._grabParams);
|
||||||
this.activeMenu = menu;
|
this.activeMenu = menu;
|
||||||
} else {
|
oldMenu?.close(BoxPointer.PopupAnimation.FADE);
|
||||||
if (this.activeMenu === menu)
|
if (oldGrab)
|
||||||
|
Main.popModal(oldGrab);
|
||||||
|
} else if (this.activeMenu === menu) {
|
||||||
this.activeMenu = null;
|
this.activeMenu = null;
|
||||||
Main.popModal(this._grab);
|
Main.popModal(this._grab);
|
||||||
this._grab = null;
|
this._grab = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user