aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-17 17:33:13 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-17 17:33:13 +0200
commit014a8aacd1e30bd5d13ba676065438ba8d3fbf1e (patch)
tree7408f4d3822d7e9b634a38e43dc49a3c09e883ae /src
parent6a992be61bdce9f4bca95822543257321f6815e3 (diff)
downloadcherry-014a8aacd1e30bd5d13ba676065438ba8d3fbf1e.tar.gz
cherry-014a8aacd1e30bd5d13ba676065438ba8d3fbf1e.zip
Add cherry_window_dispose_on_exit() function
Diffstat (limited to 'src')
-rw-r--r--src/window.c17
-rw-r--r--src/window.h1
2 files changed, 18 insertions, 0 deletions
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)
{
diff --git a/src/window.h b/src/window.h
index f024feb..b3cfd19 100644
--- a/src/window.h
+++ b/src/window.h
@@ -19,6 +19,7 @@ typedef struct CherryWindow {
} CherryWindow;
CherryWindow *cherry_window_new(void);
+void cherry_window_dispose_on_exit(CherryWindow *);
char *cherry_window_get_title(CherryWindow *);
void cherry_window_set_title(CherryWindow *, char *);
void cherry_window_set_dimension(CherryWindow *, int, int);