how to determine maximum possible window size?



Hello. I've been doing some work on a GTK+ app (avidemux - see http://www.avidemux.org/) and it's been fun learning GTK+.

We have a situation where we need to determine the largest possible size that a window can have and still fit on the screen, after deducting space taken up by panels and such, so that we can scale down the preview video size but only when necessary and no smaller than needed.

However, I can't find any way to query GTK+ (or GNOME) for the remaining available screen real estate. I can get the screen size, but see no way to determine how much is used by panels/etc.

What I have right now is a horrible hack that creates a dummy window, maximizes it, makes it visible, waits for the configure event (the real one, not the 200x200 one that comes first for some reason), records the size reported by the configure event, and destroys the window. That works (mostly), but the has the unpleasant side-effect of "flashing" a giant blank window onto the screen, which on less-than-super-fast machines is kind of distracting. And the "mostly" refers to the fact that I still need to subtract about 10x10 pixels to allow for window borders and other fudgement.

So, is there a better way? Please, tell me there is a better way (and what it is).

Thanks,
   Chris


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