Re: Problems with expose_event->region patch



On 8 Mar 2001, Owen Taylor wrote:

> > + **/
> > +void
> > +gtk_container_propagate_expose (GtkContainer   *container,
> > +				GtkWidget      *child,
> > +				GdkEventExpose *event)
> > +{
> > +  GdkEventExpose child_event;
> > +
> > +  g_return_if_fail (GTK_IS_CONTAINER (container));
> > +  g_return_if_fail (GTK_IS_WIDGET (child));
> > +  g_return_if_fail (event != NULL);
> > +
> > +  g_assert (child->parent == GTK_WIDGET (container));
> >
> > +  if (GTK_WIDGET_DRAWABLE (child) &&
> > +      GTK_WIDGET_NO_WINDOW (child))
> 
> To handle containers with multiple windows, you should check to
> see if event->window == widget->window.

eh? i think he should rather check for the window that is set
as parent_window for children of the container instead of
widget->window (assuming this is the portion where he propagates
to NO_WINDOW children).

> > +/**
> > + * gtk_widget_send_expose:
> > + * @widget: a #GtkWidget
> > + * @event: a expose #GdkEvent
> > + *
> > + * Very rarely-used function. This function is used to emit
> > + * an expose event signals on a widget. This function is not
> > + * normally used directly. The only time it is used is when
> > + * propagating an expose event to a child NO_WINDOW widget, and
> > + * that is normally done using gtk_container_propagate_expose.
> > + *
> > + * If you just want to synthesize an expose event, use
> > + * gdk_window_invalidate_rect() to invalidate a region of the
> > + * window.
> 
>  If you want to force an area of a window to be redrawn, 
>  use gdk_window_invalidate_rect() or gdk_window_invalidate_region().
>  To cause the redraw to be done immediately, follow that call
>  with a call to gdk_window_procss_updates().

urm, just looked at that function to see what it does, i'd actually
have it expected to queue an expose event, but instead you
also dispatch that right away through gdk_event_func (gtk_main_do_event).
since the caller might be anywhere in a deep callstack i'm not so sure
this is a good idea...
why couldn't that simply be:
gdk_window_queue_updates();
while (g_main_pending ())
  g_main_iteration (FALSE);

?

> 
> (Regards,
>                                         Owen
> 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]