Set up window focus correctly when using an existing X11 window.

Thanks to Joseph Toppi for the fix!

--HG--
extra : rebase_source : be4596056669a0a9c7580355084b7f9eca345d78
This commit is contained in:
Ryan C. Gordon 2011-10-22 02:14:57 -04:00
parent 20181eb52a
commit bc4b0f28f1

View file

@ -191,6 +191,21 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
}
}
{
Window FocalWindow;
int RevertTo=0;
XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
if (FocalWindow==w)
{
window->flags |= SDL_WINDOW_INPUT_FOCUS;
SDL_SetKeyboardFocus(data->window);
}
if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
/* Tell x11 to clip mouse */
}
}
/* FIXME: How can I tell?
{
DWORD style = GetWindowLong(hwnd, GWL_STYLE);