allocate *Hint structures per Xlib docs
This commit is contained in:
parent
b603b9a9f9
commit
df2acac897
2 changed files with 23 additions and 15 deletions
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
SDL_X11_MODULE(BASEXLIB)
|
SDL_X11_MODULE(BASEXLIB)
|
||||||
SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
|
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,XAutoRepeatOn,(Display* a),(a),return)
|
||||||
SDL_X11_SYM(int,XAutoRepeatOff,(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)
|
SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return)
|
||||||
|
|
|
@ -290,9 +290,9 @@ X11_CreateWindow(_THIS, SDL_Window * window)
|
||||||
int depth;
|
int depth;
|
||||||
XSetWindowAttributes xattr;
|
XSetWindowAttributes xattr;
|
||||||
Window w;
|
Window w;
|
||||||
XSizeHints sizehints;
|
XSizeHints *sizehints;
|
||||||
XWMHints wmhints;
|
XWMHints *wmhints;
|
||||||
XClassHint classhints;
|
XClassHint *classhints;
|
||||||
Atom _NET_WM_WINDOW_TYPE;
|
Atom _NET_WM_WINDOW_TYPE;
|
||||||
Atom _NET_WM_WINDOW_TYPE_NORMAL;
|
Atom _NET_WM_WINDOW_TYPE_NORMAL;
|
||||||
Atom _NET_WM_PID;
|
Atom _NET_WM_PID;
|
||||||
|
@ -446,28 +446,34 @@ X11_CreateWindow(_THIS, SDL_Window * window)
|
||||||
SetWindowBordered(display, screen, w,
|
SetWindowBordered(display, screen, w,
|
||||||
(window->flags & SDL_WINDOW_BORDERLESS) == 0);
|
(window->flags & SDL_WINDOW_BORDERLESS) == 0);
|
||||||
|
|
||||||
|
sizehints = XAllocSizeHints();
|
||||||
/* Setup the normal size hints */
|
/* Setup the normal size hints */
|
||||||
sizehints.flags = 0;
|
sizehints->flags = 0;
|
||||||
if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
|
if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
|
||||||
sizehints.min_width = sizehints.max_width = window->w;
|
sizehints->min_width = sizehints->max_width = window->w;
|
||||||
sizehints.min_height = sizehints.max_height = window->h;
|
sizehints->min_height = sizehints->max_height = window->h;
|
||||||
sizehints.flags |= (PMaxSize | PMinSize);
|
sizehints->flags |= (PMaxSize | PMinSize);
|
||||||
}
|
}
|
||||||
sizehints.x = window->x;
|
sizehints->x = window->x;
|
||||||
sizehints.y = window->y;
|
sizehints->y = window->y;
|
||||||
sizehints.flags |= USPosition;
|
sizehints->flags |= USPosition;
|
||||||
|
|
||||||
/* Setup the input hints so we get keyboard input */
|
/* Setup the input hints so we get keyboard input */
|
||||||
wmhints.input = True;
|
wmhints = XAllocWMHints();
|
||||||
wmhints.flags = InputHint;
|
wmhints->input = True;
|
||||||
|
wmhints->flags = InputHint;
|
||||||
|
|
||||||
/* Setup the class hints so we can get an icon (AfterStep) */
|
/* Setup the class hints so we can get an icon (AfterStep) */
|
||||||
classhints.res_name = data->classname;
|
classhints = XAllocClassHint();
|
||||||
classhints.res_class = data->classname;
|
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 */
|
/* 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 */
|
/* Set the PID related to the window for the given hostname, if possible */
|
||||||
if (data->pid > 0) {
|
if (data->pid > 0) {
|
||||||
_NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);
|
_NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue