Re: Vertical centering an actor



On 5 July 2012 16:46, Jasper St. Pierre <jstpierre mecheye net> wrote:
> On Thu, Jul 5, 2012 at 10:35 AM, Michele <micxgx gmail com> wrote:
>> On 5 July 2012 16:08, Jasper St. Pierre <jstpierre mecheye net> wrote:
>>> On Thu, Jul 5, 2012 at 10:03 AM, Michele <micxgx gmail com> wrote:
>>>> I'm facing some problems with what seemed to me a trivial thing at
>>>> first glance. I just want to vertical align an actor to the center of
>>>> the screen. This actor is added to Main.uiGroup and its size is
>>>> variable. The actor at issue is the gnome shell dash that I moved out
>>>> of the overview in the dash-to-dock extension.
>>>>
>>>> I've tried  to achieve this result in a lot of different ways but none
>>>> of them is working properly.
>>>>
>>>> 1. Put the actor inside a container like St.Bin and use the y_align
>>>> property to keep it at middle. This works but the extra void area
>>>> above and below the child actor steal click events from the window
>>>> actors. Applying a clip to the actor affects only it's visibility and
>>>> not such events.
>>>
>>> Set the St.Bin's reactivity to false?
>>
>> This doesn't seem to work unfortunately. If a window is below a non
>> reactive actor I still can't click it. Should clicks arrive to the
>> window in such instance?
>
> Yes. The chrome should track reactivity and shape the COW accordingly.

Just to be sure, I've tried with a basic extension. This is the code
I've used to test it:

const St = imports.gi.St;
const Main = imports.ui.main;

let actor;

function init() {
    actor = new St.Bin({ reactive: false });
}

function enable() {
	Main.layoutManager.addChrome(actor);

	actor.set_style('border:1px solid red');
	actor.set_size(100,100);
	actor.set_position(200,200);
}

function disable() {
	actor.destroy();
}

The part of a window below the red square doesn't get any click. The
only way to make the actor passive is by setting AffectsInputRegion to
false in addChrome, but then all the actor's children don't get mouse
events too.

What does COW stand for?


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