src/video/x11/SDL_x11window.c
changeset 6970 e0db39f7afb0
parent 6899 f75b1bd8eabc
child 7001 ccc0d3207639
     1.1 --- a/src/video/x11/SDL_x11window.c	Wed Mar 06 10:37:27 2013 -0500
     1.2 +++ b/src/video/x11/SDL_x11window.c	Wed Mar 06 09:37:03 2013 -0800
     1.3 @@ -927,10 +927,39 @@
     1.4      XFlush(display);
     1.5  }
     1.6  
     1.7 +static void
     1.8 +SetWindowActive(_THIS, SDL_Window * window)
     1.9 +{
    1.10 +    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
    1.11 +    SDL_DisplayData *displaydata =
    1.12 +        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
    1.13 +    Display *display = data->videodata->display;
    1.14 +	Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW;
    1.15 +
    1.16 +    if (X11_IsWindowMapped(_this, window)) {
    1.17 +        XEvent e;
    1.18 +
    1.19 +        SDL_zero(e);
    1.20 +        e.xany.type = ClientMessage;
    1.21 +        e.xclient.message_type = _NET_ACTIVE_WINDOW;
    1.22 +        e.xclient.format = 32;
    1.23 +        e.xclient.window = data->xwindow;
    1.24 +        e.xclient.data.l[0] = 1;  /* source indication. 1 = application */
    1.25 +		e.xclient.data.l[1] = CurrentTime;
    1.26 +		e.xclient.data.l[2] = 0;
    1.27 +
    1.28 +        XSendEvent(display, RootWindow(display, displaydata->screen), 0,
    1.29 +                   SubstructureNotifyMask | SubstructureRedirectMask, &e);
    1.30 +
    1.31 +    	XFlush(display);
    1.32 +    }
    1.33 +}
    1.34 +
    1.35  void
    1.36  X11_RestoreWindow(_THIS, SDL_Window * window)
    1.37  {
    1.38      SetWindowMaximized(_this, window, SDL_FALSE);
    1.39 +	SetWindowActive(_this, window);
    1.40      X11_ShowWindow(_this, window);
    1.41  }
    1.42