protected override void OnRealized()
{
WidgetFlags |= WidgetFlags.Realized;
GdkWindow = ParentWindow;
base.OnRealized ();
Gdk.WindowAttr attr = Gdk.WindowAttr.Zero;
attr.WindowType = Gdk.WindowType.Child;
attr.X = Allocation.X;
attr.Y = Allocation.Y;
attr.Width = Allocation.Width;
attr.Height = Allocation.Height;
attr.Wclass = Gdk.WindowClass.InputOnly;
attr.EventMask = (int) Events;
attr.EventMask |= (int) (Gdk.EventMask.ButtonPressMask |
Gdk.EventMask.ButtonReleaseMask |
Gdk.EventMask.PointerMotionMask);
event_window = new Gdk.Window (GdkWindow, attr, (int) (Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y));
event_window.UserData = this.Handle;
}