[XForms] XForms min/max events

Jens Thoms Toerring jt at toerring.de
Sun Oct 19 18:17:27 EDT 2008

To subscribers of the xforms list

Hi Serge,

   nice to have you back on board;-)

> My problem was when a user minimized the screen using the window
> manager decoration I did not have a way of knowing whether I should
> raise the window or not since no variable was set. Hence my need to
> trap the iconify action from the window manager.

> I tried using the "fl_form_is_visible(form);" call but it always
> returns TRUE whether the form is on the display or minimized. Other
> attempts proved fruitless. i.e checking "form->visible" and
> "form->wm_border" variables.

> The problem was resolved by using the "XGetWindowAttributes(fl_display,
> win_mini, &xwa);" call. This call fills the xwa structure and one
> variable in that structure is "xwa.map_state". This is TRUE if the
> window is on the display and FALSE if it is minimized or not on the
> current display. A test of this variable after a caller event was all I
> needed to know if I should set my variables and raise the window.<br>

The value of "form->visible" or the return value of the function
fl_form_s_visible() only get changed by calls of the fl_hide_form()
or fl_free_form() function but not by the window getting unmapped
when it's iconified (XForms doesn't deal with the Unmap/Map event
except by calling XRefreshKeyboardMapping() on a MappingNotify
event). So even when the window is in iconified state it's treated
as "visible". As you already found out you have to query the
window attributes to find out if the window is mapped (but note
that the "map_state" value isn't just a boolean, there are three
possible values it can have, IsUnmapped (0), IsUnviewable (1) and
IsViewable (2), the IsUnviewable value undicating that while the
window itself is mapped a parent window is unmapped so it's not
really shown on the screen). So the combination of "form->visible"
being set to FL_VISIBLE (or the corresponding return value of
fl_form_is_visible()) together with XGetWindowAttributes() telling
you that the window is not mapped looks like the best indication of
the window being in iconified state.

Perhaps I should add a function with a name like fl_form_is_iconified()
to make it easier to check for this. While the name of the function
fl_form_is_visible() is a bit unlucky I wouldn't like to change its
behaviour since that might break programs that rely on it to tell you
if a form has been hidden by a call of fl_hide_form() etc. or not. Or
do you need a callback for a form's window becoming iconified or de-
                              Best regards, Jens
  \   Jens Thoms Toerring  ________      jt at toerring.de
   \_______________________________      http://toerring.de
To unsubscribe, send any message to
xforms-leave at bob.usuhs.mil or see: 
List Archive: http://bob.usuhs.mil/pipermail/xforms and
Development: http://savannah.nongnu.org/files/?group=xforms

More information about the Xforms mailing list