Re: [Nautilus-list] Redrawing rows in the eel-image-chooser



The patch looks fine to me.  Go ahead and commit it.

I dunno that there is a good reason why this widget draws the way it
does.  I agree with you it would be simpler to understand if all the
rendering happened only in the expose method.

-re

Owen Taylor wrote:
> 
> While testing my patch from yesterday, I noticed an annoying behavior,
> where when switching themes, half of a row would be redrawn,
> it would pause to load the icons, then the other half of the row
> would be drawn. The effect is fairly disconcerting.
> 
> The following patch flushes the X drawing queue before emitting the
> SELECTION_CHANGED signal on the ImageChooser widget to prevent this.
> 
> It's possible that it would be better to do the XFlush() in the
> code that switches themes, rather than here, since the code
> that switches themes _knows_ that it is about to do a slow
> synchronous operation.
> 
> The use of XFlush() rather than gdk_flush() is because gdk_flush(),
> despite the name, really does an XSync(), which is a more expensive
> operation than we need here. XFlush() is a pretty cheap operation,
> so doing it very unlikely to hurt, XSync() could occasionally take a
> fair bit of time.
> 
> (Right before where I inserted this, there is a call to
> gtk_widget_queue_draw() on the image chooser, which I don't
> understand the reason for and may have been a failed attempt to
> fix the same problem. Or it might be there for some other reason.
> 
> In general, if I was rewriting this widget, I would rewrite it
> to do _all_ it's drawing out of its expose handler,
> gtk_widget_queue_draw_area() on the areas that change, and
> and call gtk_widget_draw() if things needed to be updated
> immediately. In GTK+-2.0, you'd optimally do that with
> gdk_window_invalidate_rect(), gdk_window_process_updates()
> 
> Redrawing in response to updates, as the widget does now, tends
> to be a headache, since you _also_ need to have all the same
> code to redraw in response to expose events.)
> 
> Regards,
>                                         Owen
>




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