Re: XForms: return after window resize

Steve Lamont (
Thu, 16 Oct 97 06:13:08 PDT

To subscribers of the xforms list from (Steve Lamont) :

> This sort of worked and sort of didn't. The problem that I have now is that
> if I return FL_PREEMPT ater doing my stuff, then a lot of redrawing
> functions stuff up. If I don't return FL_PREEMPT then other events also
> happen after the ConfigureNotify, and they tend to evoke the internal
> resizing operations, which I don't like. ...

You can turn off resizing on any object either in the Attributes
dialog when you set up the object or programmatically, with
fl_set_object_resize(). Then you can manage your resizing yourself.

> ... I also found that when I use the
> (UN)Maximize function of the window manager the ConfigureNotify is sent
> twice and the trick works, but if I drag the corners of the windows, it is
> just sent once at the begining of the operation. (I am using fvwm2).

Some of this is window manager dependent -- the window manager will
often propagate events as it sees fit.

Although I don't know if this will work since I haven't tried it, you
might look at a callback for ConfigureRequest rather than
ConfigureNotify. This may give you a "heads up" as to what the window
mangler is going to do to you.

> I also couldn't get the code working with fl_addto_selected_xevent
> [...]
> VW=create_form_panel();
> fl_addto_selected_xevent(VW, ConfigureNotify);
> [...]
> It complains with
> X Error of failed request: BadWindow (invalid Window parameter)
> Major opcode of failed request: 3 (X_GetWindowAttributes)
> Resource id in failed request: 0x0

The problem here is that you're trying to modify a Window before it's
created [TC, IMHO, this behavior is a bug -- XForms should cache the
event mask until the Window is created]. The call to
create_form_panel() simply builds the internal data structures
necessary to the Form but it does not execute any significant (if any
at all) X functions to actually create the Window.

There are two ways around this: Either call fl_addto_selected_xevent()
after you call fl_show_form() or first call fl_prepare_form_window()
then call fl_addto_selected_xevent(). This creates the Form Window
but does not map it to the screen.

If you use the latter, you will call fl_show_form_window() rather than
fl_show_form() to actually map the Window.

BTW, I perhaps was somewhat unclear in my previous discussion. The
second argument to fl_addto_selected_xevent() is an Event *mask* not
an Event *type* (they're different constants). You should use
StructureNotifyMask rather than ConfigureNotify. My apologies for
perhaps propagating misleading information. As always, refer to your
favorite Xlib manual and the friendly XForms manual for exact details.

Finally, can you be more descriptive about the resizing activity that
goes on which you don't like? There are a number of different options
for handling Object resizing and I can usually find a proper
combination of gravity and resize action to suit my needs, though
sometimes it takes a bit of experimentation to get it completely right.

To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: