mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix x11 notify by Maiski
This commit is contained in:
parent
70f79bf3bc
commit
99e460deb7
|
@ -1121,21 +1121,22 @@ void CGraphicsBackend_SDL_OpenGL::NotifyWindow()
|
||||||
|
|
||||||
FlashWindowEx(&desc);
|
FlashWindowEx(&desc);
|
||||||
#elif defined(SDL_VIDEO_DRIVER_X11) && !defined(CONF_PLATFORM_MACOS)
|
#elif defined(SDL_VIDEO_DRIVER_X11) && !defined(CONF_PLATFORM_MACOS)
|
||||||
Display *dpy = info.info.x11.display;
|
Display *pX11Dpy = info.info.x11.display;
|
||||||
Window win = info.info.x11.window;
|
Window X11Win = info.info.x11.window;
|
||||||
|
|
||||||
// Old hints
|
static Atom s_DemandsAttention = XInternAtom(pX11Dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", true);
|
||||||
XWMHints *wmhints;
|
static Atom s_WmState = XInternAtom(pX11Dpy, "_NET_WM_STATE", true);
|
||||||
wmhints = XAllocWMHints();
|
|
||||||
wmhints->flags = XUrgencyHint;
|
|
||||||
XSetWMHints(dpy, win, wmhints);
|
|
||||||
XFree(wmhints);
|
|
||||||
|
|
||||||
// More modern way of notifying
|
XEvent SndNtfyEvent = {ClientMessage};
|
||||||
static Atom demandsAttention = XInternAtom(dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", true);
|
SndNtfyEvent.xclient.window = X11Win;
|
||||||
static Atom wmState = XInternAtom(dpy, "_NET_WM_STATE", true);
|
SndNtfyEvent.xclient.message_type = s_WmState;
|
||||||
XChangeProperty(dpy, win, wmState, XA_ATOM, 32, PropModeReplace,
|
SndNtfyEvent.xclient.format = 32;
|
||||||
(unsigned char *)&demandsAttention, 1);
|
SndNtfyEvent.xclient.data.l[0] = 1; // _NET_WM_STATE_ADD
|
||||||
|
SndNtfyEvent.xclient.data.l[1] = s_DemandsAttention;
|
||||||
|
SndNtfyEvent.xclient.data.l[2] = 0;
|
||||||
|
SndNtfyEvent.xclient.data.l[3] = 1; // normal application
|
||||||
|
SndNtfyEvent.xclient.data.l[4] = 0;
|
||||||
|
XSendEvent(pX11Dpy, XDefaultRootWindow(pX11Dpy), False, SubstructureNotifyMask | SubstructureRedirectMask, &SndNtfyEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue