Calculate optimum number of columns for table

Stephan Haller nomad at froevel.de
Tue Sep 8 05:50:35 CEST 2015


It is a very simple one. It tries to spread all visible children evenly
into rows and colums.

http://git.xfce.org/apps/xfdashboard/tree/xfdashboard/scaled-table-layo
ut.c#n125


Am Dienstag, den 08.09.2015, 01:30 +0100 schrieb adlo:
> At the moment, xfdashboard seems to increase the number of columns as
> the number of windows increases. What algorithm is it using to do
> this?
> 
> 
> 
> > On 7 Sep 2015, at 18:54, Stephan Haller <nomad at froevel.de> wrote:
> > 
> > BTW: This is the algorith I decided to give a first try when I'm
> > going
> > to implement it into xfdashboard. It's javascript but should be
> > ported
> > to C easily.
> > 
> > http://codeincomplete.com/posts/2011/5/7/bin_packing/
> > 
> > I hope it helps.
> > 
> > 
> > Am Montag, den 07.09.2015, 19:42 +0200 schrieb Stephan Haller:
> > > Hi adlo,
> > > 
> > > I have this problem either in xfdashboard. I learned that this is
> > > a
> > > "packing problem", sometimes also called "bin packing problem" or
> > > "box
> > > packing problem".
> > > 
> > > I haven't implemented any of these algorithm yet, so I cannot say
> > > if it
> > > really helps and how hard it is to implement. But I think you
> > > could
> > > start your search there.
> > > 
> > > Regards,
> > > Stephan
> > > 
> > > Am Montag, den 07.09.2015, 16:15 +0100 schrieb adlo:
> > > > I am writing a program that displays previews of all open
> > > > windows in a grid/table. Depending on factors such as the
> > > > dimensions of the grid and the number of previews displayed, it
> > > > would be useful to dynamically change the number of
> > > > columns/rows in the grid, in order to ensure that the previews
> > > > are as large as possible while making the best use of the
> > > > available space.
> > > > 
> > > > For example, when there are only a few previews, the number of
> > > > columns and rows can be reduced in order to ensure that the
> > > > previews are as large as possible. However, if there are a lot
> > > > of previews and there is some extra horizontal space, the
> > > > number of columns should be increased.
> > > > 
> > > > It would be useful to have an algorithm that could calculate
> > > > the optimum number of columns. Does anyone have any ideas?
> > > > 
> > > > Regards
> > > > 
> > > > adlo
> > > > _______________________________________________
> > > > Xfce4-dev mailing list
> > > > Xfce4-dev at xfce.org
> > > > https://mail.xfce.org/mailman/listinfo/xfce4-dev
> > > 
> > > 
> > > _______________________________________________
> > > Xfce4-dev mailing list
> > > Xfce4-dev at xfce.org
> > > https://mail.xfce.org/mailman/listinfo/xfce4-dev
> > 
> > 
> > _______________________________________________
> > Xfce4-dev mailing list
> > Xfce4-dev at xfce.org
> > https://mail.xfce.org/mailman/listinfo/xfce4-dev
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> https://mail.xfce.org/mailman/listinfo/xfce4-dev


More information about the Xfce4-dev mailing list