[comp.windows.x] Expose and ConfigureNotify events

mouse@LARRY.MCRCIM.MCGILL.EDU (11/21/90)

> Using the Xt Translation mechanism, I select for Expose and
> ConfigureNotify on a (Form) widget.  However, I notice that if I
> resize the window using the window manager, then in general I get
> both Expose and ConfigureNotify events, except when I make the window
> smaller by dragging the right corner inwards; in that case, I only
> get a ConfigureNotify (and no Expose event).

> Question: I want an Expose event in all cases, i.e. whenever the
> window is resized, I want a guaranteed Expose event.  Is there a way
> to do this?

Yes.  Set the window's bit-gravity to ForgetGravity.  Since this is the
default, something somewhere along the line (Xt or the widget set, most
likely) is changing it.  I suppose you could just bash the bit-gravity
of your window, but there's no guarantee that whatever changed it for
you in the first place won't helpfully change it back, so you should
get out the documentation and find out how to suppress this behavior.
(I can't help you there; I don't know Xt or widgets.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

jordan@morgan.COM (Jordan Hayes) (11/29/90)

	I notice that if I resize the window using the window manager,
	then in general I get both Expose and ConfigureNotify events,
	except when I make the window smaller by dragging the right
	corner inwards; in that case, I only get a ConfigureNotify (and
	no Expose event).

Yes, this is true.  No exposure events are generated for this action,
since nothing becomes exposed that wasn't already exposed.

	Question: I want an Expose event in all cases, i.e. whenever
	the window is resized, I want a guaranteed Expose event.

This is like saying "I want a guarantee of rain when it is sunny" ...

Are you sure you want this?

/jordan

clive@x.co.uk (Clive Feather) (11/29/90)

In article <9011211352.AA11575@Larry.McRCIM.McGill.EDU> mouse@LARRY.MCRCIM.MCGILL.EDU writes:
>> Question: I want an Expose event in all cases, i.e. whenever the
>> window [Form widget] is resized, I want a guaranteed Expose event.
>Yes.  Set the window's bit-gravity to ForgetGravity.  Since this is the
>default, something somewhere along the line (Xt or the widget set, most
>likely) is changing it.  I suppose you could just bash the bit-gravity
>of your window, but there's no guarantee that whatever changed it for
>you in the first place won't helpfully change it back, so you should
>get out the documentation and find out how to suppress this behavior.

What is happening is that the Form widget does not define an expose method,
and therefore (section 2.5.1 of the Xt manual) the bit_gravity is set to
NorthWestGravity by the realize handler. Thus, this is being set by XtRealize,
and it is safe to change it at any subsequent point.

If I remember (the article seems to have expired here), the original
questioner wanted to draw in the background of a Form widget. The *correct*
way for her to do this is to define a subclass of Form. This would have all
its methods NULL or XtInherit..., except for the expose method, which would
carry out the actions she wants (perhaps calling a callback list). Because
the expose method is not NULL, the bit_gravity will be left as ForgetGravity.

This is much less work than you think.
-- 
Clive D.W. Feather     | IXI Limited         | If you lie to the compiler,
clive@x.co.uk          | 62-74 Burleigh St.  | it will get its revenge.
Phone: +44 223 462 131 | Cambridge   CB1 1OJ |   - Henry Spencer
(USA: 1 800 XDESK 57)  | United Kingdom      |