wx draw_idle

Hi,

The attached patch has a couple of changes to the wx backend that I
want people to test before I commit.

1) implement draw_idle. Rather than using the wx IdleEvent which seemed
to be triggered too often I used a timer which is delayed and possibly
reset if a new draw request comes within a certain time period (5 ms),
or if there are pending wx events. The scheme isn't perfect since wx
doesn't see all the native events, but it seems to work well enough.

2) Don't draw bitmap on the screen if the graph isn't shown. Otherwise
a plot inside of a wx aui notebook bleeds through even if the graph
notebook is not on top.

3) Don't regenerate entire plot for each PaintEvent. Instead, only
draw the graph if this is the first time the window is exposed, otherwise
work from the bitmap. I've only tested this for wxagg on the mac. I don't
know if it breaks wx, or if anyone cares about wx anymore.

Let me know if it works for you.

  - Paul

wx.patch (4.46 KB)

Paul Kienzle wrote:

1) implement draw_idle. Rather than using the wx IdleEvent which seemed
to be triggered too often

good idea -- the wx Idle event is triggered A LOT. I've never found a use for it.

I used a timer which is delayed and possibly
reset if a new draw request comes within a certain time period (5 ms),

That's a common trick, and has always worked well for me.

or if there are pending wx events. The scheme isn't perfect since wx
doesn't see all the native events, but it seems to work well enough.

I'm confused here -- what events are missed, and why? What do you mean by a "native" event?

2) Don't draw bitmap on the screen if the graph isn't shown. Otherwise
a plot inside of a wx aui notebook bleeds through even if the graph
notebook is not on top.

hmmm odd -- this does sound right, but shouldn't wx only be re-drawing in a Paint event anyway?

3) Don't regenerate entire plot for each PaintEvent. Instead, only
draw the graph if this is the first time the window is exposed, otherwise
work from the bitmap.

This is odd to me too -- I haven't dug into the wx back-end, but it seems the Paint Event should only trigger a blit of the bitmap to the screen anyway.

> I've only tested this for wxagg on the mac. I don't

know if it breaks wx, or if anyone cares about wx anymore.

You mean wx, rather then wxAgg? I now some folks have found it useful for remote X sessions -- but I don't know how important it is to support that.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...236...