Fix regression causing crashes when running without a window manager.
authorPierre-Loup A. Griffais <pgriffais@valvesoftware.com>
Wed, 23 Oct 2013 13:43:17 -0700
changeset 7885a8bd63b33636
parent 7884 15027aa2cf21
child 7886 ce301a5cc814
Fix regression causing crashes when running without a window manager.
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Wed Oct 23 15:54:12 2013 -0400
     1.2 +++ b/src/video/x11/SDL_x11events.c	Wed Oct 23 13:43:17 2013 -0700
     1.3 @@ -525,19 +525,22 @@
     1.4              long border_bottom = 0;
     1.5              if (data->xwindow) {
     1.6                  Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0);
     1.7 -                Atom type;
     1.8 +                Atom type = None;
     1.9                  int format;
    1.10 -                unsigned long nitems, bytes_after;
    1.11 +                unsigned long nitems = 0, bytes_after;
    1.12                  unsigned char *property;
    1.13                  X11_XGetWindowProperty(display, data->xwindow,
    1.14                      _net_frame_extents, 0, 16, 0,
    1.15                      XA_CARDINAL, &type, &format,
    1.16                      &nitems, &bytes_after, &property);
    1.17  
    1.18 -                border_left = ((long*)property)[0];
    1.19 -                border_right = ((long*)property)[1];
    1.20 -                border_top = ((long*)property)[2];
    1.21 -                border_bottom = ((long*)property)[3];
    1.22 +                if (type != None && nitems == 4)
    1.23 +                {
    1.24 +                    border_left = ((long*)property)[0];
    1.25 +                    border_right = ((long*)property)[1];
    1.26 +                    border_top = ((long*)property)[2];
    1.27 +                    border_bottom = ((long*)property)[3];
    1.28 +                }
    1.29              }
    1.30  
    1.31              if (xevent.xconfigure.x != data->last_xconfigure.x ||