2011-09-28 13:16:26 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2021-01-15 12:59:58 +00:00
|
|
|
/* exported SearchController */
|
2010-11-12 17:45:29 +00:00
|
|
|
|
2023-06-08 04:52:46 +00:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const GObject = imports.gi.GObject;
|
|
|
|
const St = imports.gi.St;
|
2010-11-12 17:45:29 +00:00
|
|
|
|
|
|
|
const Main = imports.ui.main;
|
|
|
|
const Search = imports.ui.search;
|
2011-10-11 22:38:24 +00:00
|
|
|
const ShellEntry = imports.ui.shellEntry;
|
2010-11-12 17:45:29 +00:00
|
|
|
|
2017-10-31 01:23:39 +00:00
|
|
|
var FocusTrap = GObject.registerClass(
|
|
|
|
class FocusTrap extends St.Widget {
|
2017-10-31 00:03:21 +00:00
|
|
|
vfunc_navigate_focus(from, direction) {
|
2021-02-11 18:45:03 +00:00
|
|
|
if (direction === St.DirectionType.TAB_FORWARD ||
|
|
|
|
direction === St.DirectionType.TAB_BACKWARD)
|
2017-10-31 01:23:39 +00:00
|
|
|
return super.vfunc_navigate_focus(from, direction);
|
2012-03-10 00:33:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-02-09 02:05:15 +00:00
|
|
|
function getTermsForSearchString(searchString) {
|
|
|
|
searchString = searchString.replace(/^\s+/g, '').replace(/\s+$/g, '');
|
2021-02-11 18:45:03 +00:00
|
|
|
if (searchString === '')
|
2013-02-09 02:05:15 +00:00
|
|
|
return [];
|
2021-02-11 18:45:03 +00:00
|
|
|
return searchString.split(/\s+/);
|
2013-02-09 02:05:15 +00:00
|
|
|
}
|
2012-03-10 00:33:31 +00:00
|
|
|
|
2021-01-15 12:59:58 +00:00
|
|
|
var SearchController = GObject.registerClass({
|
2021-01-15 12:50:39 +00:00
|
|
|
Properties: {
|
|
|
|
'search-active': GObject.ParamSpec.boolean(
|
|
|
|
'search-active', 'search-active', 'search-active',
|
|
|
|
GObject.ParamFlags.READABLE,
|
|
|
|
false),
|
2019-08-20 21:43:54 +00:00
|
|
|
},
|
2021-01-15 12:59:58 +00:00
|
|
|
}, class SearchController extends St.Widget {
|
2021-01-14 23:23:15 +00:00
|
|
|
_init(searchEntry, showAppsButton) {
|
2019-10-21 18:44:00 +00:00
|
|
|
super._init({
|
2021-01-15 12:59:58 +00:00
|
|
|
name: 'searchController',
|
2021-01-15 12:50:39 +00:00
|
|
|
layout_manager: new Clutter.BinLayout(),
|
2019-10-21 18:44:00 +00:00
|
|
|
x_expand: true,
|
2021-01-29 14:38:08 +00:00
|
|
|
y_expand: true,
|
2020-06-02 17:21:02 +00:00
|
|
|
visible: false,
|
2019-10-21 18:44:00 +00:00
|
|
|
});
|
2012-06-21 22:52:56 +00:00
|
|
|
|
|
|
|
this._showAppsButton = showAppsButton;
|
2017-12-02 00:27:35 +00:00
|
|
|
this._showAppsButton.connect('notify::checked', this._onShowAppsButtonToggled.bind(this));
|
2012-06-21 22:52:56 +00:00
|
|
|
|
2012-06-21 22:52:56 +00:00
|
|
|
this._activePage = null;
|
2010-11-18 12:51:47 +00:00
|
|
|
|
2012-08-24 16:24:49 +00:00
|
|
|
this._searchActive = false;
|
2010-11-18 12:51:47 +00:00
|
|
|
|
2012-07-28 20:47:55 +00:00
|
|
|
this._entry = searchEntry;
|
2011-10-11 22:38:24 +00:00
|
|
|
ShellEntry.addContextMenu(this._entry);
|
2012-06-21 22:52:56 +00:00
|
|
|
|
2011-02-16 18:20:03 +00:00
|
|
|
this._text = this._entry.clutter_text;
|
2017-12-02 00:27:35 +00:00
|
|
|
this._text.connect('text-changed', this._onTextChanged.bind(this));
|
|
|
|
this._text.connect('key-press-event', this._onKeyPress.bind(this));
|
2017-10-31 00:38:18 +00:00
|
|
|
this._text.connect('key-focus-in', () => {
|
2012-06-21 22:52:56 +00:00
|
|
|
this._searchResults.highlightDefault(true);
|
2017-10-31 00:38:18 +00:00
|
|
|
});
|
|
|
|
this._text.connect('key-focus-out', () => {
|
2012-06-21 22:52:56 +00:00
|
|
|
this._searchResults.highlightDefault(false);
|
2017-10-31 00:38:18 +00:00
|
|
|
});
|
2017-08-15 23:25:15 +00:00
|
|
|
this._entry.connect('popup-menu', () => {
|
|
|
|
if (!this._searchActive)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._entry.menu.close();
|
|
|
|
this._searchResults.popupMenuDefault();
|
|
|
|
});
|
2017-12-02 00:27:35 +00:00
|
|
|
this._entry.connect('notify::mapped', this._onMapped.bind(this));
|
2022-11-25 17:02:34 +00:00
|
|
|
global.stage.connectObject('notify::key-focus',
|
|
|
|
this._onStageKeyFocusChanged.bind(this), this);
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2021-02-11 18:45:03 +00:00
|
|
|
this._entry.set_primary_icon(new St.Icon({
|
|
|
|
style_class: 'search-entry-icon',
|
|
|
|
icon_name: 'edit-find-symbolic',
|
|
|
|
}));
|
|
|
|
this._clearIcon = new St.Icon({
|
|
|
|
style_class: 'search-entry-icon',
|
|
|
|
icon_name: 'edit-clear-symbolic',
|
|
|
|
});
|
2011-02-16 18:20:03 +00:00
|
|
|
|
|
|
|
this._iconClickedId = 0;
|
2012-06-21 22:52:56 +00:00
|
|
|
this._capturedEventId = 0;
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2019-10-16 09:31:44 +00:00
|
|
|
this._searchResults = new Search.SearchResultsView();
|
2021-01-15 12:50:39 +00:00
|
|
|
this.add_child(this._searchResults);
|
2021-01-27 15:55:20 +00:00
|
|
|
Main.ctrlAltTabManager.addGroup(this._entry, _('Search'), 'edit-find-symbolic');
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2011-11-12 04:40:56 +00:00
|
|
|
// Since the entry isn't inside the results container we install this
|
|
|
|
// dummy widget as the last results container child so that we can
|
2012-03-10 00:33:31 +00:00
|
|
|
// include the entry in the keynav tab path
|
|
|
|
this._focusTrap = new FocusTrap({ can_focus: true });
|
2017-10-31 00:38:18 +00:00
|
|
|
this._focusTrap.connect('key-focus-in', () => {
|
2011-11-12 04:40:56 +00:00
|
|
|
this._entry.grab_key_focus();
|
2017-10-31 00:38:18 +00:00
|
|
|
});
|
2019-07-16 09:24:13 +00:00
|
|
|
this._searchResults.add_actor(this._focusTrap);
|
2011-11-12 04:40:56 +00:00
|
|
|
|
2019-07-16 09:24:13 +00:00
|
|
|
global.focus_manager.add_group(this._searchResults);
|
2012-06-21 22:52:56 +00:00
|
|
|
|
|
|
|
this._stageKeyPressId = 0;
|
2017-10-31 00:38:18 +00:00
|
|
|
Main.overview.connect('showing', () => {
|
2021-02-11 18:45:03 +00:00
|
|
|
this._stageKeyPressId =
|
|
|
|
global.stage.connect('key-press-event', this._onStageKeyPress.bind(this));
|
2017-10-31 00:38:18 +00:00
|
|
|
});
|
|
|
|
Main.overview.connect('hiding', () => {
|
2021-02-11 18:45:03 +00:00
|
|
|
if (this._stageKeyPressId !== 0) {
|
2017-10-31 00:38:18 +00:00
|
|
|
global.stage.disconnect(this._stageKeyPressId);
|
|
|
|
this._stageKeyPressId = 0;
|
|
|
|
}
|
|
|
|
});
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2012-10-08 16:16:55 +00:00
|
|
|
|
2021-01-02 19:17:17 +00:00
|
|
|
prepareToEnterOverview() {
|
2013-02-16 17:54:19 +00:00
|
|
|
this.reset();
|
2021-01-15 12:50:39 +00:00
|
|
|
this._setSearchActive(false);
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2013-02-25 23:11:59 +00:00
|
|
|
|
2021-01-14 23:23:15 +00:00
|
|
|
vfunc_unmap() {
|
2018-08-23 14:11:10 +00:00
|
|
|
this.reset();
|
2020-06-02 17:21:02 +00:00
|
|
|
|
2021-01-14 23:23:15 +00:00
|
|
|
super.vfunc_unmap();
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2012-06-21 22:52:56 +00:00
|
|
|
|
2021-01-15 12:50:39 +00:00
|
|
|
_setSearchActive(searchActive) {
|
|
|
|
if (this._searchActive === searchActive)
|
2014-07-14 17:06:08 +00:00
|
|
|
return;
|
|
|
|
|
2021-01-15 12:50:39 +00:00
|
|
|
this._searchActive = searchActive;
|
|
|
|
this.notify('search-active');
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2012-06-21 22:52:56 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_onShowAppsButtonToggled() {
|
2021-01-15 12:50:39 +00:00
|
|
|
this._setSearchActive(false);
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2012-06-21 22:52:56 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_onStageKeyPress(actor, event) {
|
2012-11-12 17:41:14 +00:00
|
|
|
// Ignore events while anything but the overview has
|
|
|
|
// pushed a modal (system modals, looking glass, ...)
|
|
|
|
if (Main.modalCount > 1)
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2012-11-12 17:41:14 +00:00
|
|
|
|
2012-06-21 22:52:56 +00:00
|
|
|
let symbol = event.get_key_symbol();
|
|
|
|
|
2019-11-05 19:37:28 +00:00
|
|
|
if (symbol === Clutter.KEY_Escape) {
|
2012-08-24 16:24:49 +00:00
|
|
|
if (this._searchActive)
|
2012-06-21 22:52:56 +00:00
|
|
|
this.reset();
|
2012-08-15 10:20:24 +00:00
|
|
|
else if (this._showAppsButton.checked)
|
2013-02-16 17:50:25 +00:00
|
|
|
this._showAppsButton.checked = false;
|
2012-06-21 22:52:56 +00:00
|
|
|
else
|
|
|
|
Main.overview.hide();
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2013-02-22 19:56:24 +00:00
|
|
|
} else if (this._shouldTriggerSearch(symbol)) {
|
2012-06-21 22:52:56 +00:00
|
|
|
this.startSearch(event);
|
|
|
|
}
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2012-06-21 22:52:56 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_searchCancelled() {
|
2021-01-15 12:50:39 +00:00
|
|
|
this._setSearchActive(false);
|
2010-11-18 12:51:47 +00:00
|
|
|
|
2011-04-07 23:10:24 +00:00
|
|
|
// Leave the entry focused when it doesn't have any text;
|
|
|
|
// when replacing a selected search term, Clutter emits
|
|
|
|
// two 'text-changed' signals, one for deleting the previous
|
|
|
|
// text and one for the new one - the second one is handled
|
|
|
|
// incorrectly when we remove focus
|
|
|
|
// (https://bugzilla.gnome.org/show_bug.cgi?id=636341) */
|
2021-02-11 18:45:03 +00:00
|
|
|
if (this._text.text !== '')
|
2012-02-27 14:17:33 +00:00
|
|
|
this.reset();
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
reset() {
|
2018-10-04 13:05:44 +00:00
|
|
|
// Don't drop the key focus on Clutter's side if anything but the
|
|
|
|
// overview has pushed a modal (e.g. system modals when activated using
|
|
|
|
// the overview).
|
|
|
|
if (Main.modalCount <= 1)
|
|
|
|
global.stage.set_key_focus(null);
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2012-02-27 14:17:33 +00:00
|
|
|
this._entry.text = '';
|
|
|
|
|
2011-02-16 18:20:03 +00:00
|
|
|
this._text.set_cursor_visible(true);
|
|
|
|
this._text.set_selection(0, 0);
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_onStageKeyFocusChanged() {
|
2011-02-16 18:20:03 +00:00
|
|
|
let focus = global.stage.get_key_focus();
|
2019-08-19 19:38:51 +00:00
|
|
|
let appearFocused = this._entry.contains(focus) ||
|
|
|
|
this._searchResults.contains(focus);
|
2012-02-27 17:43:59 +00:00
|
|
|
|
2012-03-10 04:50:17 +00:00
|
|
|
this._text.set_cursor_visible(appearFocused);
|
|
|
|
|
|
|
|
if (appearFocused)
|
|
|
|
this._entry.add_style_pseudo_class('focus');
|
|
|
|
else
|
|
|
|
this._entry.remove_style_pseudo_class('focus');
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_onMapped() {
|
2011-02-16 18:20:03 +00:00
|
|
|
if (this._entry.mapped) {
|
|
|
|
// Enable 'find-as-you-type'
|
2021-02-11 18:45:03 +00:00
|
|
|
this._capturedEventId =
|
|
|
|
global.stage.connect('captured-event', this._onCapturedEvent.bind(this));
|
2011-02-16 18:20:03 +00:00
|
|
|
this._text.set_cursor_visible(true);
|
|
|
|
this._text.set_selection(0, 0);
|
|
|
|
} else {
|
|
|
|
// Disable 'find-as-you-type'
|
|
|
|
if (this._capturedEventId > 0)
|
|
|
|
global.stage.disconnect(this._capturedEventId);
|
|
|
|
this._capturedEventId = 0;
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2010-11-18 12:51:47 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_shouldTriggerSearch(symbol) {
|
2019-11-05 19:37:28 +00:00
|
|
|
if (symbol === Clutter.KEY_Multi_key)
|
2015-08-07 13:16:58 +00:00
|
|
|
return true;
|
|
|
|
|
2019-11-05 19:37:28 +00:00
|
|
|
if (symbol === Clutter.KEY_BackSpace && this._searchActive)
|
2015-08-07 12:37:04 +00:00
|
|
|
return true;
|
|
|
|
|
2013-02-22 19:56:24 +00:00
|
|
|
let unicode = Clutter.keysym_to_unicode(symbol);
|
2021-02-11 18:45:03 +00:00
|
|
|
if (unicode === 0)
|
2013-02-22 19:56:24 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if (getTermsForSearchString(String.fromCharCode(unicode)).length > 0)
|
|
|
|
return true;
|
|
|
|
|
2015-08-07 12:37:04 +00:00
|
|
|
return false;
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2013-02-22 19:56:24 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
startSearch(event) {
|
2011-02-16 18:27:05 +00:00
|
|
|
global.stage.set_key_focus(this._text);
|
2022-02-25 12:10:53 +00:00
|
|
|
this._text.event(event, false);
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2011-02-16 18:27:05 +00:00
|
|
|
|
2011-02-16 18:20:03 +00:00
|
|
|
// the entry does not show the hint
|
2017-10-31 00:03:21 +00:00
|
|
|
_isActivated() {
|
2021-02-11 18:45:03 +00:00
|
|
|
return this._text.text === this._entry.get_text();
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2019-02-04 11:30:53 +00:00
|
|
|
_onTextChanged() {
|
2013-02-09 02:05:15 +00:00
|
|
|
let terms = getTermsForSearchString(this._entry.get_text());
|
|
|
|
|
2021-01-15 12:50:39 +00:00
|
|
|
const searchActive = terms.length > 0;
|
2014-09-11 21:15:50 +00:00
|
|
|
this._searchResults.setTerms(terms);
|
2012-08-24 16:24:49 +00:00
|
|
|
|
2021-01-15 12:50:39 +00:00
|
|
|
if (searchActive) {
|
|
|
|
this._setSearchActive(true);
|
2014-09-11 21:15:50 +00:00
|
|
|
|
2013-03-03 18:56:12 +00:00
|
|
|
this._entry.set_secondary_icon(this._clearIcon);
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2021-02-11 18:45:03 +00:00
|
|
|
if (this._iconClickedId === 0) {
|
|
|
|
this._iconClickedId =
|
|
|
|
this._entry.connect('secondary-icon-clicked', this.reset.bind(this));
|
2019-08-20 00:51:42 +00:00
|
|
|
}
|
2010-11-18 12:51:47 +00:00
|
|
|
} else {
|
2012-08-24 16:24:49 +00:00
|
|
|
if (this._iconClickedId > 0) {
|
2011-02-16 18:20:03 +00:00
|
|
|
this._entry.disconnect(this._iconClickedId);
|
2012-08-24 16:24:49 +00:00
|
|
|
this._iconClickedId = 0;
|
|
|
|
}
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2013-03-03 18:56:12 +00:00
|
|
|
this._entry.set_secondary_icon(null);
|
2012-08-24 16:24:49 +00:00
|
|
|
this._searchCancelled();
|
2010-11-18 12:51:47 +00:00
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2010-11-18 12:51:47 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_onKeyPress(entry, event) {
|
2010-11-18 12:51:47 +00:00
|
|
|
let symbol = event.get_key_symbol();
|
2019-11-05 19:37:28 +00:00
|
|
|
if (symbol === Clutter.KEY_Escape) {
|
2011-02-16 18:27:05 +00:00
|
|
|
if (this._isActivated()) {
|
2012-02-27 14:17:33 +00:00
|
|
|
this.reset();
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2011-02-16 18:27:05 +00:00
|
|
|
}
|
2012-08-24 16:24:49 +00:00
|
|
|
} else if (this._searchActive) {
|
2012-03-10 02:40:46 +00:00
|
|
|
let arrowNext, nextDirection;
|
2021-02-11 18:45:03 +00:00
|
|
|
if (entry.get_text_direction() === Clutter.TextDirection.RTL) {
|
2019-11-05 19:37:28 +00:00
|
|
|
arrowNext = Clutter.KEY_Left;
|
2018-11-27 12:58:25 +00:00
|
|
|
nextDirection = St.DirectionType.LEFT;
|
2012-03-10 02:40:46 +00:00
|
|
|
} else {
|
2019-11-05 19:37:28 +00:00
|
|
|
arrowNext = Clutter.KEY_Right;
|
2018-11-27 12:58:25 +00:00
|
|
|
nextDirection = St.DirectionType.RIGHT;
|
2012-03-10 02:40:46 +00:00
|
|
|
}
|
|
|
|
|
2019-11-05 19:37:28 +00:00
|
|
|
if (symbol === Clutter.KEY_Tab) {
|
2018-11-27 12:58:25 +00:00
|
|
|
this._searchResults.navigateFocus(St.DirectionType.TAB_FORWARD);
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2019-11-05 19:37:28 +00:00
|
|
|
} else if (symbol === Clutter.KEY_ISO_Left_Tab) {
|
2011-11-12 04:40:56 +00:00
|
|
|
this._focusTrap.can_focus = false;
|
2018-11-27 12:58:25 +00:00
|
|
|
this._searchResults.navigateFocus(St.DirectionType.TAB_BACKWARD);
|
2011-11-12 04:40:56 +00:00
|
|
|
this._focusTrap.can_focus = true;
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2019-11-05 19:37:28 +00:00
|
|
|
} else if (symbol === Clutter.KEY_Down) {
|
2018-11-27 12:58:25 +00:00
|
|
|
this._searchResults.navigateFocus(St.DirectionType.DOWN);
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2021-02-11 18:45:03 +00:00
|
|
|
} else if (symbol === arrowNext && this._text.position === -1) {
|
2012-03-10 02:40:46 +00:00
|
|
|
this._searchResults.navigateFocus(nextDirection);
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2019-11-05 19:37:28 +00:00
|
|
|
} else if (symbol === Clutter.KEY_Return || symbol === Clutter.KEY_KP_Enter) {
|
2013-01-27 19:00:59 +00:00
|
|
|
this._searchResults.activateDefault();
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2011-11-12 04:40:56 +00:00
|
|
|
}
|
2010-11-18 12:51:47 +00:00
|
|
|
}
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2010-11-18 12:51:47 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
_onCapturedEvent(actor, event) {
|
2021-02-11 18:45:03 +00:00
|
|
|
if (event.type() === Clutter.EventType.BUTTON_PRESS) {
|
2022-02-25 12:10:30 +00:00
|
|
|
const targetActor = global.stage.get_event_actor(event);
|
|
|
|
if (targetActor !== this._text &&
|
2019-08-18 10:49:42 +00:00
|
|
|
this._text.has_key_focus() &&
|
2021-02-11 18:45:03 +00:00
|
|
|
this._text.text === '' &&
|
2019-08-19 17:55:49 +00:00
|
|
|
!this._text.has_preedit() &&
|
2022-02-25 12:10:30 +00:00
|
|
|
!Main.layoutManager.keyboardBox.contains(targetActor)) {
|
2011-02-16 18:20:03 +00:00
|
|
|
// the user clicked outside after activating the entry, but
|
2011-10-09 20:24:59 +00:00
|
|
|
// with no search term entered and no keyboard button pressed
|
|
|
|
// - cancel the search
|
2012-02-27 14:17:33 +00:00
|
|
|
this.reset();
|
2011-02-16 18:27:05 +00:00
|
|
|
}
|
2011-02-16 18:20:03 +00:00
|
|
|
}
|
2011-02-16 18:44:03 +00:00
|
|
|
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2011-02-16 18:20:03 +00:00
|
|
|
|
2023-06-01 22:54:59 +00:00
|
|
|
/**
|
|
|
|
* addProvider:
|
|
|
|
*
|
|
|
|
* Add a search provider to the controller.
|
2023-06-08 04:53:07 +00:00
|
|
|
*
|
|
|
|
* @param {object} provider - a search provider implementation
|
2023-06-01 22:54:59 +00:00
|
|
|
*/
|
|
|
|
addProvider(provider) {
|
|
|
|
this._searchResults._registerProvider(provider);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* removeProvider:
|
|
|
|
*
|
|
|
|
* Remove a search provider from the controller.
|
2023-06-08 04:53:07 +00:00
|
|
|
*
|
|
|
|
* @param {object} provider - a search provider implementation
|
2023-06-01 22:54:59 +00:00
|
|
|
*/
|
|
|
|
removeProvider(provider) {
|
|
|
|
this._searchResults._unregisterProvider(provider);
|
|
|
|
}
|
|
|
|
|
2021-01-15 12:50:39 +00:00
|
|
|
get searchActive() {
|
|
|
|
return this._searchActive;
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2019-07-16 09:24:13 +00:00
|
|
|
});
|