Make NotifyWindow work with SDL2

This commit is contained in:
def 2015-08-25 02:39:48 +02:00
parent 38cfe32385
commit 6efd028393

View file

@ -705,45 +705,41 @@ void CGraphicsBackend_SDL_OpenGL::SetWindowGrab(bool Grab)
void CGraphicsBackend_SDL_OpenGL::NotifyWindow()
{
//// get window handle
//SDL_SysWMinfo info;
//SDL_VERSION(&info.version);
//if(!SDL_GetWMInfo(&info))
//{
// dbg_msg("gfx", "unable to obtain window handle");
// return;
//}
// get window handle
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if(!SDL_GetWindowWMInfo(m_pWindow, &info))
{
dbg_msg("gfx", "unable to obtain window handle");
return;
}
//#if defined(CONF_FAMILY_WINDOWS)
// FLASHWINFO desc;
// desc.cbSize = sizeof(desc);
// desc.hwnd = info.window;
// desc.dwFlags = FLASHW_TRAY;
// desc.uCount = 3; // flash 3 times
// desc.dwTimeout = 0;
#if defined(CONF_FAMILY_WINDOWS)
FLASHWINFO desc;
desc.cbSize = sizeof(desc);
desc.hwnd = info.window;
desc.dwFlags = FLASHW_TRAY;
desc.uCount = 3; // flash 3 times
desc.dwTimeout = 0;
// FlashWindowEx(&desc);
//#elif defined(SDL_VIDEO_DRIVER_X11) && !defined(CONF_PLATFORM_MACOSX)
// Display *dpy = info.info.x11.display;
// Window win;
// if(m_pScreenSurface->flags & SDL_FULLSCREEN)
// win = info.info.x11.fswindow;
// else
// win = info.info.x11.wmwindow;
FlashWindowEx(&desc);
#elif defined(SDL_VIDEO_DRIVER_X11) && !defined(CONF_PLATFORM_MACOSX)
Display *dpy = info.info.x11.display;
Window win = info.info.x11.window;
// // Old hints
// XWMHints *wmhints;
// wmhints = XAllocWMHints();
// wmhints->flags = XUrgencyHint;
// XSetWMHints(dpy, win, wmhints);
// XFree(wmhints);
// Old hints
XWMHints *wmhints;
wmhints = XAllocWMHints();
wmhints->flags = XUrgencyHint;
XSetWMHints(dpy, win, wmhints);
XFree(wmhints);
// // More modern way of notifying
// static Atom demandsAttention = XInternAtom(dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", true);
// static Atom wmState = XInternAtom(dpy, "_NET_WM_STATE", true);
// XChangeProperty(dpy, win, wmState, XA_ATOM, 32, PropModeReplace,
// (unsigned char *) &demandsAttention, 1);
//#endif
// More modern way of notifying
static Atom demandsAttention = XInternAtom(dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", true);
static Atom wmState = XInternAtom(dpy, "_NET_WM_STATE", true);
XChangeProperty(dpy, win, wmState, XA_ATOM, 32, PropModeReplace,
(unsigned char *) &demandsAttention, 1);
#endif
}