Subject: FVWM: fltk window resizing

From: Isaque Galdino de Araujo <[email-masked]>
Date: Thu, 6 Feb 2003 23:43:30 -0200

Hi guys, I am using the 2.5.5 version and I'm facing a problem using fltk windows.
When I increase the window size, the window is notified, but when it shrinks the window isn't.
Do you you know how to solve that problem?

-- 
Isaque Galdino de Araujo             Slackware, Agenda VR3, Vim and Cygwin user.
http://sites.uol.com.br/isaque                        Java and C/C++ programmer.
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dan Espen <[email-masked]>
Date: Thu, 06 Feb 2003 21:12:51 -0500

Isaque Galdino de Araujo <[email-masked]> writes:
> Hi guys, I am using the 2.5.5 version and I'm facing a problem using
> fltk windows.   When  I increase  the  window  size,  the window  is
> notified, but when it shrinks the window isn't.  Do you you know how
> to solve that problem?

Is "fltk" the "fast light toolkit" at www.fltk.org?

I didn't see any fvwm problems in their bug database, but they did
have a recently fixed OSX resize bug.

I think its unlikly that Fvwm is doing something different
for windows that decrease in size vs. windows that grow in size.
What makes you think this is an Fvwm problem?

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Isaque Galdino de Araujo <[email-masked]>
Date: Fri, 7 Feb 2003 00:27:56 -0200

> Is "fltk" the "fast light toolkit" at www.fltk.org?
Yeah, that's it!

> What makes you think this is an Fvwm problem?
Because I've tested the same application in WindowMaker and the problem didn't happen!

---

From: Dan Espen <[email-masked]>
Date: Fri, 07 Feb 2003 08:26:17 -0500

> Because I've tested the same application in WindowMaker and the problem didn'

I don't know why it works with WindowMaker but not Fvwm.

An application is supposed to redraw itself when it recieves a
ConfigureNotify event.  Fvwm is sending the ConfigureNotify, but
fltk purposely doesn't redraw itself when it gets that event,
it waits for an expose event instead.

I think the expose event comes from the X server.  It looks like
the X server is sending the expose when the window is made larger,
but not when its made smaller.  I think fltk is at fault.

You can "fix" fltk by making the change below, in src/Fl_x.cxx.
My change is marked with "dje":

void Fl_Window::resize(int X,int Y,int W,int H) {
  int is_a_resize = (W != w() || H != h());
  int resize_from_program = (this != resize_bug_fix);
  if (!resize_from_program) resize_bug_fix = 0;
  if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION);
  else if (!is_a_resize) return;
  if (is_a_resize) {
    Fl_Group::resize(X,Y,W,H);
    if (shown()) {
      redraw(); i->wait_for_expose = 0;	// originally 1, dje
    }
  } else {
    x(X); y(Y);
  }
  if (resize_from_program && shown()) {
    if (is_a_resize) {
      if (!resizable()) size_range(w(),h(),w(),h());
      XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
    } else
      XMoveWindow(fl_display, i->xid, X, Y);
  }
}

If you're not working from source, you might want to forward this to
the fltk developers.

---

From: Isaque Galdino de Araujo <[email-masked]>
Date: Mon, 10 Feb 2003 12:59:12 -0200

> If you're not working from source, you might want to forward this to
I'll do that. Thank you!

---

From: Isaque Galdino de Araujo <[email-masked]>
Date: Mon, 10 Feb 2003 13:58:10 -0200

> > If you're not working from source, you might want to forward this to

Dan, I've sent to the fltk development people, what you suggested, and this is what they send me back:

--- cut here ---
isaque at uol dot com dot br wrote:
> ...
 > ...

Actually, I checked the Xlib Programming Manual and the
documentation on ConfigureNotify seems to indicate that the
application should only force/perform a redraw for Expose and
GraphicsExpose events - ConfigureNotify ONLY specifies that the
window has been resized.  From page 75:

     The ConfigureNotify branch, in all applications, will calculate
     the values of variables based on the new window size.  These
     variable values will then be used to calculate where to draw
     things in the Expose branch the next time an Expose event
     occurs.  A ConfigureNotify event is always followed by one or
     more Expose events.

Note the last sentence, which is supported in other sections of
the same manual...

So either fvwm or X server is at fault for not following the X11
specification, and given that only fvwm seems to exibit this
problem, it is likely a fvwm bug.

Setting the redraw() flag but not waiting for an expose could cause
unnecessary redraws on compliant window managers, so I'm not inclined
to add this "fix" to FLTK...

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Printing Software for UNIX                       http://www.easysw.com

--- cut here ---

Please, check out that and see what you can do about that!

Thank you!

---

From: Dan Espen <[email-masked]>
Date: Mon, 10 Feb 2003 14:52:40 -0500

> to add this "fix" to FLTK...

Hmm, I'm bcc'ing Michael since I see he took pains to hide his
email address.

Check out this xfree man page:

http://www.xfree86.org/4.2.0/XResizeWindow.3.html

That indicates that the expose events come from the X server.
BUT, it also says that the expose events are optional.

I don't know what I can do to Fvwm to force the X server to
generate the expose events that fltk wants.

You might call this an X server problem, but I'm not sure they
will accept this as a problem since what the server is doing is
consistent with the man page.

---

From: Dan Espen <[email-masked]>
Date: Tue, 11 Feb 2003 08:50:53 -0500

> notified, but when it shrinks the window isn't.  Do you you know how

The reason you see this problem with Fvwm and not other window
managers is that Fvwm resizes windows by calling
XMoveResizeWindow instead of XResizeWindow.

Fvwm uses this function because it has a "ResizeMove" command.

I doubt we'll be doing any changes to use XResizeWindow instead,
fltk still wouldn't work right with the ResizeMove command.

I doubt we'll be adding an exposure event after the resize,
thats the X server's job and besides, it would cause other
applications to possibly redraw themselves twice.

I can see why the X Server might send an expose event when a window
is made larger, and not when its made smaller, but I don't know why
it only does this on an XMoveResizeWindow.
I guess its possible the XFree developers might help with this.
I didn't test any of this with other X servers.

The "optimization" fltk is doing seems like a good thing, but
its not consistent with the ICCCM and the XFree man pages since
neither says the exposure is required after a resize.  I agree that
the XLib manual says there will be an exposure.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 17 Feb 2003 11:06:50 +0100

> generate the expose events that fltk wants.

You can do nothing.  Expose events are generated when parts of a
window are *exposed*, not when they are covered.  Applications
that need to redraw when the window is shrunk have to react to
the ConfigureNotify.

> consistent with the man page.

No, it's not an X server problem.  It's simply a bug in the
application.

Bye

Dominik ^_^  ^_^