On 18 Jul 2009, at 22:56, Mark Mcvittie wrote:

> Hi,
>
> Quick question as I've searched the site but can only find  
> references to FLTK 2.0.  Would someone be able to explain how one  
> can (with FLTK 1.3):
>
> a) Maximize a window programatically (equivalent to clicking the  
> maximize window hint)?
> b) Determine whether a window is maximized (whether by the user, or  
> programatically)?
>
> Any help would be amazing.

Possibly the methods you want are fullscreen() and fullscreen_off(),  
see the docs for details.

However, this is not guaranteed to work with every WM, and will  
usually try to remove the window decorations into the bargain, which  
may not be what you want. Check the fullscreen demo in the test  
folder to see how it behaves, is that what you want.

If it is *not* what you want, you need to just get the screen  
dimensions for the current monitor (several ways to do this, but  
using one of the Fl::screen_xywh(...) methods is probably simplest  
and most portable), and then pass those values to ::resize(...).
Which actually is pretty much what the maximize button actually does  
in most WM's anyway.

Side note: the dimensions returned by screen_xywh(...) on most WM's  
honour the keep-out regions that the WM has set (e.g. for the  
taskbar, dock, whatever that the WM uses) so is usually smaller than  
the actual monitor window sizes.

I hope that addresses part (a) of your question.

Part (b) is maybe trickier - there is no consistent means to ask the  
WM if a given window is maximised that works across platforms, so  
your best bet might be to use screen_xywh() again to determine the  
window port size, and then compare that against the windows w() and h 
() values to see if it looks like it is maximised or not...

That's about the best I think - others may have cleverer solutions...
-- 
Ian



_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to