Keyboard: fix timestamp handling to account for CURRENT_TIME
CLUTTER_CURRENT_TIME (like GDK_CURRENT_TIME and libX11 CurrentTime) is 0, and thus compares lower than all valid timestamps, meaning that focus changes without an X11 event in the stack are ignored by the on screen keyboard. https://bugzilla.gnome.org/show_bug.cgi?id=664309
This commit is contained in:
parent
488820daec
commit
bf2d2071fc
@ -201,7 +201,7 @@ const Keyboard = new Lang.Class({
|
|||||||
|
|
||||||
this.actor = null;
|
this.actor = null;
|
||||||
|
|
||||||
this._timestamp = global.get_current_time();
|
this._timestamp = global.display.get_current_time_roundtrip();
|
||||||
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._redraw));
|
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._redraw));
|
||||||
|
|
||||||
this._keyboardSettings = new Gio.Settings({ schema: KEYBOARD_SCHEMA });
|
this._keyboardSettings = new Gio.Settings({ schema: KEYBOARD_SCHEMA });
|
||||||
@ -494,14 +494,29 @@ 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;
|
||||||
|
},
|
||||||
|
|
||||||
// D-Bus methods
|
// D-Bus methods
|
||||||
Show: function(timestamp) {
|
Show: function(timestamp) {
|
||||||
if (!this._enableKeyboard)
|
if (!this._enableKeyboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (timestamp - this._timestamp < 0)
|
if (this._compareTimestamp(timestamp, this._timestamp) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (timestamp != Clutter.CURRENT_TIME)
|
||||||
this._timestamp = timestamp;
|
this._timestamp = timestamp;
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
@ -510,9 +525,10 @@ const Keyboard = new Lang.Class({
|
|||||||
if (!this._enableKeyboard)
|
if (!this._enableKeyboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (timestamp - this._timestamp < 0)
|
if (this._compareTimestamp(timestamp, this._timestamp) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (timestamp != Clutter.CURRENT_TIME)
|
||||||
this._timestamp = timestamp;
|
this._timestamp = timestamp;
|
||||||
this.hide();
|
this.hide();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user