Re: Vertical centering an actor



On 5 July 2012 18:45, Jasper St. Pierre <jstpierre mecheye net> wrote:
> On Thu, Jul 5, 2012 at 12:03 PM, Michele <micxgx gmail com> wrote:
>> 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.
>
> Hm, I swore we tracked reactivity. We don't. Unfortunately, it's going
> to be hard to do. You have to track the actor's children manually --
> use Main.layoutManager.trackActor.

Wonderful! I've just tried adding the container actor with
affectInputRegion:false

Main.layoutManager.addChrome(containerActor, { affectsInputRegion:false} );

and calling

Main.layoutManager._chrome.trackActor(childActor, {affectsInputRegion:true});

on the  only child actor I need to be tracked. At first glance It
seems to work properly. Am I missing anything? In particular, should I
do something  on the extension disable function like calling
_untrackActor for instance or is it enough to destroy the actor?

>> What does COW stand for?
>
> Composite Overlay Window. See
> http://blog.mecheye.net/2012/06/the-linux-graphics-stack/ for more
> information.

Thank you for the link, I will have a look at it.


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