src/video/x11/SDL_x11modes.c
changeset 10019 36f7e8084508
parent 10015 d809627808b1
child 10030 061b1b467bd3
equal deleted inserted replaced
10018:3c1384edf9fa 10019:36f7e8084508
  1071     }
  1071     }
  1072 
  1072 
  1073     return data->ddpi != 0.0f ? 0 : -1;
  1073     return data->ddpi != 0.0f ? 0 : -1;
  1074 }
  1074 }
  1075 
  1075 
       
  1076 int
       
  1077 X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect)
       
  1078 {
       
  1079     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
       
  1080     Display *display = data->display;
       
  1081     Atom _NET_WORKAREA;
       
  1082     int status, real_format;
       
  1083     int retval = -1;
       
  1084     Atom real_type;
       
  1085     unsigned long items_read = 0, items_left = 0;
       
  1086     unsigned char *propdata = NULL;
       
  1087 
       
  1088     if (X11_GetDisplayBounds(_this, sdl_display, rect) < 0) {
       
  1089         return -1;
       
  1090     }
       
  1091 
       
  1092     _NET_WORKAREA = X11_XInternAtom(display, "_NET_WORKAREA", False);
       
  1093     status = X11_XGetWindowProperty(display, DefaultRootWindow(display),
       
  1094                                     _NET_WORKAREA, 0L, 4L, False, XA_CARDINAL,
       
  1095                                     &real_type, &real_format, &items_read,
       
  1096                                     &items_left, &propdata);
       
  1097     if ((status == Success) && (items_read >= 4)) {
       
  1098         retval = 0;
       
  1099         const long *p = (long*) propdata;
       
  1100         const SDL_Rect usable = { (int)p[0], (int)p[1], (int)p[2], (int)p[3] };
       
  1101         if (!SDL_IntersectRect(rect, &usable, rect)) {
       
  1102             SDL_zerop(rect);
       
  1103         }
       
  1104     }
       
  1105 
       
  1106     if (propdata) {
       
  1107         X11_XFree(propdata);
       
  1108     }
       
  1109 
       
  1110     return retval;
       
  1111 }
       
  1112 
  1076 #endif /* SDL_VIDEO_DRIVER_X11 */
  1113 #endif /* SDL_VIDEO_DRIVER_X11 */
  1077 
  1114 
  1078 /* vi: set ts=4 sw=4 expandtab: */
  1115 /* vi: set ts=4 sw=4 expandtab: */