From 21913b45af18190033a8bc02a0240d13b6c5bf05 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 28 Jan 2022 11:59:51 +0100 Subject: [PATCH] dialog: Handle key events on self And set the dialog actor reactive. Specifically, we do not know whether the parent actor is reactive or not, and we should not be changing that from here, so do not use that actor to handle key events. Part-of: --- js/ui/dialog.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/ui/dialog.js b/js/ui/dialog.js index 9513a8151..a62a3a35b 100644 --- a/js/ui/dialog.js +++ b/js/ui/dialog.js @@ -13,7 +13,10 @@ function _setLabel(label, value) { var Dialog = GObject.registerClass( class Dialog extends St.Widget { _init(parentActor, styleClass) { - super._init({ layout_manager: new Clutter.BinLayout() }); + super._init({ + layout_manager: new Clutter.BinLayout(), + reactive: true, + }); this.connect('destroy', this._onDestroy.bind(this)); this._initialKeyFocus = null; @@ -27,7 +30,6 @@ class Dialog extends St.Widget { this._dialog.add_style_class_name(styleClass); this._parentActor = parentActor; - this._eventId = this._parentActor.connect('event', this._modalEventHandler.bind(this)); this._parentActor.add_child(this); } @@ -70,7 +72,7 @@ class Dialog extends St.Widget { this.makeInactive(); } - _modalEventHandler(actor, event) { + vfunc_event(event) { if (event.type() == Clutter.EventType.KEY_PRESS) { this._pressedKey = event.get_key_symbol(); } else if (event.type() == Clutter.EventType.KEY_RELEASE) {