diff options
author | 2023-05-17 17:31:33 +0200 | |
---|---|---|
committer | 2023-05-17 17:31:33 +0200 | |
commit | 6a992be61bdce9f4bca95822543257321f6815e3 (patch) | |
tree | 95dfe73898d5a8ed565da2530e7bad52e656af03 /src/window.c | |
parent | 34220e6e6aaf6cb819f9d9c9e5e5cd84ba515a37 (diff) | |
download | cherry-6a992be61bdce9f4bca95822543257321f6815e3.tar.gz cherry-6a992be61bdce9f4bca95822543257321f6815e3.zip |
Add events to exit from application and to close
the window
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c index 7311819..4ca6027 100644 --- a/src/window.c +++ b/src/window.c @@ -54,6 +54,16 @@ cherry_window_new(void) None, NULL, 0, &hints); + /* allow receiving mouse events */ + XSelectInput(app->display, + w->window_handler, + ButtonPressMask | KeyPressMask | ExposureMask); + + Atom wmDelete = XInternAtom(app->display, "WM_DELETE_WINDOW", True); + XSetWMProtocols(app->display, w->window_handler, &wmDelete, 1); + + Atom wmDispose = XInternAtom(app->display, "CHERRY_DISPOSE_ON_EXIT", True); + XSetWMProtocols(app->display, w->window_handler, &wmDelete, 1); w->gc = XCreateGC(app->display, w->window_handler, 0, 0); XSetBackground(app->display, w->gc, WhitePixel(app->display, app->screen)); |