[gnome-shell/wip/carlosg/popup-logic] popupMenu: Avoid intermediate focus changes on menu switch
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/popup-logic] popupMenu: Avoid intermediate focus changes on menu switch
- Date: Wed, 9 Feb 2022 14:45:36 +0000 (UTC)
commit 0ca057c33d6c506f1cdde9324926495c9071cc1d
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 9 15:32:56 2022 +0100
popupMenu: Avoid intermediate focus changes on menu switch
Currently when switching from a popup menu to another in the same
manager, we first hide the old menu and remove its grab, then show
the new menu, and create a new grab.
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
js/ui/popupMenu.js | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index b464673626..bfbfd79df1 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1356,15 +1356,19 @@ var PopupMenuManager = class {
return;
if (open) {
- if (this.activeMenu)
- this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
+ const oldMenu = this.activeMenu;
+ const oldGrab = this._grab;
this._grab = Main.pushModal(menu.actor, this._grabParams);
this.activeMenu = menu;
+ oldMenu?.close(BoxPointer.PopupAnimation.FADE);
+ if (oldGrab)
+ Main.popModal(oldGrab);
} else {
- if (this.activeMenu === menu)
+ if (this.activeMenu === menu) {
this.activeMenu = null;
- Main.popModal(this._grab);
- this._grab = null;
+ Main.popModal(this._grab);
+ this._grab = null;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]