Have you looked at the custom widget
example in the gtkmm tutorial?
https://developer.gnome.org/gtkmm-tutorial/stable/sec-custom-widgets.html.en https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/custom/custom_widget/mywidget.cc Two differences between your code and the custom widget example strike me. 1. In on_realize() you have set_window(get_parent_window()) instead of set_window(_event_window). 2. In on_unrealize() you have set_realized(false) where the custom widget example has Gtk::Widget::on_unrealize(). Gtk::Widget::on_unrealize() calls gtk_widget_real_unrealize() which among other things calls gdk_window_destroy(). The custom widget example is written for gtkmm3. I don't know if some details are different in gtkmm2. This bug discusses the warning that you get: https://bugzilla.gnome.org/show_bug.cgi?id=606903 I have written some of the comments in that bug, but I don't remember all the details now. Kjell 2013-04-17 23:01, Виталий Кирсанов skrev:
|