Re: Getting a St.Bin to refresh its position?



Hi Amy,

Call me simple, but the most simple solution for my extension was to
simply unload and load (reload) all widgets, this is so fast that it is
not noticable by eye, it enables me to have it reload in reaction to a
prefs database change. For instance, when I resize the iconsize of my
St.Bin's I can see them grow/schrink live.

So: extension loads icon with prefs size --> you change pref size
in prefs.js --> extension reacts on event signal of pref database
change, either common or specific signal --> it reloads and thus has
the new prefs in place when loading.

b.t.w. I also have a Shell.GenericContainer() with St.Bin's as widget
interface.


-- 
(o_
//\  Regards, Groeten,
V_/_ Bas Burger.


On Fri, 31 Aug 2012 16:00:45 +1000
Amy <mathematical coffee gmail com> wrote:

> Hi all,
> 
> I'm trying to make a workspace switcher like the gnome-panel 2.X one
> for gnome-shell: it's very much like the workspaces sidebar in the
> overview, except that it lives in your top panel, only window icons
> are shown (as opposed to the window thumbnail) and the desktop
> background is not shown. So basically you get a real-time graphical
> representation of the windows in each workspace, where each window is
> really just a rectangle.
> 
> In essence my problem is that I have a WindowClone class (a
> rectangle), and although I update its x and y position, I do not
> *visually* see the rectangle change position like it should.
> I want to do `windowClone.x = newx; windowClone.y = newy;` and see the
> results instantly.
> 
> Further detail:
> 
> I have a Shell.GenericContainer() which sits in the top panel and
> contains all the workspaces.
> 
> Each workspace is a St.Bin that takes up whatever space the
> Shell.GenericContainer() allocates it.
> 
> The child of each workspace St.Bin is a St.Group.
> 
> In each workspace, I have one WindowClone per window in the workspace.
> A WindowClone is a (styled) St.Bin that tracks the
> position/size/minimized state of its underlying window (very much like
> the WindowClone classes in workspaceThumbnail.js and workspace.js).
> 
> So, what happens is that the WindowClone tracks the size-changed and
> position-changed events of its base window, and when that happens, it
> sets the St.Bin's x, y, width and height accordingly.
> 
> My problem is that although the x/y/width/height get updated, I do not
> *see* the change - the St.Bin that corresponds to my window does not
> appear to change position within its workspace.
> 
> The only way I've found to get around this is to call
> .queue_relayout() on the Shell.GenericContainer that contains the
> workspaces (that contains the windows).
> 
> This means each window has to store a reference to the
> great-grandparent Shell.GenericContainer so that whenever a
> size-changed or position-changed event fires, I can call
> 
>     this.grandParent.queue_relayout()
> 
> so that I can visually see the window St.Bin change its position.
> 
> My questions are:
> * should this be happening? in workspaceThumbnails.js, the
> ThumbnailsBox is a Shell.GenericContainer containing
> WorkspaceThumbnails (a Clutter.Group in a St.Group) containing
> WindowClones (Clutter.Clone). When these WindowClones update their
> position they do *not* have to call .queue_relayout() on the
> Shell.GenericContainer, and their position is visually updated. So why
> do I have to?
> * if this *should* be happening, is the only way for me to get the
> desired effect to store a pointer to the Shell.GenericContainer in
> each WindowClone so that I can call .queue_relayout() on the
> appropriate window events? It doesn't seem right that the WindowClone
> should have to know about its great-grandparent in order to be
> displayed correectly?
> * is there a way for me to call WindowClone.propogate_queue_relayout()
> such that the queue_relayout() request gets relayed up all the way to
> the Shell.GenericContainer without me having to store the pointer
> myself? This seems like a better way for it to be done (and calling
> .queue_relayout() on the Window St.Bin and/or the Workspace
> St.Group/St.Bin does not have the desired effect; only calling it on
> the Shell.GenericContainer seems to cause the window St.Bins to be
> repainted).
> 
> I notice that if I add a St.Bin directly to (say) global.stage,
> updating its x/y causes *instant* relayout, so it must be something to
> do with the way I've parented everything. I suspect the
> Shell.GenericContainer.
> 
> cheers.
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list



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