Yalantis/uCrop · info

init_fullscreen(): Xrandr extension not supported by the X s

Error message

init_fullscreen(): Xrandr extension not supported by the X server.

What it means

CImgDisplay::init_fullscreen() uses the Xrandr extension to enumerate and switch X server display resolutions for fullscreen mode. When the X server does not support/report Xrandr, no resolutions list can be built and cimg::warn() emits this non-fatal warning; the code then falls back to simply resizing the window to the current screen size. Fullscreen still works, but native resolution switching is unavailable.

Source

Thrown at ucrop/src/main/jni/CImg.h:10257

            const unsigned int
              nw = (unsigned int)(X11_attr.resolutions[i].width),
              nh = (unsigned int)(X11_attr.resolutions[i].height);
            if (nw>=_width && nh>=_height &&
                nw<=(unsigned int)(X11_attr.resolutions[X11_attr.curr_resolution].width) &&
                nh<=(unsigned int)(X11_attr.resolutions[X11_attr.curr_resolution].height))
              X11_attr.curr_resolution = i;
          }
          if (X11_attr.curr_resolution>0) {
            XRRScreenConfiguration *config = XRRGetScreenInfo(dpy,DefaultRootWindow(dpy));
            XRRSetScreenConfig(dpy,config,DefaultRootWindow(dpy),
                               X11_attr.curr_resolution,X11_attr.curr_rotation,CurrentTime);
            XRRFreeScreenConfigInfo(config);
            XSync(dpy,0);
          }
        }
      }
      if (!X11_attr.resolutions)
        cimg::warn(_cimgdisplay_instance
                   "init_fullscreen(): Xrandr extension not supported by the X server.",
                   cimgdisplay_instance);
#endif

      const unsigned int sx = screen_width(), sy = screen_height();
      if (sx==_width && sy==_height) return;
      XSetWindowAttributes attr_set;

      attr_set.background_pixel = XBlackPixel(dpy,XDefaultScreen(dpy));
      attr_set.override_redirect = 1;
      _background_window = XCreateWindow(dpy,DefaultRootWindow(dpy),0,0,sx,sy,0,0,
                                         InputOutput,CopyFromParent,CWBackPixel | CWOverrideRedirect,&attr_set);
      XEvent event;
      XSelectInput(dpy,_background_window,StructureNotifyMask);
      XMapRaised(dpy,_background_window);
      do XWindowEvent(dpy,_background_window,StructureNotifyMask,&event);
      while (event.type!=MapNotify);

View on GitHub (pinned to f788b534b4)

Solutions

  1. Verify Xrandr support with `xdpyinfo -ext RANDR` or `xrandr` and enable RANDR on the X server if possible
  2. Accept the warning: fullscreen degrades gracefully to current-resolution fullscreen, which is usually fine
  3. Use Xvfb/X servers with RANDR enabled, or run a compositor/desktop session that supports it
  4. Upgrade the X server / graphics stack on headless or embedded systems

Example fix

// before (headless CI)
Xvfb :1 &  // older Xvfb without RANDR
// after
Xvfb :1 -screen 0 1920x1080x24 +extension RANDR &
Defensive patterns

Strategy: fallback

Validate before calling

// shell: verify Xrandr before enabling resolution-switching fullscreen
xdpyinfo -ext RANDR | grep RANDR || echo "Xrandr unavailable; use current-resolution fullscreen"

Prevention

When it happens

Trigger: Calling CImgDisplay::toggle_mode()/fullscreen on an X server without the RANDR extension (older servers, or servers with RANDR disabled), or linking against a CImg built without Xrandr support while the server also lacks it.

Common situations: Running on minimal/legacy X servers (Xvfb, old VNC, remote X), containers without xrandr support, X servers launched without the RANDR extension enabled.

Related errors


AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08). Data as JSON: /api/errors/74d7db2f0cc66f15. Report an issue: GitHub.