src/video/x11/SDL_x11window.c
changeset 6462 5e09ac1aba80
parent 6423 339c0ccf6250
child 6466 ebe165c00fab
equal deleted inserted replaced
6461:6d17371235d3 6462:5e09ac1aba80
   288     int screen = displaydata->screen;
   288     int screen = displaydata->screen;
   289     Visual *visual;
   289     Visual *visual;
   290     int depth;
   290     int depth;
   291     XSetWindowAttributes xattr;
   291     XSetWindowAttributes xattr;
   292     Window w;
   292     Window w;
   293     XSizeHints sizehints;
   293     XSizeHints *sizehints;
   294     XWMHints wmhints;
   294     XWMHints *wmhints;
   295     XClassHint classhints;
   295     XClassHint *classhints;
   296     Atom _NET_WM_WINDOW_TYPE;
   296     Atom _NET_WM_WINDOW_TYPE;
   297     Atom _NET_WM_WINDOW_TYPE_NORMAL;
   297     Atom _NET_WM_WINDOW_TYPE_NORMAL;
   298     Atom _NET_WM_PID;
   298     Atom _NET_WM_PID;
   299     int wmstate_count;
   299     int wmstate_count;
   300     Atom wmstate_atoms[3];
   300     Atom wmstate_atoms[3];
   444 #endif
   444 #endif
   445 
   445 
   446     SetWindowBordered(display, screen, w,
   446     SetWindowBordered(display, screen, w,
   447                       (window->flags & SDL_WINDOW_BORDERLESS) == 0);
   447                       (window->flags & SDL_WINDOW_BORDERLESS) == 0);
   448 
   448 
       
   449     sizehints = XAllocSizeHints();
   449     /* Setup the normal size hints */
   450     /* Setup the normal size hints */
   450     sizehints.flags = 0;
   451     sizehints->flags = 0;
   451     if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
   452     if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
   452         sizehints.min_width = sizehints.max_width = window->w;
   453         sizehints->min_width = sizehints->max_width = window->w;
   453         sizehints.min_height = sizehints.max_height = window->h;
   454         sizehints->min_height = sizehints->max_height = window->h;
   454         sizehints.flags |= (PMaxSize | PMinSize);
   455         sizehints->flags |= (PMaxSize | PMinSize);
   455     }
   456     }
   456     sizehints.x = window->x;
   457     sizehints->x = window->x;
   457     sizehints.y = window->y;
   458     sizehints->y = window->y;
   458     sizehints.flags |= USPosition;
   459     sizehints->flags |= USPosition;
   459 
   460 
   460     /* Setup the input hints so we get keyboard input */
   461     /* Setup the input hints so we get keyboard input */
   461     wmhints.input = True;
   462     wmhints = XAllocWMHints();
   462     wmhints.flags = InputHint;
   463     wmhints->input = True;
       
   464     wmhints->flags = InputHint;
   463 
   465 
   464     /* Setup the class hints so we can get an icon (AfterStep) */
   466     /* Setup the class hints so we can get an icon (AfterStep) */
   465     classhints.res_name = data->classname;
   467     classhints = XAllocClassHint();
   466     classhints.res_class = data->classname;
   468     classhints->res_name = data->classname;
       
   469     classhints->res_class = data->classname;
   467 
   470 
   468     /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */
   471     /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */
   469     XSetWMProperties(display, w, NULL, NULL, NULL, 0, &sizehints, &wmhints, &classhints);
   472     XSetWMProperties(display, w, NULL, NULL, NULL, 0, sizehints, wmhints, classhints);
   470 
   473 
       
   474     XFree(sizehints);
       
   475     XFree(wmhints);
       
   476     XFree(classhints);
   471     /* Set the PID related to the window for the given hostname, if possible */
   477     /* Set the PID related to the window for the given hostname, if possible */
   472     if (data->pid > 0) {
   478     if (data->pid > 0) {
   473         _NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);
   479         _NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);
   474         XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace,
   480         XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace,
   475                         (unsigned char *)&data->pid, 1);
   481                         (unsigned char *)&data->pid, 1);