[gnome-shell/gnome-3-12] layout: Change setDummyCursorPosition to also set the size



commit 1030cdfe8a3684dd1c2763303c355ef0fdf82925
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri Apr 11 16:12:52 2014 +0200

    layout: Change setDummyCursorPosition to also set the size
    
    If we are being used to follow a text entry cursor we also need to set
    the size so that the popup menu avoids covering it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727579

 js/ui/backgroundMenu.js     |    2 +-
 js/ui/ibusCandidatePopup.js |    2 +-
 js/ui/layout.js             |    9 +++++----
 3 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/backgroundMenu.js b/js/ui/backgroundMenu.js
index 71251e5..b3dec1c 100644
--- a/js/ui/backgroundMenu.js
+++ b/js/ui/backgroundMenu.js
@@ -35,7 +35,7 @@ function addBackgroundMenu(actor, layoutManager) {
 
     function openMenu() {
         let [x, y] = global.get_pointer();
-        Main.layoutManager.setDummyCursorPosition(x, y);
+        Main.layoutManager.setDummyCursorGeometry(x, y, 0, 0);
         actor._backgroundMenu.open(BoxPointer.PopupAnimation.NONE);
     }
 
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index 01884f5..ded7cb8 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -155,7 +155,7 @@ const CandidatePopup = new Lang.Class({
 
         panelService.connect('set-cursor-location',
                              Lang.bind(this, function(ps, x, y, w, h) {
-                                 Main.layoutManager.setDummyCursorPosition(x, y);
+                                 Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
                                  if (this._boxPointer.actor.visible)
                                      this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
                              }));
diff --git a/js/ui/layout.js b/js/ui/layout.js
index dc91f02..46cf6ad 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -223,7 +223,7 @@ const LayoutManager = new Lang.Class({
         this._keyboardHeightNotifyId = 0;
 
         // A dummy actor that tracks the mouse or text cursor, based on the
-        // position set in setDummyCursorPosition.
+        // position and size set in setDummyCursorGeometry.
         this.dummyCursor = new St.Widget({ width: 0, height: 0 });
         this.uiGroup.add_actor(this.dummyCursor);
 
@@ -728,7 +728,7 @@ const LayoutManager = new Lang.Class({
         this._updateRegions();
     },
 
-    // setDummyCursorPosition:
+    // setDummyCursorGeometry:
     //
     // The cursor dummy is a standard widget commonly used for popup
     // menus and box pointers to track, as the box pointer API only
@@ -737,9 +737,10 @@ const LayoutManager = new Lang.Class({
     // is what you should use. Given that the menu should not track
     // the actual mouse pointer as it moves, you need to call this
     // function before you show the menu to ensure it is at the right
-    // position.
-    setDummyCursorPosition: function(x, y) {
+    // position and has the right size.
+    setDummyCursorGeometry: function(x, y, w, h) {
         this.dummyCursor.set_position(Math.round(x), Math.round(y));
+        this.dummyCursor.set_size(Math.round(w), Math.round(h));
     },
 
     // addChrome:


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