Re: Enter-event and leave-event


Thank you for quick reply.

It seems to work. Though I have no idea what exactly has changed under the hood. I seemed to go through a lot of source code of GS from LookingGlass, PopupMenu and likes down to BoxPointer and stuff and did not notice this subtle difference. So, a more thorough explanation later would be much appreciated.


On 03/21/2013 12:23 PM, Jasper St. Pierre wrote:
You've discovered the fun of the input shape! The simple answer is to replace:




I'll follow up with a more thorough explanation to the list in a bit. Hopefully for 3.10 we can fix this better.

On Thu, Mar 21, 2013 at 12:50 PM, Vadim <vadim dbfin com> wrote:
Hi, everyone,

A list new-comer's question.

Here's a very simple "extension" to illustrate the problem:

const Shell =;
const St =;

const Main = imports.ui.main;

function init () {

function enable () {
    let (box = new St.BoxLayout({   reactive: true,
                                    width: 50,
                                    height: 50,
                                    x:    Main.layoutManager.primaryMonitor.x + 50,
                                    y:    Main.layoutManager.primaryMonitor.y
                                        + ( >> 1) })) {
        global.stage._boxTest = box;
        box.set_style('background: rgba(0, 0, 0, 0.7)');;
        box.raise_top(); // let's try everything
        box.connect('enter-event', function () { global.set_cursor(Shell.Cursor.POINTING_HAND); });
        box.connect('leave-event', function () { global.unset_cursor(); });
    } // let (box)

function disable() {
    if (global.stage._boxTest) {
        global.stage._boxTest = null;
What it does is just create a simple fixed sized StBoxLayout and put it so that it covers half panel vertically. So, the box looks like this:


Panel       -----------------------
           | Box           
Area A |
           |                Area B |

Then all I want is to change cursor when the mouse pointer is over the box.

What happens: when the pointer moves to Area A, the cursor indeed changes to "hand". But when it moves to Area B (whether from outside or from Area A) the cursor changes back to normal as if Area B was not a part of the box at all.
In fact, in Area B the cursor changes depending on whatever is below the box. In other words, it "sees through the box" and behaves as if there were no box at all.

Somehow, when the box is over the main panel, Clutter delivers the signal/event to the box, otherwise it does not, and moreover if the pointer moves from Area A to Area B the box receives the 'leave-event' signal!

Also, a note: if I change Main.uiGroup to something else, like its parent global.stage, it does not change anything. And, of course, changing the box's opacity to 1.0 does not help either. It is set to 0.7 just to see what is below it. Another observation is that if I open, for example, LookingGlass, then the whole box works as expected.

It seems to me that I am missing just a little detail to make it work. So, my question is simple enough: what is missing in the code above.

Thanks in advance for your help,

gnome-shell-list mailing list
gnome-shell-list gnome org


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