mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 20:44:41 +02:00
6880694: GraphicsDevice.setFullScreenWindow(null) throws NPE if there's a fullscreen window displayed
Handle "empty" refresh rates Reviewed-by: art, anthony
This commit is contained in:
parent
1fbf705739
commit
67ffb33afa
1 changed files with 9 additions and 3 deletions
|
@ -1654,6 +1654,7 @@ Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint(JNIEnv *env,
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
|
|
||||||
#define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
|
#define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
|
||||||
|
#define REFRESH_RATE_UNKNOWN java_awt_DisplayMode_REFRESH_RATE_UNKNOWN
|
||||||
|
|
||||||
typedef Status
|
typedef Status
|
||||||
(*XRRQueryVersionType) (Display *dpy, int *major_versionp, int *minor_versionp);
|
(*XRRQueryVersionType) (Display *dpy, int *major_versionp, int *minor_versionp);
|
||||||
|
@ -1765,6 +1766,7 @@ X11GD_CreateDisplayMode(JNIEnv *env, jint width, jint height,
|
||||||
{
|
{
|
||||||
jclass displayModeClass;
|
jclass displayModeClass;
|
||||||
jmethodID cid;
|
jmethodID cid;
|
||||||
|
jint validRefreshRate = refreshRate;
|
||||||
|
|
||||||
displayModeClass = (*env)->FindClass(env, "java/awt/DisplayMode");
|
displayModeClass = (*env)->FindClass(env, "java/awt/DisplayMode");
|
||||||
if (JNU_IsNull(env, displayModeClass)) {
|
if (JNU_IsNull(env, displayModeClass)) {
|
||||||
|
@ -1780,8 +1782,13 @@ X11GD_CreateDisplayMode(JNIEnv *env, jint width, jint height,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// early versions of xrandr may report "empty" rates (6880694)
|
||||||
|
if (validRefreshRate <= 0) {
|
||||||
|
validRefreshRate = REFRESH_RATE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
return (*env)->NewObject(env, displayModeClass, cid,
|
return (*env)->NewObject(env, displayModeClass, cid,
|
||||||
width, height, bitDepth, refreshRate);
|
width, height, bitDepth, validRefreshRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1926,8 +1933,7 @@ Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
|
||||||
curRate = awt_XRRConfigCurrentRate(config);
|
curRate = awt_XRRConfigCurrentRate(config);
|
||||||
|
|
||||||
if ((sizes != NULL) &&
|
if ((sizes != NULL) &&
|
||||||
(curSizeIndex < nsizes) &&
|
(curSizeIndex < nsizes))
|
||||||
(curRate > 0))
|
|
||||||
{
|
{
|
||||||
XRRScreenSize curSize = sizes[curSizeIndex];
|
XRRScreenSize curSize = sizes[curSizeIndex];
|
||||||
displayMode = X11GD_CreateDisplayMode(env,
|
displayMode = X11GD_CreateDisplayMode(env,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue