Fix dunst losing on-top status on WM restart

Subscribe to receive window creation events on the root window and raise
the window when that happens to ensure dunst is on top.
We do not raise the window when another override redirect window is
created to avoid being on top of things like screen lockers.

Fixes #160
This commit is contained in:
Nikos Tsipinakis 2018-04-30 11:57:25 +03:00
parent 43c7078ccc
commit dffe1e1a5a

View File

@ -225,6 +225,11 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer
case FocusOut: case FocusOut:
wake_up(); wake_up();
break; break;
case CreateNotify:
if (xctx.win.visible &&
ev.xcreatewindow.override_redirect == 0)
XRaiseWindow(xctx.dpy, xctx.win.xwin);
break;
case PropertyNotify: case PropertyNotify:
fullscreen_now = have_fullscreen_window(); fullscreen_now = have_fullscreen_window();
scr = get_active_screen(); scr = get_active_screen();
@ -485,10 +490,12 @@ static void x_win_setup(void)
(unsigned long)((100 - settings.transparency) * (unsigned long)((100 - settings.transparency) *
(0xffffffff / 100))); (0xffffffff / 100)));
long root_event_mask = SubstructureNotifyMask;
if (settings.f_mode != FOLLOW_NONE) { if (settings.f_mode != FOLLOW_NONE) {
long root_event_mask = FocusChangeMask | PropertyChangeMask; root_event_mask |= FocusChangeMask | PropertyChangeMask;
XSelectInput(xctx.dpy, root, root_event_mask);
} }
XSelectInput(xctx.dpy, root, root_event_mask);
} }
/* /*