Mainly fixes to properly differentiate between toplevel and offscreen windows, since these sometimes need different treatment. Furthermore, usage of gdk_window_get_effective_foo() instead of gdk_window_get_foo() where applicable.