mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
panelMenu: Close menu when hiding the corresponding button
A PanelMenuButton added to the top bar might not be visible at all times. If it is hidden while the corresponding menu is open, we currently don't do anything at all, e.g. the menu remains open pointing to an arbitrary location in the top bar. Instead, close the menu automatically in that case. https://bugzilla.gnome.org/show_bug.cgi?id=703540
This commit is contained in:
parent
d36e435801
commit
dabcd29fb6
1 changed files with 9 additions and 0 deletions
|
|
@ -110,6 +110,7 @@ const Button = new Lang.Class({
|
|||
|
||||
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
||||
this.actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress));
|
||||
this.actor.connect('notify::visible', Lang.bind(this, this._onVisibilityChanged));
|
||||
|
||||
if (dontCreateMenu)
|
||||
this.menu = new PopupMenu.PopupDummyMenu(this.actor);
|
||||
|
|
@ -183,6 +184,14 @@ const Button = new Lang.Class({
|
|||
return false;
|
||||
},
|
||||
|
||||
_onVisibilityChanged: function() {
|
||||
if (!this.menu)
|
||||
return;
|
||||
|
||||
if (!this.actor.visible)
|
||||
this.menu.close();
|
||||
},
|
||||
|
||||
_onMenuKeyPress: function(actor, event) {
|
||||
if (global.focus_manager.navigate_from_event(event))
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue