From 264ae241c4b452adb827b5a1a25bed0ee4b5750c Mon Sep 17 00:00:00 2001 From: Lars Luthman Date: Tue, 25 Aug 2015 12:07:05 +0200 Subject: [PATCH] Stack notifications on top of fullscreen windows (bug #7928) Recognise windows with the _NET_WM_WINDOW_TYPE_NOTIFICATION as a separate type of window and stack them in the layer WIN_LAYER_NOTIFICATION, which is on top of all other layers. This makes e.g. battery status notifications and volume and brightness feedback show even when you're watching a video in fullscreeen. --- src/client.h | 3 ++- src/display.c | 1 + src/display.h | 1 + src/hints.h | 1 + src/netwm.c | 15 ++++++++++++++- 5 files changed, 19 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..b33ad78 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_NOTIFICATION 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..ab31f05 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,18 @@ 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; + c->initial_layer = WIN_LAYER_NOTIFICATION; + /* 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 { -- 2.1.4