aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mgl/window/window.h3
-rw-r--r--src/window/window.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/include/mgl/window/window.h b/include/mgl/window/window.h
index 23b780a..fdffd8d 100644
--- a/include/mgl/window/window.h
+++ b/include/mgl/window/window.h
@@ -62,7 +62,8 @@ struct mgl_window {
typedef enum {
MGL_WINDOW_TYPE_NORMAL,
- MGL_WINDOW_TYPE_DIALOG
+ MGL_WINDOW_TYPE_DIALOG, /* Also sets the window as always on top */
+ MGL_WINDOW_TYPE_NOTIFICATION /* Also sets the window as always on top */
} mgl_window_type;
/* TODO: Some of these parameters only apply to new window */
diff --git a/src/window/window.c b/src/window/window.c
index be8aa14..6ed409a 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -76,6 +76,8 @@ typedef struct {
Atom net_wm_window_type_atom;
Atom net_wm_window_type_normal_atom;
Atom net_wm_window_type_dialog_atom;
+ Atom net_wm_window_type_notification_atom;
+ Atom net_wm_window_type_utility;
Atom motif_wm_hints_atom;
Cursor default_cursor;
Cursor invisible_cursor;
@@ -175,6 +177,8 @@ static int x11_context_init(x11_context *self, bool alpha) {
self->net_wm_window_type_atom = XInternAtom(context->connection, "_NET_WM_WINDOW_TYPE", False);
self->net_wm_window_type_normal_atom = XInternAtom(context->connection, "_NET_WM_WINDOW_TYPE_NORMAL", False);
self->net_wm_window_type_dialog_atom = XInternAtom(context->connection, "_NET_WM_WINDOW_TYPE_DIALOG", False);
+ self->net_wm_window_type_notification_atom = XInternAtom(context->connection, "_NET_WM_WINDOW_TYPE_NOTIFICATION", False);
+ self->net_wm_window_type_utility = XInternAtom(context->connection, "_NET_WM_WINDOW_TYPE_UTILITY", False);
self->motif_wm_hints_atom = XInternAtom(context->connection, "_MOTIF_WM_HINTS", False);
self->default_cursor = None;
self->invisible_cursor = None;
@@ -507,6 +511,15 @@ static void mgl_set_window_type(mgl_window *self, mgl_window_type window_type) {
XChangeProperty(context->connection, self->window, x11_context->net_wm_state_atom, XA_ATOM, 32, PropModeReplace, (unsigned char*)&x11_context->net_wm_state_above_atom, 1L);
break;
}
+ case MGL_WINDOW_TYPE_NOTIFICATION: {
+ const Atom data[2] = {
+ self->net_wm_window_type_notification_atom;
+ self->net_wm_window_type_utility;
+ };
+ XChangeProperty(context->connection, self->window, x11_context->net_wm_window_type_atom, XA_ATOM, 32, PropModeReplace, (const unsigned char*)data, 2L);
+ XChangeProperty(context->connection, self->window, x11_context->net_wm_state_atom, XA_ATOM, 32, PropModeReplace, (unsigned char*)&x11_context->net_wm_state_above_atom, 1L);
+ break;
+ }
}
}