minor events-related cleanup
Layer popup methods and cleanup, fix #2279, fix #2292