src/video/x11/SDL_x11messagebox.c
changeset 9695 363a7880b4f7
parent 9657 fbc01731d914
child 9698 bf0257e323d2
     1.1 --- a/src/video/x11/SDL_x11messagebox.c	Sun May 31 22:27:46 2015 -0400
     1.2 +++ b/src/video/x11/SDL_x11messagebox.c	Sun May 31 22:48:26 2015 -0400
     1.3 @@ -548,6 +548,13 @@
     1.4  #endif
     1.5  }
     1.6  
     1.7 +static Bool
     1.8 +X11_MessageBoxEventTest(Display *display, XEvent *event, XPointer arg)
     1.9 +{
    1.10 +    const SDL_MessageBoxDataX11 *data = (const SDL_MessageBoxDataX11 *) arg;
    1.11 +    return ((event->xany.display == data->display) && (event->xany.window == data->window)) ? True : False;
    1.12 +}
    1.13 +
    1.14  /* Loop and handle message box event messages until something kills it. */
    1.15  static int
    1.16  X11_MessageBoxLoop( SDL_MessageBoxDataX11 *data )
    1.17 @@ -580,7 +587,9 @@
    1.18          XEvent e;
    1.19          SDL_bool draw = SDL_TRUE;
    1.20  
    1.21 -        X11_XWindowEvent( data->display, data->window, data->event_mask, &e );
    1.22 +        /* can't use XWindowEvent() because it can't handle ClientMessage events. */
    1.23 +        /* can't use XNextEvent() because we only want events for this window. */
    1.24 +        X11_XIfEvent( data->display, &e, X11_MessageBoxEventTest, (XPointer) data );
    1.25  
    1.26          /* If X11_XFilterEvent returns True, then some input method has filtered the
    1.27             event, and the client should discard the event. */