From 65574004a1a13198f4635bb38ebf568dd863fd6e Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Sat, 24 Oct 2020 23:15:45 +0200 Subject: [PATCH] added test event handler for window close --- main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.cpp b/main.cpp index 1cf3d2d..8da4191 100644 --- a/main.cpp +++ b/main.cpp @@ -69,6 +69,10 @@ int main(int argc, const char * argv[]) { // main window sc::gui::Window& window {sc::gui::Window::new_window("screensaver")}; + window.add_event_handler([](const SDL_Event& event, bool quit) -> bool { + std::cerr << "closing window " << event.window.windowID << '\n'; + return quit; + }, SDL_WINDOWEVENT_CLOSE); int opt_char, opt_val; struct option long_options[] = {