allocate *Hint structures per Xlib docs
authorEdward Rudd <urkle@outoforder.cc>
Wed, 26 Sep 2012 14:08:46 -0400
changeset 64625e09ac1aba80
parent 6461 6d17371235d3
child 6463 051403ca44cc
allocate *Hint structures per Xlib docs
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11window.c
     1.1 --- a/src/video/x11/SDL_x11sym.h	Tue Sep 25 20:58:23 2012 -0700
     1.2 +++ b/src/video/x11/SDL_x11sym.h	Wed Sep 26 14:08:46 2012 -0400
     1.3 @@ -23,6 +23,8 @@
     1.4  
     1.5  SDL_X11_MODULE(BASEXLIB)
     1.6  SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
     1.7 +SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return)
     1.8 +SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return)
     1.9  SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return)
    1.10  SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return)
    1.11  SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return)
     2.1 --- a/src/video/x11/SDL_x11window.c	Tue Sep 25 20:58:23 2012 -0700
     2.2 +++ b/src/video/x11/SDL_x11window.c	Wed Sep 26 14:08:46 2012 -0400
     2.3 @@ -290,9 +290,9 @@
     2.4      int depth;
     2.5      XSetWindowAttributes xattr;
     2.6      Window w;
     2.7 -    XSizeHints sizehints;
     2.8 -    XWMHints wmhints;
     2.9 -    XClassHint classhints;
    2.10 +    XSizeHints *sizehints;
    2.11 +    XWMHints *wmhints;
    2.12 +    XClassHint *classhints;
    2.13      Atom _NET_WM_WINDOW_TYPE;
    2.14      Atom _NET_WM_WINDOW_TYPE_NORMAL;
    2.15      Atom _NET_WM_PID;
    2.16 @@ -446,28 +446,34 @@
    2.17      SetWindowBordered(display, screen, w,
    2.18                        (window->flags & SDL_WINDOW_BORDERLESS) == 0);
    2.19  
    2.20 +    sizehints = XAllocSizeHints();
    2.21      /* Setup the normal size hints */
    2.22 -    sizehints.flags = 0;
    2.23 +    sizehints->flags = 0;
    2.24      if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
    2.25 -        sizehints.min_width = sizehints.max_width = window->w;
    2.26 -        sizehints.min_height = sizehints.max_height = window->h;
    2.27 -        sizehints.flags |= (PMaxSize | PMinSize);
    2.28 +        sizehints->min_width = sizehints->max_width = window->w;
    2.29 +        sizehints->min_height = sizehints->max_height = window->h;
    2.30 +        sizehints->flags |= (PMaxSize | PMinSize);
    2.31      }
    2.32 -    sizehints.x = window->x;
    2.33 -    sizehints.y = window->y;
    2.34 -    sizehints.flags |= USPosition;
    2.35 +    sizehints->x = window->x;
    2.36 +    sizehints->y = window->y;
    2.37 +    sizehints->flags |= USPosition;
    2.38  
    2.39      /* Setup the input hints so we get keyboard input */
    2.40 -    wmhints.input = True;
    2.41 -    wmhints.flags = InputHint;
    2.42 +    wmhints = XAllocWMHints();
    2.43 +    wmhints->input = True;
    2.44 +    wmhints->flags = InputHint;
    2.45  
    2.46      /* Setup the class hints so we can get an icon (AfterStep) */
    2.47 -    classhints.res_name = data->classname;
    2.48 -    classhints.res_class = data->classname;
    2.49 +    classhints = XAllocClassHint();
    2.50 +    classhints->res_name = data->classname;
    2.51 +    classhints->res_class = data->classname;
    2.52  
    2.53      /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */
    2.54 -    XSetWMProperties(display, w, NULL, NULL, NULL, 0, &sizehints, &wmhints, &classhints);
    2.55 +    XSetWMProperties(display, w, NULL, NULL, NULL, 0, sizehints, wmhints, classhints);
    2.56  
    2.57 +    XFree(sizehints);
    2.58 +    XFree(wmhints);
    2.59 +    XFree(classhints);
    2.60      /* Set the PID related to the window for the given hostname, if possible */
    2.61      if (data->pid > 0) {
    2.62          _NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);