keyboard: Remove Show/Hide calls
And merge with the "internal" show/hide() ones. Those functions don't proxy dbus method calls anymore, so it makes no sense to expose these. Also, the timestamp is no longer needed as there is a single source for these events. https://bugzilla.gnome.org/show_bug.cgi?id=777342
This commit is contained in:
parent
aecd1c126a
commit
c324395ee6
@ -161,8 +161,6 @@ const Keyboard = new Lang.Class({
|
|||||||
this._focusInTray = false;
|
this._focusInTray = false;
|
||||||
this._focusInExtendedKeys = false;
|
this._focusInExtendedKeys = false;
|
||||||
|
|
||||||
this._timestamp = global.display.get_current_time_roundtrip();
|
|
||||||
|
|
||||||
this._focusCaretTracker = new FocusCaretTracker.FocusCaretTracker();
|
this._focusCaretTracker = new FocusCaretTracker.FocusCaretTracker();
|
||||||
this._focusCaretTracker.connect('focus-changed', Lang.bind(this, this._onFocusChanged));
|
this._focusCaretTracker.connect('focus-changed', Lang.bind(this, this._onFocusChanged));
|
||||||
this._focusCaretTracker.connect('caret-moved', Lang.bind(this, this._onCaretMoved));
|
this._focusCaretTracker.connect('caret-moved', Lang.bind(this, this._onCaretMoved));
|
||||||
@ -281,10 +279,10 @@ const Keyboard = new Lang.Class({
|
|||||||
if (focused) {
|
if (focused) {
|
||||||
this._currentAccessible = accessible;
|
this._currentAccessible = accessible;
|
||||||
this._updateCaretPosition(accessible);
|
this._updateCaretPosition(accessible);
|
||||||
this.Show(this._timestamp);
|
this.show(Main.layoutManager.focusIndex);
|
||||||
} else if (this._currentAccessible == accessible) {
|
} else if (this._currentAccessible == accessible) {
|
||||||
this._currentAccessible = null;
|
this._currentAccessible = null;
|
||||||
this.Hide(this._timestamp);
|
this.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -398,17 +396,17 @@ const Keyboard = new Lang.Class({
|
|||||||
|
|
||||||
let time = global.get_current_time();
|
let time = global.get_current_time();
|
||||||
if (!(focus instanceof Clutter.Text)) {
|
if (!(focus instanceof Clutter.Text)) {
|
||||||
this.Hide(time);
|
this.hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._showIdleId) {
|
if (!this._showIdleId) {
|
||||||
this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE,
|
this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE,
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
this.Show(time);
|
this.show(Main.layoutManager.focusIndex);
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
}));
|
}));
|
||||||
GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.Show');
|
GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.show');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -620,6 +618,10 @@ const Keyboard = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
show: function (monitor) {
|
show: function (monitor) {
|
||||||
|
if (!this._enableKeyboard)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._clearShowIdle();
|
||||||
this._keyboardRequested = true;
|
this._keyboardRequested = true;
|
||||||
|
|
||||||
if (this._keyboardVisible) {
|
if (this._keyboardVisible) {
|
||||||
@ -652,6 +654,10 @@ const Keyboard = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
hide: function () {
|
hide: function () {
|
||||||
|
if (!this._enableKeyboard)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._clearShowIdle();
|
||||||
this._keyboardRequested = false;
|
this._keyboardRequested = false;
|
||||||
|
|
||||||
if (!this._keyboardVisible)
|
if (!this._keyboardVisible)
|
||||||
@ -703,20 +709,6 @@ const Keyboard = new Lang.Class({
|
|||||||
this._moveTemporarily();
|
this._moveTemporarily();
|
||||||
},
|
},
|
||||||
|
|
||||||
// _compareTimestamp:
|
|
||||||
//
|
|
||||||
// Compare two timestamps taking into account
|
|
||||||
// CURRENT_TIME (0)
|
|
||||||
_compareTimestamp: function(one, two) {
|
|
||||||
if (one == two)
|
|
||||||
return 0;
|
|
||||||
if (one == Clutter.CURRENT_TIME)
|
|
||||||
return 1;
|
|
||||||
if (two == Clutter.CURRENT_TIME)
|
|
||||||
return -1;
|
|
||||||
return one - two;
|
|
||||||
},
|
|
||||||
|
|
||||||
_clearShowIdle: function() {
|
_clearShowIdle: function() {
|
||||||
if (!this._showIdleId)
|
if (!this._showIdleId)
|
||||||
return;
|
return;
|
||||||
@ -724,34 +716,6 @@ const Keyboard = new Lang.Class({
|
|||||||
this._showIdleId = 0;
|
this._showIdleId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
Show: function(timestamp) {
|
|
||||||
if (!this._enableKeyboard)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (this._compareTimestamp(timestamp, this._timestamp) < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this._clearShowIdle();
|
|
||||||
|
|
||||||
if (timestamp != Clutter.CURRENT_TIME)
|
|
||||||
this._timestamp = timestamp;
|
|
||||||
this.show(Main.layoutManager.focusIndex);
|
|
||||||
},
|
|
||||||
|
|
||||||
Hide: function(timestamp) {
|
|
||||||
if (!this._enableKeyboard)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (this._compareTimestamp(timestamp, this._timestamp) < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this._clearShowIdle();
|
|
||||||
|
|
||||||
if (timestamp != Clutter.CURRENT_TIME)
|
|
||||||
this._timestamp = timestamp;
|
|
||||||
this.hide();
|
|
||||||
},
|
|
||||||
|
|
||||||
SetCursorLocation: function(x, y, w, h) {
|
SetCursorLocation: function(x, y, w, h) {
|
||||||
if (!this._enableKeyboard)
|
if (!this._enableKeyboard)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user