Re: [gtk-list] RE: How to redraw a widget completely?



On Mon, 10 Aug 1998, Patrice Fortier wrote:

> > 
> > 
> > > For current GTK+, your best hope is:
> > > 
> > >  gdk_window_clear_area (widget->window, 
> > >                         widget->allocation.x,
> > >                         widget->allocation.y,
> > >                         widget->allocation.width,
> > >                         widget->allocation.height);
> > >  gtk_widget_queue_draw (widget);
> > 
> > 
> > I think this is slightly wrong - a widget's allocation is relative to its
> > parent widget's window, rather that its own (if it has one).
> 
> When you create a no_window widget, you have something like
>   widget->window = widget->parent->window;
> 
> So the above code is correct.

the above needs to be special cased for NO_WIDNOW widgets then. also
not all parents with NO_WINDOW widgets have widget->window =
widget->parent->window; e.g. the viewport children have viewport->bin_window,
as their own parent window.

but basically

if (GTK_WIDGET_NO_WINDOW (widget))
  gdk_window_clear_area (widget->window,
                         widget->allocation.x,
                         widget->allocation.y,
                         widget->allocation.width,
                         widget->allocation.height);
else
  gdk_window_clear (widget->window);

should do the trick.

> 
> > And it won't work for widgets which have extra child windows,
> > e.g. clist, hscale/vscale, hscrollbar/vscrollbar.
> 

hm, but then you don't draw in the child windows in the first
place, so there is no need to clear them, right?

> why?
> I can't see any problem with scale or scrollbar.
> It seems that there is a bug in clist.
> 

> > 
> > 
> > Also, gtk_widget_queue_draw() doesn't redraw a GtkCList properly - the
> > column titles and the scrollbars are not drawn.
> > I have to use both of these:
> > 
> >   gtk_widget_draw (widget, NULL);
> >   gtk_widget_draw_children (widget);
> > 
> > Does this matter? Is this a bug in CList?
> 
> Checking the sources of clist, yes this is a bug in clist.
> 
> I tink you clear way to many windows :). Maybe this is because
> of the clist bug.
> 
> 
> Lokh.
> 

---
ciaoTJ



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