only allow registering menus from top level windows

Signed-off-by: Gerald <gera2ld@163.com>