From a8442cf2da6b14f05f4470d64454be9678b684fd Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Wed, 26 Sep 2012 14:08:46 -0400 Subject: [PATCH] allocate *Hint structures per Xlib docs --- src/video/x11/SDL_x11sym.h | 2 ++ src/video/x11/SDL_x11window.c | 36 ++++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index 472620b0f..b71d30b0b 100755 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -23,6 +23,8 @@ SDL_X11_MODULE(BASEXLIB) SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) +SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) +SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return) SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return) SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return) SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 125198ab7..68fe640f0 100755 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -290,9 +290,9 @@ X11_CreateWindow(_THIS, SDL_Window * window) int depth; XSetWindowAttributes xattr; Window w; - XSizeHints sizehints; - XWMHints wmhints; - XClassHint classhints; + XSizeHints *sizehints; + XWMHints *wmhints; + XClassHint *classhints; Atom _NET_WM_WINDOW_TYPE; Atom _NET_WM_WINDOW_TYPE_NORMAL; Atom _NET_WM_PID; @@ -446,28 +446,34 @@ X11_CreateWindow(_THIS, SDL_Window * window) SetWindowBordered(display, screen, w, (window->flags & SDL_WINDOW_BORDERLESS) == 0); + sizehints = XAllocSizeHints(); /* Setup the normal size hints */ - sizehints.flags = 0; + sizehints->flags = 0; if (!(window->flags & SDL_WINDOW_RESIZABLE)) { - sizehints.min_width = sizehints.max_width = window->w; - sizehints.min_height = sizehints.max_height = window->h; - sizehints.flags |= (PMaxSize | PMinSize); + sizehints->min_width = sizehints->max_width = window->w; + sizehints->min_height = sizehints->max_height = window->h; + sizehints->flags |= (PMaxSize | PMinSize); } - sizehints.x = window->x; - sizehints.y = window->y; - sizehints.flags |= USPosition; + sizehints->x = window->x; + sizehints->y = window->y; + sizehints->flags |= USPosition; /* Setup the input hints so we get keyboard input */ - wmhints.input = True; - wmhints.flags = InputHint; + wmhints = XAllocWMHints(); + wmhints->input = True; + wmhints->flags = InputHint; /* Setup the class hints so we can get an icon (AfterStep) */ - classhints.res_name = data->classname; - classhints.res_class = data->classname; + classhints = XAllocClassHint(); + classhints->res_name = data->classname; + classhints->res_class = data->classname; /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */ - XSetWMProperties(display, w, NULL, NULL, NULL, 0, &sizehints, &wmhints, &classhints); + XSetWMProperties(display, w, NULL, NULL, NULL, 0, sizehints, wmhints, classhints); + XFree(sizehints); + XFree(wmhints); + XFree(classhints); /* Set the PID related to the window for the given hostname, if possible */ if (data->pid > 0) { _NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);