keyboard: Drop message tray source, and tray focus handling

These are long unused.
This commit is contained in:
Carlos Garnacho 2017-08-05 12:20:29 +02:00
parent a1ce0da9e7
commit 33c3ed68fd

View File

@ -17,7 +17,6 @@ const InputSourceManager = imports.ui.status.keyboard;
const BoxPointer = imports.ui.boxpointer; const BoxPointer = imports.ui.boxpointer;
const Layout = imports.ui.layout; const Layout = imports.ui.layout;
const Main = imports.ui.main; const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
var KEYBOARD_REST_TIME = Layout.KEYBOARD_ANIMATION_TIME * 2 * 1000; var KEYBOARD_REST_TIME = Layout.KEYBOARD_ANIMATION_TIME * 2 * 1000;
@ -158,7 +157,6 @@ var Keyboard = new Lang.Class({
_init: function () { _init: function () {
this.actor = null; this.actor = null;
this._focusInTray = false;
this._focusInExtendedKeys = false; this._focusInExtendedKeys = false;
this._focusCaretTracker = new FocusCaretTracker.FocusCaretTracker(); this._focusCaretTracker = new FocusCaretTracker.FocusCaretTracker();
@ -343,8 +341,6 @@ var Keyboard = new Lang.Class({
this._keyboard = null; this._keyboard = null;
this.actor.destroy(); this.actor.destroy();
this.actor = null; this.actor = null;
this._destroySource();
}, },
_setupKeyboard: function() { _setupKeyboard: function() {
@ -371,8 +367,6 @@ var Keyboard = new Lang.Class({
this._keyboardGroupAddedId = this._keyboard.connect('group-added', Lang.bind(this, this._onGroupAdded)); this._keyboardGroupAddedId = this._keyboard.connect('group-added', Lang.bind(this, this._onGroupAdded));
this._keyboardGroupRemovedId = this._keyboard.connect('group-removed', Lang.bind(this, this._onGroupRemoved)); this._keyboardGroupRemovedId = this._keyboard.connect('group-removed', Lang.bind(this, this._onGroupRemoved));
this._focusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged)); this._focusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged));
this._createSource();
}, },
_onKeyFocusChanged: function () { _onKeyFocusChanged: function () {
@ -385,12 +379,6 @@ var Keyboard = new Lang.Class({
if (this._focusInExtendedKeys || extendedKeysWereFocused) if (this._focusInExtendedKeys || extendedKeysWereFocused)
return; return;
// Ignore focus changes caused by message tray showing/hiding
let trayWasFocused = this._focusInTray;
this._focusInTray = (focus && Main.messageTray.actor.contains(focus));
if (this._focusInTray || trayWasFocused)
return;
let time = global.get_current_time(); let time = global.get_current_time();
if (!(focus instanceof Clutter.Text)) { if (!(focus instanceof Clutter.Text)) {
this.hide(); this.hide();
@ -587,20 +575,6 @@ var Keyboard = new Lang.Class({
this._current_page.show(); this._current_page.show();
}, },
_createSource: function () {
if (this._source == null) {
this._source = new KeyboardSource(this);
Main.messageTray.add(this._source);
}
},
_destroySource: function () {
if (this._source) {
this._source.destroy();
this._source = null;
}
},
shouldTakeEvent: function(event) { shouldTakeEvent: function(event) {
let actor = event.get_source(); let actor = event.get_source();
return Main.layoutManager.keyboardBox.contains(actor) || return Main.layoutManager.keyboardBox.contains(actor) ||
@ -647,7 +621,6 @@ var Keyboard = new Lang.Class({
Main.layoutManager.keyboardIndex = monitor; Main.layoutManager.keyboardIndex = monitor;
this._redraw(); this._redraw();
Main.layoutManager.showKeyboard(); Main.layoutManager.showKeyboard();
this._destroySource();
}, },
hide: function () { hide: function () {
@ -677,7 +650,6 @@ var Keyboard = new Lang.Class({
this._hideSubkeys(); this._hideSubkeys();
Main.layoutManager.hideKeyboard(); Main.layoutManager.hideKeyboard();
this._createSource();
}, },
_hideSubkeys: function() { _hideSubkeys: function() {
@ -728,27 +700,6 @@ var Keyboard = new Lang.Class({
}, },
}); });
var KeyboardSource = new Lang.Class({
Name: 'KeyboardSource',
Extends: MessageTray.Source,
_init: function(keyboard) {
this._keyboard = keyboard;
this.parent(_("Keyboard"), 'input-keyboard-symbolic');
this.keepTrayOnSummaryClick = true;
},
handleSummaryClick: function(button) {
this.open();
return true;
},
open: function() {
// Show the OSK below the message tray
this._keyboard.show(Main.layoutManager.bottomIndex);
}
});
var LocalAdapter = new Lang.Class({ var LocalAdapter = new Lang.Class({
Name: 'LocalAdapter', Name: 'LocalAdapter',
Extends: Caribou.XAdapter, Extends: Caribou.XAdapter,