runDialog: Use ClutterText::activate for enter handling

Instead of consuming the event in front of the input method. Enter
is sometimes overriden by those, so it seems better to let the IM
handle the key event, and react later to it if it got propagated
anyway. That is what ::activate does, so use this signal.

This used to work before ClutterInputMethod/InputFocus because the
IM received the events directly from stage captured events. This
is not the case anymore.

Closes: #440


(cherry picked from commit 3ab9e9e8ad)
This commit is contained in:
Carlos Garnacho 2018-08-15 13:39:58 +00:00 committed by Florian Müllner
parent 67cb02d46a
commit af50a7829f

View File

@ -114,18 +114,16 @@ var RunDialog = new Lang.Class({
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY, this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
entry: this._entryText }); entry: this._entryText });
this._entryText.connect('key-press-event', (o, e) => { this._entryText.connect('activate', (o) => {
let symbol = e.get_key_symbol();
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
this.popModal(); this.popModal();
this._run(o.get_text(), this._run(o.get_text(),
e.get_state() & Clutter.ModifierType.CONTROL_MASK); Clutter.get_current_event().get_state() & Clutter.ModifierType.CONTROL_MASK);
if (!this._commandError || if (!this._commandError ||
!this.pushModal()) !this.pushModal())
this.close(); this.close();
});
return Clutter.EVENT_STOP; this._entryText.connect('key-press-event', (o, e) => {
} let symbol = e.get_key_symbol();
if (symbol == Clutter.Tab) { if (symbol == Clutter.Tab) {
let text = o.get_text(); let text = o.get_text();
let prefix; let prefix;