You can get the correct XID from the drawing area`s widget->window using the apis in gdkx.h The tricky thing with GtkNotebook is that it maps pages on demand, so if you want to do this trick inside a notebook you need to ensure that its page has been mapped and realized once (possibly by just showing that page and realizing the notebook with that page shown). Cheers, -Tristan