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

> > > >  gdk_window_clear_area (widget->window, 
> > > >                         widget->allocation.x,
> > > >                         widget->allocation.y,
> > > >                         widget->allocation.width,
> > > >                         widget->allocation.height);
> > > >  gtk_widget_queue_draw (widget);
> But when a widget has a window, the above code is incorrect, since
> the allocation is only relevant in the parent's window.

yes, use the code posted by Tim Janik to make the difference
between NO_WINDOW widgets and !NO_WINDOW ones. 

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


This is a problem. Some widgets have their window covering the
whole alloc area, and some the alloc area - 2 * border_width.
I suspect S&P wanted to gain some CPU cycles when calling *_clear_area().

I couldn't find a problem telling _obviously_ that it was a bug,
so thank you for glade :).

I can look at this if Tim or Owen find this is a problem and nobody
else want to do it. 

> 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 think my code is correct, if you need to redraw a widget completely.

yep. If you need to draw ontop of all the windows and clear all the
windows, you have to do that.
Maybe I should get Glade to see what it does (visually, I mean).
I just hope it'll work on my good'ol'sparc lx ;).


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