From 014a8aacd1e30bd5d13ba676065438ba8d3fbf1e Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Wed, 17 May 2023 17:33:13 +0200 Subject: Add cherry_window_dispose_on_exit() function --- src/window.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/window.c') diff --git a/src/window.c b/src/window.c index 4ca6027..01218a6 100644 --- a/src/window.c +++ b/src/window.c @@ -74,6 +74,23 @@ cherry_window_new(void) return w; } +void +cherry_window_dispose_on_exit(CherryWindow *w) +{ + CherryApplication *app = cherry_application_get_running_app(); + + XEvent evt; + evt.xclient.type = ClientMessage; + evt.xclient.serial = 0; + evt.xclient.send_event = 1; + evt.xclient.message_type = XInternAtom(app->display, "WM_PROTOCOLS", 0); + evt.xclient.format = 32; + evt.xclient.window = w->window_handler; + evt.xclient.data.l[0] = XInternAtom(app->display, "CHERRY_DISPOSE_ON_EXIT", 0); + + XSendEvent(app->display, w->window_handler, 0, NoEventMask, &evt); +} + char * cherry_window_get_title(CherryWindow *w) { -- cgit v1.2.3