@Override protected final synchronized int getGammaRampLength() { if (gotGammaRampLength) { return gammaRampLength; } long display = getOrCreateSharedDpy(defaultDevice); if (0 == display) { return 0; } int[] size = new int[1]; boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, X11Lib.DefaultScreen(display), size, 0); if (!res) { return 0; } gotGammaRampLength = true; gammaRampLength = size[0]; return gammaRampLength; }
@Override protected final synchronized int getGammaRampLength(final NativeSurface surface) { if (gotGammaRampLength) { return gammaRampLength; } final long display = surface.getDisplayHandle(); if (0 == display) { return 0; } final int screenIdx = surface.getScreenIndex(); final int[] size = new int[1]; final boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, screenIdx, size, 0); if (!res) { return 0; } gotGammaRampLength = true; gammaRampLength = size[0]; System.err.println("XXX: Gamma ramp size: " + gammaRampLength); return gammaRampLength; }