Re: XForms: ConfigureNotify event late arrival

Mark Edward Johnston (M.E.Johnston@damtp.cam.ac.uk)
Mon, 2 Jun 1997 15:24:48 +0100 (BST)

To subscribers of the xforms list from Mark Edward Johnston <M.E.Johnston@damtp.cam.ac.uk> :

I don't know if it's the same thing, but I had problems resizing forms
programatically while displaying them on an Irix 5.3 display. (V0.80
though). Basically, when I tried to make a form smaller a few times in a
row, sometimes it didn't seem to have done one resize before I tried the
next, and I was left with blank space in my form (I removed objects but
the form didn't get smaller). It only happened intermittently, and I
tried various combinations of XSync()s, little delays, and tried
fl_winresize() instead of fl_set_form_size(), but the problem didn't ever
go away completely.

What I do now is pretty crude, but seems to work (see following code
(C++)), although I'd appreciate a more elegant solution.

Mark J.

// resize parent form :

FL_Coord oldwidth, oldheight;
fl_get_winsize(form_window, &oldwidth, &oldheight);
FL_Coord desired_newheight = oldheight + panelheight;

// fl_set_form_size(pform, oldwidth, desired_newheight);
fl_winresize(form_window, oldwidth, desired_newheight);

XFlush(fl_get_display());

#if 1 // Resizing seems to be a problem. Do this checking all the time.
cerr << "Tried to resize window. Oldht = " << oldheight <<
"; desired_newheight = " << desired_newheight << endl;

FL_Coord actual_newwidth, actual_newheight;
fl_get_winsize(form_window, &actual_newwidth, &actual_newheight);
cerr << "actual newheight = " << actual_newheight << endl;

// Terrible hack !!!!! :
// wait for a bit so that XForms gets to catch up with itself
// (otherwise resizing not done correctly sometimes)
// (we wait until the new height is what it should be)

if (actual_newheight != desired_newheight)
cerr << "actual_newheight != desired_newheight. Waiting..." << endl;

while (actual_newheight != desired_newheight) {
fl_get_winsize(form_window, &actual_newwidth, &actual_newheight);
}

cerr << "Waited; actual_newheight now = " << actual_newheight << endl;
#endif

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/