diff --git a/customize-ibus@hollowman.ml/extension.js b/customize-ibus@hollowman.ml/extension.js index 40ffa18..1fdf6fc 100644 --- a/customize-ibus@hollowman.ml/extension.js +++ b/customize-ibus@hollowman.ml/extension.js @@ -153,7 +153,7 @@ const IBusInputSourceIndicater = GObject.registerClass( } set inputindhid(inputindhid) { - this.hideTime = inputindhid * 1000; + this.hideTime = inputindhid; } _connectPanelService(panelService) { @@ -205,14 +205,23 @@ const IBusInputSourceIndicater = GObject.registerClass( _updateVisibility(sourceToggle = false) { this.visible = !CandidatePopup.visible; if (this.onlyOnToggle) this.visible = this.onlyOnToggle && sourceToggle; + if (this._lastTimeOut) { + GLib.source_remove(this._lastTimeOut); + this._lastTimeOut = null; + } if (this.visible) { this.setPosition(this._dummyCursor, 0); this.open(BoxPointer.PopupAnimation[this.animation]); this.get_parent().set_child_above_sibling(this, null); - GLib.timeout_add(GLib.PRIORITY_DEFAULT, this.hideTime, () => { - this.close(BoxPointer.PopupAnimation[this.animation]); - return GLib.SOURCE_REMOVE; - }); + this._lastTimeOut = GLib.timeout_add_seconds( + GLib.PRIORITY_DEFAULT, + this.hideTime, + () => { + this.close(BoxPointer.PopupAnimation[this.animation]); + this._lastTimeOut = null; + return GLib.SOURCE_REMOVE; + } + ); } else { this.close(BoxPointer.PopupAnimation[this.animation]); } diff --git a/customize-ibus@hollowman.ml/prefs.js b/customize-ibus@hollowman.ml/prefs.js index 4a56419..7ce822b 100644 --- a/customize-ibus@hollowman.ml/prefs.js +++ b/customize-ibus@hollowman.ml/prefs.js @@ -121,7 +121,7 @@ const CustomizeIBus = GObject.registerClass( this._field_use_indicator = new Gtk.Switch(); this._field_indicator_only_toggle = new Gtk.Switch(); - let adjustment = this._createAdjustment(Fields.INPUTINDHID, 1); + let adjustment = this._createAdjustment(Fields.INPUTINDHID); this._field_indicator_hide_time = new Gtk.Scale({ adjustment, draw_value: true, @@ -614,7 +614,7 @@ const CustomizeIBus = GObject.registerClass( this._updateIBusVersion(); } - _createAdjustment(key, step) { + _createAdjustment(key) { let schemaKey = gsettings.settings_schema.get_key(key); let [type, variant] = schemaKey.get_range().deep_unpack(); if (type !== "range") @@ -623,8 +623,6 @@ const CustomizeIBus = GObject.registerClass( let adj = new Gtk.Adjustment({ lower, upper, - step_increment: step, - page_increment: step, }); gsettings.bind(key, adj, "value", Gio.SettingsBindFlags.DEFAULT); return adj;