[Gtk-sharp-list] best strategy for bitmapped windows?

Sam Hocevar sam at zoy.org
Thu Nov 1 14:05:35 EDT 2007


   I am trying to write a GTK# application that has a bitmapped window,
a bit like XMMS, with resizing support, round corners etc.

   My strategy is to have a Gtk.Table as the window's top level widget,
with each cell containing a Gtk.DrawingArea except the cells that
will host standard GTK widgets. I then override each DrawingArea's
OnExposeEvent method this way:

    protected override bool OnExposeEvent(Gdk.EventExpose args)
    {
        Gdk.Window win = args.Window;
        int w = Allocation.Width;
        int h = Allocation.Height;

        Gdk.Pixbuf tmp = pb.ScaleSimple(w, h, Gdk.InterpType.Hyper);
        win.DrawPixbuf(Style.BaseGC(StateType.Normal),
                       tmp, 0, 0, 0, 0, w, h,
                       Gdk.RgbDither.Normal, 0, 0);

        return true;
    }

   However the resulting effect is ugly flicker when resizing the
window. What strategy would you suggest to tell GTK not to refresh
anything until all the OnExposeEvent signals have been processed? Or
maybe I should do something totally different?

   If anyone is interested, my code can be found here:
     http://people.zoy.org/~sam/mono/foo3000.tar.gz

Regards,
-- 
Sam.


More information about the Gtk-sharp-list mailing list