repaint on resize
"Luis A. Montes" <[email protected]> Mon, 31 Oct 2011 10:29:32 -0700
| Newsgroups | gmane.comp.scigraphica.gtkextra |
|---|---|
| Organization | Quantum Design |
| Message-ID | <1320082172.21084.1539.camel@firmware> |
Hi,
I've solved my problem with multiple sets, it was actually on my code,
not gtkextra. I'm not using 3.0.1 yet, though. But I want to get it
working with my current version and then I can try to see if I can
figure out why 3.0.1 is not drawing on the canvas under MS windows.
The only thing left before I do that is to repaint the plot after a
window resize. The plot seems to repaint itself on an expose event (that
is, if I cover the window and then uncover it, it repaints) but several
combinations of gtk_plot_paint and/or send_expose on_size_allocate,
on_idle, on_realize either don't do anything or produce a SIGV. Anybody
has some trick that can share?
The last thing I tried involved sending a delayed expose event (I'm
using gtkmm):
void GtkPlotWrapper::on_size_allocate( Gtk::Allocation &allocation )
{
set_allocation( allocation );
gtk_plot_canvas_set_size(
GTK_PLOT_CANVAS(pImpl->m_canvas),
allocation.get_width(),
allocation.get_height() );
gtk_widget_set_uposition(
GTK_WIDGET(pImpl->m_canvas),
allocation.get_x(),
allocation.get_y() );
pImpl->m_resized = true;
pImpl->m_resized_time_stamp = clock();
}
bool GtkPlotWrapper::on_idle()
{
if (pImpl){
if ((pImpl->m_resized)&&(clock()-pImpl->m_resized_time_stamp>500))
send_expose((GdkEvent *)&pImpl->m_event);
pImpl->m_resized = false;
}
return true;
}
If I change the send_expose with a gtk_plot_paint it segfaults.
Thanks again,
Luis
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev