ibusCandidatePopup: Add support for relative cursor positioning

IBus now provides a new method for cursor positioning where the
coordinates are relative to the focused window. This is useful for
wayland clients which don't have access to their global coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=753476
This commit is contained in:
Rui Matos 2014-07-30 14:40:39 +02:00
parent 75dc5c16c8
commit a13357c2a8

View File

@ -158,9 +158,14 @@ const CandidatePopup = new Lang.Class({
panelService.connect('set-cursor-location',
Lang.bind(this, function(ps, x, y, w, h) {
Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
if (this._boxPointer.actor.visible)
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
this._setDummyCursorGeometry(x, y, w, h);
}));
panelService.connect('set-cursor-location-relative',
Lang.bind(this, function(ps, x, y, w, h) {
if (!global.display.focus_window)
return;
let window = global.display.focus_window.get_compositor_private();
this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
}));
panelService.connect('update-preedit-text',
Lang.bind(this, function(ps, text, cursorPosition, visible) {
@ -246,6 +251,12 @@ const CandidatePopup = new Lang.Class({
}));
},
_setDummyCursorGeometry: function(x, y, w, h) {
Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
if (this._boxPointer.actor.visible)
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
},
_updateVisibility: function() {
let isVisible = (this._preeditText.visible ||
this._auxText.visible ||