src/video/x11/SDL_x11modes.c
changeset 7827 a03ec8de0426
parent 7678 286c42d7c5ed
child 7914 a391318fa60f
     1.1 --- a/src/video/x11/SDL_x11modes.c	Thu Oct 17 20:49:30 2013 -0700
     1.2 +++ b/src/video/x11/SDL_x11modes.c	Fri Oct 18 01:36:41 2013 -0400
     1.3 @@ -54,20 +54,20 @@
     1.4  
     1.5          SDL_zero(template);
     1.6          template.visualid = SDL_strtol(visual_id, NULL, 0);
     1.7 -        vi = XGetVisualInfo(display, VisualIDMask, &template, &nvis);
     1.8 +        vi = X11_XGetVisualInfo(display, VisualIDMask, &template, &nvis);
     1.9          if (vi) {
    1.10              *vinfo = *vi;
    1.11 -            XFree(vi);
    1.12 +            X11_XFree(vi);
    1.13              return 0;
    1.14          }
    1.15      }
    1.16  
    1.17      depth = DefaultDepth(display, screen);
    1.18      if ((X11_UseDirectColorVisuals() &&
    1.19 -         XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) ||
    1.20 -        XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) ||
    1.21 -        XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) ||
    1.22 -        XMatchVisualInfo(display, screen, depth, StaticColor, vinfo)) {
    1.23 +         X11_XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) ||
    1.24 +        X11_XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) ||
    1.25 +        X11_XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) ||
    1.26 +        X11_XMatchVisualInfo(display, screen, depth, StaticColor, vinfo)) {
    1.27          return 0;
    1.28      }
    1.29      return -1;
    1.30 @@ -79,11 +79,11 @@
    1.31      XVisualInfo *vi;
    1.32      int nvis;
    1.33  
    1.34 -    vinfo->visualid = XVisualIDFromVisual(visual);
    1.35 -    vi = XGetVisualInfo(display, VisualIDMask, vinfo, &nvis);
    1.36 +    vinfo->visualid = X11_XVisualIDFromVisual(visual);
    1.37 +    vi = X11_XGetVisualInfo(display, VisualIDMask, vinfo, &nvis);
    1.38      if (vi) {
    1.39          *vinfo = *vi;
    1.40 -        XFree(vi);
    1.41 +        X11_XFree(vi);
    1.42          return 0;
    1.43      }
    1.44      return -1;
    1.45 @@ -108,7 +108,7 @@
    1.46          bpp = vinfo->depth;
    1.47          if (bpp == 24) {
    1.48              int i, n;
    1.49 -            XPixmapFormatValues *p = XListPixmapFormats(display, &n);
    1.50 +            XPixmapFormatValues *p = X11_XListPixmapFormats(display, &n);
    1.51              if (p) {
    1.52                  for (i = 0; i < n; ++i) {
    1.53                      if (p[i].depth == 24) {
    1.54 @@ -116,7 +116,7 @@
    1.55                          break;
    1.56                      }
    1.57                  }
    1.58 -                XFree(p);
    1.59 +                X11_XFree(p);
    1.60              }
    1.61          }
    1.62  
    1.63 @@ -178,9 +178,9 @@
    1.64      }
    1.65  
    1.66      /* Query the extension version */
    1.67 -    if (!XineramaQueryExtension(display, &event_base, &error_base) ||
    1.68 -        !XineramaQueryVersion(display, major, minor) ||
    1.69 -        !XineramaIsActive(display)) {
    1.70 +    if (!X11_XineramaQueryExtension(display, &event_base, &error_base) ||
    1.71 +        !X11_XineramaQueryVersion(display, major, minor) ||
    1.72 +        !X11_XineramaIsActive(display)) {
    1.73  #ifdef X11MODES_DEBUG
    1.74          printf("Xinerama not active on the display\n");
    1.75  #endif
    1.76 @@ -228,7 +228,7 @@
    1.77      }
    1.78  
    1.79      /* Query the extension version */
    1.80 -    if (!XRRQueryVersion(display, major, minor)) {
    1.81 +    if (!X11_XRRQueryVersion(display, major, minor)) {
    1.82  #ifdef X11MODES_DEBUG
    1.83          printf("XRandR not active on the display\n");
    1.84  #endif
    1.85 @@ -261,10 +261,10 @@
    1.86              Rotation rotation = 0;
    1.87              const XRRModeInfo *info = &res->modes[i];
    1.88  
    1.89 -            crtc = XRRGetCrtcInfo(display, res, output_info->crtc);
    1.90 +            crtc = X11_XRRGetCrtcInfo(display, res, output_info->crtc);
    1.91              if (crtc) {
    1.92                  rotation = crtc->rotation;
    1.93 -                XRRFreeCrtcInfo(crtc);
    1.94 +                X11_XRRFreeCrtcInfo(crtc);
    1.95              }
    1.96  
    1.97              if (rotation & (XRANDR_ROTATION_LEFT|XRANDR_ROTATION_RIGHT)) {
    1.98 @@ -313,8 +313,8 @@
    1.99  
   1.100      /* Query the extension version */
   1.101      vm_error = -1;
   1.102 -    if (!XF86VidModeQueryExtension(display, &vm_event, &vm_error)
   1.103 -        || !XF86VidModeQueryVersion(display, major, minor)) {
   1.104 +    if (!X11_XF86VidModeQueryExtension(display, &vm_event, &vm_error)
   1.105 +        || !X11_XF86VidModeQueryVersion(display, major, minor)) {
   1.106  #ifdef X11MODES_DEBUG
   1.107          printf("XVidMode not active on the display\n");
   1.108  #endif
   1.109 @@ -335,7 +335,7 @@
   1.110      XF86VidModeModeLine l;
   1.111      SDL_zerop(info);
   1.112      SDL_zero(l);
   1.113 -    retval = XF86VidModeGetModeLine(dpy, scr, &dotclock, &l);
   1.114 +    retval = X11_XF86VidModeGetModeLine(dpy, scr, &dotclock, &l);
   1.115      info->dotclock = dotclock;
   1.116      info->hdisplay = l.hdisplay;
   1.117      info->hsyncstart = l.hsyncstart;
   1.118 @@ -397,7 +397,7 @@
   1.119       *       or newer of the Nvidia binary drivers
   1.120       */
   1.121      if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) {
   1.122 -        xinerama = XineramaQueryScreens(data->display, &screencount);
   1.123 +        xinerama = X11_XineramaQueryScreens(data->display, &screencount);
   1.124          if (xinerama) {
   1.125              use_xinerama = xinerama_major * 100 + xinerama_minor;
   1.126          }
   1.127 @@ -501,7 +501,7 @@
   1.128          displaydata->depth = vinfo.depth;
   1.129  
   1.130          displaydata->scanline_pad = SDL_BYTESPERPIXEL(mode.format) * 8;
   1.131 -        pixmapFormats = XListPixmapFormats(data->display, &n);
   1.132 +        pixmapFormats = X11_XListPixmapFormats(data->display, &n);
   1.133          if (pixmapFormats) {
   1.134              for (i = 0; i < n; ++i) {
   1.135                  if (pixmapFormats[i].depth == displaydata->depth) {
   1.136 @@ -509,7 +509,7 @@
   1.137                      break;
   1.138                  }
   1.139              }
   1.140 -            XFree(pixmapFormats);
   1.141 +            X11_XFree(pixmapFormats);
   1.142          }
   1.143  
   1.144  #if SDL_VIDEO_DRIVER_X11_XINERAMA
   1.145 @@ -526,13 +526,13 @@
   1.146  
   1.147  #if SDL_VIDEO_DRIVER_X11_XRANDR
   1.148          if (use_xrandr) {
   1.149 -            res = XRRGetScreenResources(data->display, RootWindow(data->display, displaydata->screen));
   1.150 +            res = X11_XRRGetScreenResources(data->display, RootWindow(data->display, displaydata->screen));
   1.151          }
   1.152          if (res) {
   1.153              XRROutputInfo *output_info;
   1.154              XRRCrtcInfo *crtc;
   1.155              int output;
   1.156 -            Atom EDID = XInternAtom(data->display, "EDID", False);
   1.157 +            Atom EDID = X11_XInternAtom(data->display, "EDID", False);
   1.158              Atom *props;
   1.159              int nprop;
   1.160              unsigned long width_mm;
   1.161 @@ -540,10 +540,10 @@
   1.162              int inches = 0;
   1.163  
   1.164              for (output = 0; output < res->noutput; output++) {
   1.165 -                output_info = XRRGetOutputInfo(data->display, res, res->outputs[output]);
   1.166 +                output_info = X11_XRRGetOutputInfo(data->display, res, res->outputs[output]);
   1.167                  if (!output_info || !output_info->crtc ||
   1.168                      output_info->connection == RR_Disconnected) {
   1.169 -                    XRRFreeOutputInfo(output_info);
   1.170 +                    X11_XRRFreeOutputInfo(output_info);
   1.171                      continue;
   1.172                  }
   1.173  
   1.174 @@ -551,10 +551,10 @@
   1.175                     We're checking the crtc position, but that may not be a valid test
   1.176                     in all cases.  Anybody want to give this some love?
   1.177                   */
   1.178 -                crtc = XRRGetCrtcInfo(data->display, res, output_info->crtc);
   1.179 +                crtc = X11_XRRGetCrtcInfo(data->display, res, output_info->crtc);
   1.180                  if (!crtc || crtc->x != displaydata->x || crtc->y != displaydata->y) {
   1.181 -                    XRRFreeOutputInfo(output_info);
   1.182 -                    XRRFreeCrtcInfo(crtc);
   1.183 +                    X11_XRRFreeOutputInfo(output_info);
   1.184 +                    X11_XRRFreeCrtcInfo(crtc);
   1.185                      continue;
   1.186                  }
   1.187  
   1.188 @@ -570,7 +570,7 @@
   1.189                  SDL_strlcpy(display_name, output_info->name, sizeof(display_name));
   1.190  
   1.191                  /* See if we can get the EDID data for the real monitor name */
   1.192 -                props = XRRListOutputProperties(data->display, res->outputs[output], &nprop);
   1.193 +                props = X11_XRRListOutputProperties(data->display, res->outputs[output], &nprop);
   1.194                  for (i = 0; i < nprop; ++i) {
   1.195                      unsigned char *prop;
   1.196                      int actual_format;
   1.197 @@ -578,7 +578,7 @@
   1.198                      Atom actual_type;
   1.199  
   1.200                      if (props[i] == EDID) {
   1.201 -                        if (XRRGetOutputProperty(data->display,
   1.202 +                        if (X11_XRRGetOutputProperty(data->display,
   1.203                                                   res->outputs[output], props[i],
   1.204                                                   0, 100, False, False,
   1.205                                                   AnyPropertyType,
   1.206 @@ -593,13 +593,13 @@
   1.207                                  SDL_strlcpy(display_name, info->dsc_product_name, sizeof(display_name));
   1.208                                  free(info);
   1.209                              }
   1.210 -                            XFree(prop);
   1.211 +                            X11_XFree(prop);
   1.212                          }
   1.213                          break;
   1.214                      }
   1.215                  }
   1.216                  if (props) {
   1.217 -                    XFree(props);
   1.218 +                    X11_XFree(props);
   1.219                  }
   1.220  
   1.221                  if (*display_name && inches) {
   1.222 @@ -610,8 +610,8 @@
   1.223                  printf("Display name: %s\n", display_name);
   1.224  #endif
   1.225  
   1.226 -                XRRFreeOutputInfo(output_info);
   1.227 -                XRRFreeCrtcInfo(crtc);
   1.228 +                X11_XRRFreeOutputInfo(output_info);
   1.229 +                X11_XRRFreeCrtcInfo(crtc);
   1.230                  break;
   1.231              }
   1.232  #ifdef X11MODES_DEBUG
   1.233 @@ -619,7 +619,7 @@
   1.234                  printf("Couldn't find XRandR CRTC at %d,%d\n", displaydata->x, displaydata->y);
   1.235              }
   1.236  #endif
   1.237 -            XRRFreeScreenResources(res);
   1.238 +            X11_XRRFreeScreenResources(res);
   1.239          }
   1.240  #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
   1.241  
   1.242 @@ -652,7 +652,7 @@
   1.243      }
   1.244  
   1.245  #if SDL_VIDEO_DRIVER_X11_XINERAMA
   1.246 -    if (xinerama) XFree(xinerama);
   1.247 +    if (xinerama) X11_XFree(xinerama);
   1.248  #endif
   1.249  
   1.250      if (_this->num_displays == 0) {
   1.251 @@ -725,13 +725,13 @@
   1.252      if (data->use_xrandr) {
   1.253          XRRScreenResources *res;
   1.254  
   1.255 -        res = XRRGetScreenResources (display, RootWindow(display, data->screen));
   1.256 +        res = X11_XRRGetScreenResources (display, RootWindow(display, data->screen));
   1.257          if (res) {
   1.258              SDL_DisplayModeData *modedata;
   1.259              XRROutputInfo *output_info;
   1.260              int i;
   1.261  
   1.262 -            output_info = XRRGetOutputInfo(display, res, data->xrandr_output);
   1.263 +            output_info = X11_XRRGetOutputInfo(display, res, data->xrandr_output);
   1.264              if (output_info && output_info->connection != RR_Disconnected) {
   1.265                  for (i = 0; i < output_info->nmode; ++i) {
   1.266                      modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
   1.267 @@ -747,8 +747,8 @@
   1.268                      }
   1.269                  }
   1.270              }
   1.271 -            XRRFreeOutputInfo(output_info);
   1.272 -            XRRFreeScreenResources(res);
   1.273 +            X11_XRRFreeOutputInfo(output_info);
   1.274 +            X11_XRRFreeScreenResources(res);
   1.275          }
   1.276          return;
   1.277      }
   1.278 @@ -756,7 +756,7 @@
   1.279  
   1.280  #if SDL_VIDEO_DRIVER_X11_XVIDMODE
   1.281      if (data->use_vidmode &&
   1.282 -        XF86VidModeGetAllModeLines(display, data->vidmode_screen, &nmodes, &modes)) {
   1.283 +        X11_XF86VidModeGetAllModeLines(display, data->vidmode_screen, &nmodes, &modes)) {
   1.284          int i;
   1.285  
   1.286  #ifdef X11MODES_DEBUG
   1.287 @@ -780,7 +780,7 @@
   1.288                  SDL_free(modedata);
   1.289              }
   1.290          }
   1.291 -        XFree(modes);
   1.292 +        X11_XFree(modes);
   1.293          return;
   1.294      }
   1.295  #endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
   1.296 @@ -811,41 +811,41 @@
   1.297          XRRCrtcInfo *crtc;
   1.298          Status status;
   1.299  
   1.300 -        res = XRRGetScreenResources (display, RootWindow(display, data->screen));
   1.301 +        res = X11_XRRGetScreenResources (display, RootWindow(display, data->screen));
   1.302          if (!res) {
   1.303              return SDL_SetError("Couldn't get XRandR screen resources");
   1.304          }
   1.305  
   1.306 -        output_info = XRRGetOutputInfo(display, res, data->xrandr_output);
   1.307 +        output_info = X11_XRRGetOutputInfo(display, res, data->xrandr_output);
   1.308          if (!output_info || output_info->connection == RR_Disconnected) {
   1.309 -            XRRFreeScreenResources(res);
   1.310 +            X11_XRRFreeScreenResources(res);
   1.311              return SDL_SetError("Couldn't get XRandR output info");
   1.312          }
   1.313  
   1.314 -        crtc = XRRGetCrtcInfo(display, res, output_info->crtc);
   1.315 +        crtc = X11_XRRGetCrtcInfo(display, res, output_info->crtc);
   1.316          if (!crtc) {
   1.317 -            XRRFreeOutputInfo(output_info);
   1.318 -            XRRFreeScreenResources(res);
   1.319 +            X11_XRRFreeOutputInfo(output_info);
   1.320 +            X11_XRRFreeScreenResources(res);
   1.321              return SDL_SetError("Couldn't get XRandR crtc info");
   1.322          }
   1.323  
   1.324 -        status = XRRSetCrtcConfig (display, res, output_info->crtc, CurrentTime,
   1.325 +        status = X11_XRRSetCrtcConfig (display, res, output_info->crtc, CurrentTime,
   1.326            crtc->x, crtc->y, modedata->xrandr_mode, crtc->rotation,
   1.327            &data->xrandr_output, 1);
   1.328  
   1.329 -        XRRFreeCrtcInfo(crtc);
   1.330 -        XRRFreeOutputInfo(output_info);
   1.331 -        XRRFreeScreenResources(res);
   1.332 +        X11_XRRFreeCrtcInfo(crtc);
   1.333 +        X11_XRRFreeOutputInfo(output_info);
   1.334 +        X11_XRRFreeScreenResources(res);
   1.335  
   1.336          if (status != Success) {
   1.337 -            return SDL_SetError("XRRSetCrtcConfig failed");
   1.338 +            return SDL_SetError("X11_XRRSetCrtcConfig failed");
   1.339          }
   1.340      }
   1.341  #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
   1.342  
   1.343  #if SDL_VIDEO_DRIVER_X11_XVIDMODE
   1.344      if (data->use_vidmode) {
   1.345 -        XF86VidModeSwitchToMode(display, data->vidmode_screen, &modedata->vm_mode);
   1.346 +        X11_XF86VidModeSwitchToMode(display, data->vidmode_screen, &modedata->vm_mode);
   1.347      }
   1.348  #endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
   1.349  
   1.350 @@ -872,11 +872,11 @@
   1.351      if (data->use_xinerama) {
   1.352          Display *display = ((SDL_VideoData *) _this->driverdata)->display;
   1.353          int screencount;
   1.354 -        XineramaScreenInfo *xinerama = XineramaQueryScreens(display, &screencount);
   1.355 +        XineramaScreenInfo *xinerama = X11_XineramaQueryScreens(display, &screencount);
   1.356          if (xinerama) {
   1.357              rect->x = xinerama[data->xinerama_screen].x_org;
   1.358              rect->y = xinerama[data->xinerama_screen].y_org;
   1.359 -            XFree(xinerama);
   1.360 +            X11_XFree(xinerama);
   1.361          }
   1.362      }
   1.363  #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */