sun.java2d.SunGraphicsEnvironment Java Examples

The following examples show how to use sun.java2d.SunGraphicsEnvironment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Win32GraphicsDevice.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void initScaleFactors() {
    if (SunGraphicsEnvironment.isUIScaleEnabled()) {
        if (debugScaleX > 0 && debugScaleY > 0) {
            scaleX = debugScaleX;
            scaleY = debugScaleY;
            setNativeScale(screen, scaleX, scaleY);
        } else {
            initNativeScale(screen);
            scaleX = getNativeScaleX(screen);
            scaleY = getNativeScaleY(screen);
        }
    } else {
        scaleX = 1;
        scaleY = 1;
    }
}
 
Example #2
Source File: XToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void initializeDesktopProperties() {
    desktopProperties.put("DnD.Autoscroll.initialDelay",
                          Integer.valueOf(50));
    desktopProperties.put("DnD.Autoscroll.interval",
                          Integer.valueOf(50));
    desktopProperties.put("DnD.Autoscroll.cursorHysteresis",
                          Integer.valueOf(5));
    desktopProperties.put("Shell.shellFolderManager",
                          "sun.awt.shell.ShellFolderManager");
    // Don't want to call getMultiClickTime() if we are headless
    if (!GraphicsEnvironment.isHeadless()) {
        desktopProperties.put("awt.multiClickInterval",
                              Integer.valueOf(getMultiClickTime()));
        desktopProperties.put("awt.mouse.numButtons",
                              Integer.valueOf(getNumberOfButtons()));
        if(SunGraphicsEnvironment.isUIScaleEnabled()) {
            addPropertyChangeListener("gnome.Xft/DPI", evt ->
                                                 localEnv.displayChanged());
        }
    }
}
 
Example #3
Source File: GraphicsEnvironmentHacking.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * @return null if not avaliable
 */
@Nullable
public static Boolean isUIScaleEnabled(GraphicsEnvironment ge) throws Exception {
  if (ge instanceof SunGraphicsEnvironment) {
    Method m = isUIScaleEnabled();
    if (m == null) {
      return null;
    }

    if (Modifier.isStatic(m.getModifiers())) {
      return (Boolean)m.invoke(null);
    }
    else {
      return (Boolean)m.invoke(ge);
    }
  }

  return null;
}
 
Example #4
Source File: Win32GraphicsDevice.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void initScaleFactors() {
    if (SunGraphicsEnvironment.isUIScaleEnabled()) {
        if (debugScaleX > 0 && debugScaleY > 0) {
            scaleX = debugScaleX;
            scaleY = debugScaleY;
            setNativeScale(screen, scaleX, scaleY);
        } else {
            initNativeScale(screen);
            scaleX = getNativeScaleX(screen);
            scaleY = getNativeScaleY(screen);
        }
    } else {
        scaleX = 1;
        scaleY = 1;
    }
}
 
Example #5
Source File: X11SurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop =
                (String) java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}
 
Example #6
Source File: VolatileSurfaceManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #7
Source File: SwingUtilities2.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #8
Source File: VolatileSurfaceManager.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;
    this.atCurrent = vImg.getGraphicsConfig().getDefaultTransform();

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #9
Source File: SwingUtilities2.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #10
Source File: VolatileSurfaceManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #11
Source File: SwingUtilities2.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #12
Source File: SwingUtilities2.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #13
Source File: VolatileSurfaceManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #14
Source File: SwingUtilities2.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #15
Source File: X11SurfaceData.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop =
                (String) java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}
 
Example #16
Source File: VolatileSurfaceManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #17
Source File: X11SurfaceData.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop =
                (String) java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}
 
Example #18
Source File: VolatileSurfaceManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;
    this.atCurrent = vImg.getGraphicsConfig().getDefaultTransform();

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #19
Source File: X11SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop =
                (String) java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}
 
Example #20
Source File: X11SurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop = java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}
 
Example #21
Source File: X11GraphicsDevice.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private int initScaleFactor() {

        if (SunGraphicsEnvironment.isUIScaleEnabled()) {

            double debugScale = SunGraphicsEnvironment.getDebugScale();

            if (debugScale >= 1) {
                return (int) debugScale;
            }
            int nativeScale = getNativeScale();
            return nativeScale >= 1 ? nativeScale : 1;
        }

        return 1;
    }
 
Example #22
Source File: CGraphicsDevice.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void initScaleFactor() {
    if (SunGraphicsEnvironment.isUIScaleEnabled()) {
        double debugScale = SunGraphicsEnvironment.getDebugScale();
        scale = (int) (debugScale >= 1
                ? Math.round(debugScale)
                : nativeGetScaleFactor(displayID));
    } else {
        scale = 1;
    }
}
 
Example #23
Source File: SwingUtilities2.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #24
Source File: VolatileSurfaceManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #25
Source File: SwingUtilities2.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #26
Source File: X11SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop =
                (String) java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}
 
Example #27
Source File: X11SurfaceData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop =
                (String) java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}
 
Example #28
Source File: SwingUtilities2.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isLocalDisplay() {
    boolean isLocal;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (ge instanceof SunGraphicsEnvironment) {
        isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
    } else {
        isLocal = true;
    }
    return isLocal;
}
 
Example #29
Source File: VolatileSurfaceManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #30
Source File: X11SurfaceData.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isAccelerationEnabled() {
    if (accelerationEnabled == null) {

        if (GraphicsEnvironment.isHeadless()) {
            accelerationEnabled = Boolean.FALSE;
        } else {
            String prop =
                (String) java.security.AccessController.doPrivileged(
                    new sun.security.action.GetPropertyAction("sun.java2d.pmoffscreen"));
            if (prop != null) {
                // true iff prop==true, false otherwise
                accelerationEnabled = Boolean.valueOf(prop);
            } else {
                boolean isDisplayLocal = false;
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                if (ge instanceof SunGraphicsEnvironment) {
                    isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
                 }

                // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
                // Don't use pixmaps if dga is available,
                // or we are local and shared memory Pixmaps are not available.
                accelerationEnabled =
                    !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
            }
        }
    }
    return accelerationEnabled.booleanValue();
}