From d2ff12c999cad6b468f3614fbf3c0d430c21c84a Mon Sep 17 00:00:00 2001 From: Lars Luthman Date: Sat, 22 Aug 2015 22:46:04 +0200 Subject: [PATCH] Made notifications appear above fullscreen windows, added configuration key to revert to the old behaviour: /xfwm4/general/show_notifications_above_fullscreen, boolean --- src/client.h | 3 ++- src/display.c | 1 + src/display.h | 1 + src/hints.h | 1 + src/netwm.c | 22 +++++++++++++++++++++- src/settings.c | 7 +++++++ src/settings.h | 1 + 7 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/client.h b/src/client.h index e8bc4e3..f06d3dd 100644 --- a/src/client.h +++ b/src/client.h @@ -234,7 +234,8 @@ typedef enum WINDOW_TOOLBAR = (1 << 5), WINDOW_MENU = (1 << 6), WINDOW_UTILITY = (1 << 7), - WINDOW_SPLASHSCREEN = (1 << 8) + WINDOW_SPLASHSCREEN = (1 << 8), + WINDOW_NOTIFICATION = (1 << 9) } netWindowType; diff --git a/src/display.c b/src/display.c index 00318d5..8ff0040 100644 --- a/src/display.c +++ b/src/display.c @@ -150,6 +150,7 @@ myDisplayInitAtoms (DisplayInfo *display_info) "_NET_WM_WINDOW_TYPE_SPLASH", "_NET_WM_WINDOW_TYPE_TOOLBAR", "_NET_WM_WINDOW_TYPE_UTILITY", + "_NET_WM_WINDOW_TYPE_NOTIFICATION", "_NET_WORKAREA", "MANAGER", "PIXMAP", diff --git a/src/display.h b/src/display.h index 8797237..26d1806 100644 --- a/src/display.h +++ b/src/display.h @@ -245,6 +245,7 @@ enum NET_WM_WINDOW_TYPE_SPLASH, NET_WM_WINDOW_TYPE_TOOLBAR, NET_WM_WINDOW_TYPE_UTILITY, + NET_WM_WINDOW_TYPE_NOTIFICATION, NET_WORKAREA, MANAGER, PIXMAP, diff --git a/src/hints.h b/src/hints.h index c106247..2f196d8 100644 --- a/src/hints.h +++ b/src/hints.h @@ -82,6 +82,7 @@ #define WIN_LAYER_DOCK 8 #define WIN_LAYER_ABOVE_DOCK 10 #define WIN_LAYER_FULLSCREEN 12 +#define WIN_LAYER_ABOVE_FULLSCREEN 14 #define NET_WM_MOVERESIZE_SIZE_TOPLEFT 0 #define NET_WM_MOVERESIZE_SIZE_TOP 1 diff --git a/src/netwm.c b/src/netwm.c index 1352f08..9d61f77 100644 --- a/src/netwm.c +++ b/src/netwm.c @@ -845,7 +845,8 @@ clientGetNetWmType (Client * c) (atoms[i] == display_info->atoms[NET_WM_WINDOW_TYPE_DIALOG]) || (atoms[i] == display_info->atoms[NET_WM_WINDOW_TYPE_NORMAL]) || (atoms[i] == display_info->atoms[NET_WM_WINDOW_TYPE_UTILITY]) || - (atoms[i] == display_info->atoms[NET_WM_WINDOW_TYPE_SPLASH])) + (atoms[i] == display_info->atoms[NET_WM_WINDOW_TYPE_SPLASH]) || + (atoms[i] == display_info->atoms[NET_WM_WINDOW_TYPE_NOTIFICATION])) { c->type_atom = atoms[i]; break; @@ -1305,6 +1306,25 @@ clientWindowType (Client * c) XFWM_FLAG_HAS_MENU | XFWM_FLAG_HAS_MOVE | XFWM_FLAG_HAS_RESIZE); } + else if (c->type_atom == display_info->atoms[NET_WM_WINDOW_TYPE_NOTIFICATION]) + { + TRACE ("atom net_wm_window_type_notification detected"); + c->type = WINDOW_NOTIFICATION; + if (c->screen_info->params->show_notifications_above_fullscreen) + { + c->initial_layer = WIN_LAYER_ABOVE_FULLSCREEN; + /* We unset these because CLIENT_FLAG_ABOVE will interfere with + our layer placement and put the window in the ABOVE_DOCK + layer, which is below the FULLSCREEN layer when the flags + are processed later. */ + FLAG_UNSET (c->flags, + CLIENT_FLAG_ABOVE | CLIENT_FLAG_BELOW); + } + else + { + c->initial_layer = c->win_layer; + } + } } else { diff --git a/src/settings.c b/src/settings.c index 607bb7b..3cc6d7d 100644 --- a/src/settings.c +++ b/src/settings.c @@ -716,6 +716,7 @@ loadSettings (ScreenInfo *screen_info) {"show_dock_shadow", NULL, G_TYPE_BOOLEAN, TRUE}, {"show_frame_shadow", NULL, G_TYPE_BOOLEAN, TRUE}, {"show_popup_shadow", NULL, G_TYPE_BOOLEAN, TRUE}, + {"show_notifications_above_fullscreen", NULL, G_TYPE_BOOLEAN, TRUE}, {"snap_resist", NULL, G_TYPE_BOOLEAN, TRUE}, {"snap_to_border", NULL, G_TYPE_BOOLEAN, TRUE}, {"snap_to_windows", NULL, G_TYPE_BOOLEAN, TRUE}, @@ -815,6 +816,8 @@ loadSettings (ScreenInfo *screen_info) getBoolValue ("show_frame_shadow", rc); screen_info->params->show_popup_shadow = getBoolValue ("show_popup_shadow", rc); + screen_info->params->show_notifications_above_fullscreen = + getBoolValue ("show_notifications_above_fullscreen", rc); screen_info->params->snap_to_border = getBoolValue ("snap_to_border", rc); screen_info->params->snap_to_windows = @@ -1321,6 +1324,10 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_ screen_info->params->show_popup_shadow = g_value_get_boolean (value); reloadScreenSettings (screen_info, UPDATE_FRAME); } + else if (!strcmp (name, "show_notifications_above_fullscreen")) + { + screen_info->params->show_notifications_above_fullscreen = g_value_get_boolean (value); + } else if (!strcmp (name, "snap_resist")) { screen_info->params->snap_resist = g_value_get_boolean (value); diff --git a/src/settings.h b/src/settings.h index be01b6b..732a9f6 100644 --- a/src/settings.h +++ b/src/settings.h @@ -220,6 +220,7 @@ struct _XfwmParams gboolean show_dock_shadow; gboolean show_frame_shadow; gboolean show_popup_shadow; + gboolean show_notifications_above_fullscreen; gboolean snap_resist; gboolean snap_to_border; gboolean snap_to_windows; -- 2.1.4