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




> > > 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.

But when a widget has a window, the above code is incorrect, since
the allocation is only relevant in the parent's window.
(Also, if a widget has a window, it does not necessarily cover its
entire allocation area, so I need to clear this in the parent's
window as well.)


> > And it won't work for widgets which have extra child windows,
> > e.g. clist, hscale/vscale, hscrollbar/vscrollbar.
> 
> why?
> I can't see any problem with scale or scrollbar.
> It seems that there is a bug in clist.

gdk_window_clear_area doesn't clear child windows, so the trough
in the scales and the arrors in the scrollbars are not cleared.
(This won't matter for normal use of widgets, but in Glade I draw
over the top of widgets so I need to clear it before redrawing)


> I tink you clear way to many windows :). Maybe this is because
> of the clist bug.

I think my code is correct, if you need to redraw a widget completely.
If you can write a simpler function that works in Glade then I'll
believe you! (Actually I have optimised my code a little now, so it
only clears the parts of the widget which Glade painted over - i.e.
the edges and corners)

Damon




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