popupMenu: fix up grab/ungrab handling

Fix the panel menus to avoid unnecessarily bouncing out of modal (bug
634194) and to do a better job of keeping the keyboard focus in the
right place

https://bugzilla.gnome.org/show_bug.cgi?id=618885
This commit is contained in:
Dan Winship
2010-11-03 13:30:08 -04:00
parent 4dd4c9f99f
commit f326595202
2 changed files with 87 additions and 32 deletions

View File

@ -47,12 +47,9 @@ Button.prototype = {
},
_onOpenStateChanged: function(menu, open) {
if (open) {
if (open)
this.actor.add_style_pseudo_class('pressed');
let focus = global.stage.get_key_focus();
if (!focus || (focus != this.actor && !menu.actor.contains(focus)))
this.actor.grab_key_focus();
} else
else
this.actor.remove_style_pseudo_class('pressed');
}
};