Vertical centering an actor



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.

2. Use notify::height to manually update the actor vertical position.
This cause a lot of Clutter allocation cycles warnings.

3. Patch Main.uiGroup allocate function. Direclty replacing the
allocate function in the shell code works like expected. However, I
can't remove the original signal (It's a genericContainer) since I
can't obtain it's id. I also tried obtaining it with
'g_signal_handler_find', but I had problems understanding what should
be passed as the 'gpointer instance' first argument. Thus I can only
add an additional signal and reallocate the actor at the correct
vertical position. This seemed to work at first although I'm doubling
the number of allocation calls, but dash popupmenus are often placed
at the wrong position.

4.) Connect to the actor 'allocation-changed' signal and force a
reallocation of the actor itself. This seemingly works, but I'm not
sure if it's a good practice. I don't see any warning or error and I'm
still allocating the actor twice as needed. Popupmenus are in the
correct position tough.

5.) Set the actor anchor_point to CLUTTER_GRAVITY_WEST so that the
position is always correct when it's resized. The main problem here is
that if the dash height is even, the actor appears blurred, since
icons positions are not integer values. I can get over this issue by
setting the y coordinate of the dash at an half-integer value as well,
but nobody assure me that after adding or removing an icon from the
dash it's height will remain always even or always odd.

This problem drove me mad... and now I've run out of ideas. Any
suggestion or correction about my assumptions?


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