Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Set up window focus correctly when using an existing X11 window.
Browse files Browse the repository at this point in the history
Thanks to Joseph Toppi for the fix!
  • Loading branch information
icculus committed Oct 22, 2011
1 parent ff5f68c commit fa24077
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/video/x11/SDL_x11window.c
Expand Up @@ -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);
Expand Down

0 comments on commit fa24077

Please sign in to comment.