[gnome-shell] ibusCandidatePopup: Add support for relative cursor positioning



commit a13357c2a8206e08ff449fcdd92873ae652a5ebc
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Jul 30 14:40:39 2014 +0200

    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

 js/ui/ibusCandidatePopup.js |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index 7ce66a0..5aedc86 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -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 ||


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]