popupMenu: Implement vfunc's for key focus in/out

As per the fact the menu item is an object we can just vfunc's.
This is not possible for events as specific union object is passed instead of
just the Clutter.Event.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/499
This commit is contained in:
Marco Trevisan (Treviño) 2019-04-12 15:46:10 -05:00 committed by Florian Müllner
parent 4258ae3ec2
commit bdf66d7b62

View File

@ -95,9 +95,6 @@ var PopupBaseMenuItem = GObject.registerClass({
} }
if (params.reactive && params.hover) if (params.reactive && params.hover)
this.connect('notify::hover', this._onHoverChanged.bind(this)); this.connect('notify::hover', this._onHoverChanged.bind(this));
this.connect('key-focus-in', this._onKeyFocusIn.bind(this));
this.connect('key-focus-out', this._onKeyFocusOut.bind(this));
} }
get actor() { get actor() {
@ -161,11 +158,13 @@ var PopupBaseMenuItem = GObject.registerClass({
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} }
_onKeyFocusIn(actor) { vfunc_key_focus_in() {
super.vfunc_key_focus_in();
this.setActive(true); this.setActive(true);
} }
_onKeyFocusOut(actor) { vfunc_key_focus_out() {
super.vfunc_key_focus_out();
this.setActive(false); this.setActive(false);
} }