[gnome-love] Canvas redraw priority
- From: ERDI Gergo <cactus cactus rulez org>
- To: GNOME hackers <gnome-hackers gnome org>, gnome-love gnome org
- Cc: andersca gnu org
- Subject: [gnome-love] Canvas redraw priority
- Date: Mon, 12 Aug 2002 14:59:29 +0200 (CEST)
[CC'ing Andersca as the canvas maintainer]
Hi,
In Guikachu, much like Dia, you can resize widgets by dragging resize
grips in a preview area implemented as a Canvas. In Guikachu 1.3.0, which
is based on GNOME 1, I've implemented it by using the following flow:
User drags the resize grip
-> GnomeCanvasItem::event handler changes underlying model by calling
set_width/set_height
-> set_width/set_height marks the model as dirty
GTK+ is idle
-> Gtk::Main::idle handler of the model emits a Model::changed signal if
the model is dirty
-> Property editors' Model::changed handler changes the contents of
some GTK+ widgets
-> Preview creator's Model::changed handler removes the preview canvas
item and replaces it with new one, based on new model values
While this may sound overly complicated, it was the only way to make the
canvas preview super-smooth -- you can drag the mouse around as fast as
you can, and the canvas is never lagging or jagged. You might want to try
it out from http://cactus.rulez.org/projects/guikachu/ to see what I mean.
I've spent the last couple of days porting Guikachu to GNOME 2, and I
thought I wouldn't need to touch the preview updating logic. However, it
has become unbearably slow, compared to what I had with GNOME 1 -- about
as slow as the GNOME 1 version was when I directly emitted Model::changed
signals from set_width/set_height, which of course resulted in lots of
unnecessary canvas item destruction/construction.
The GNOME 1 version used GTK_PRIORITY_DEFAULT as the idle priority. With
GNOME 2, Glib's HIGH priority completely removes any smoothness (which is
to be expected since it blocks canvas redraws until the mouse's motion is
stopped), but even LOW isn't nearly as smooth as the GNOME 1 version was.
So what kind of scheduling/flow should I implement to get smoothness
again?
--
.--= ULLA! =---------------------. `We are not here to give users what
\ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001
`---= cactus cactus rulez org =---'
Minden számítógép azonos sebességgel vár.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]