diff -ru a/mywidget.cc b/mywidget.cc
--- a/mywidget.cc	2010-04-25 11:04:33.979247670 +0100
+++ b/mywidget.cc	2010-04-25 11:41:52.013645198 +0100
@@ -51,6 +51,10 @@
         G_PARAM_READABLE) );
 
   gtk_rc_parse("custom_gtkrc");
+
+  //set colors
+  modify_bg(Gtk::STATE_NORMAL , Gdk::Color("red"));
+  modify_fg(Gtk::STATE_NORMAL , Gdk::Color("blue"));
 }
 
 MyWidget::~MyWidget()
@@ -60,9 +64,6 @@
 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 void MyWidget::on_size_request(Gtk::Requisition* requisition)
 {
-  //Initialize the output parameter:
-  *requisition = Gtk::Requisition();
-
   //Discover the total amount of minimum space needed by this widget.
 
   //Let's make this simple example widget always need 50 by 50:
@@ -78,24 +79,6 @@
 
   //Use the offered allocation for this container:
   set_allocation(allocation);
-
-  if(m_refGdkWindow)
-  {
-    m_refGdkWindow->move_resize( allocation.get_x(), allocation.get_y(),
-            allocation.get_width(), allocation.get_height() );
-  }
-}
-
-void MyWidget::on_map()
-{
-  //Call base class:
-  Gtk::Widget::on_map();
-}
-
-void MyWidget::on_unmap()
-{
-  //Call base class:
-  Gtk::Widget::on_unmap();
 }
 
 void MyWidget::on_realize()
@@ -109,57 +92,15 @@
   get_style_property("example_scale", m_scale);
   std::cout << "m_scale (example_scale from the theme/rc-file) is: "
       << m_scale << std::endl; 
-
-  if(!m_refGdkWindow)
-  {
-    //Create the GdkWindow:
-
-    GdkWindowAttr attributes;
-    memset(&attributes, 0, sizeof(attributes));
-
-    Gtk::Allocation allocation = get_allocation();
-
-    //Set initial position and size of the Gdk::Window:
-    attributes.x = allocation.get_x();
-    attributes.y = allocation.get_y();
-    attributes.width = allocation.get_width();
-    attributes.height = allocation.get_height();
-
-    attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK; 
-    attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.wclass = GDK_INPUT_OUTPUT;
-
-
-    m_refGdkWindow = Gdk::Window::create(get_window() /* parent */, &attributes,
-            GDK_WA_X | GDK_WA_Y);
-    set_has_window();
-    set_window(m_refGdkWindow);
-
-    //set colors
-    modify_bg(Gtk::STATE_NORMAL , Gdk::Color("red"));
-    modify_fg(Gtk::STATE_NORMAL , Gdk::Color("blue"));
-
-    //make the widget receive expose events
-    m_refGdkWindow->set_user_data(gobj());
-  }
-}
-
-void MyWidget::on_unrealize()
-{
-  m_refGdkWindow.clear();
-
-  //Call base class:
-  Gtk::Widget::on_unrealize();
 }
 
 bool MyWidget::on_expose_event(GdkEventExpose* event)
 {
-  if(m_refGdkWindow)
-  {
     double scale_x = (double)get_allocation().get_width() / m_scale;
     double scale_y = (double)get_allocation().get_height() / m_scale;
 
-    Cairo::RefPtr<Cairo::Context> cr = m_refGdkWindow->create_cairo_context();
+    Glib::RefPtr<Gdk::Window> window = get_window();
+    Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
     if(event)
     {
       // clip to the area that needs to be re-exposed so we don't draw any
@@ -194,7 +135,6 @@
     cr->move_to(633.*scale_x, 564.*scale_y);
     cr->line_to(155.*scale_x, 838.*scale_y);
     cr->stroke();
-  }
   return true;
 }
 #endif /* GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED */
diff -ru a/mywidget.h b/mywidget.h
--- a/mywidget.h	2010-04-25 11:04:40.241232665 +0100
+++ b/mywidget.h	2010-04-25 11:36:07.646421297 +0100
@@ -33,15 +33,10 @@
   //Overrides:
   virtual void on_size_request(Gtk::Requisition* requisition);
   virtual void on_size_allocate(Gtk::Allocation& allocation);
-  virtual void on_map();
-  virtual void on_unmap();
   virtual void on_realize();
-  virtual void on_unrealize();
   virtual bool on_expose_event(GdkEventExpose* event);
 #endif /* GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED */
 
-  Glib::RefPtr<Gdk::Window> m_refGdkWindow;
-
   int m_scale;
 };
 
