Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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

Thanks to Joseph Toppi for the fix!
  • Loading branch information
icculus committed Oct 22, 2011
1 parent ff5f68c commit fa240776d4951228eaeb2a6919c78d18c35ac88f
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/video/x11/SDL_x11window.c
@@ -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);

0 comments on commit fa24077

Please sign in to comment.