mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 12:34:32 +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
|
||||
|
||||
#define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
|
||||
#define REFRESH_RATE_UNKNOWN java_awt_DisplayMode_REFRESH_RATE_UNKNOWN
|
||||
|
||||
typedef Status
|
||||
(*XRRQueryVersionType) (Display *dpy, int *major_versionp, int *minor_versionp);
|
||||
|
@ -1765,6 +1766,7 @@ X11GD_CreateDisplayMode(JNIEnv *env, jint width, jint height,
|
|||
{
|
||||
jclass displayModeClass;
|
||||
jmethodID cid;
|
||||
jint validRefreshRate = refreshRate;
|
||||
|
||||
displayModeClass = (*env)->FindClass(env, "java/awt/DisplayMode");
|
||||
if (JNU_IsNull(env, displayModeClass)) {
|
||||
|
@ -1780,8 +1782,13 @@ X11GD_CreateDisplayMode(JNIEnv *env, jint width, jint height,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// early versions of xrandr may report "empty" rates (6880694)
|
||||
if (validRefreshRate <= 0) {
|
||||
validRefreshRate = REFRESH_RATE_UNKNOWN;
|
||||
}
|
||||
|
||||
return (*env)->NewObject(env, displayModeClass, cid,
|
||||
width, height, bitDepth, refreshRate);
|
||||
width, height, bitDepth, validRefreshRate);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1926,8 +1933,7 @@ Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
|
|||
curRate = awt_XRRConfigCurrentRate(config);
|
||||
|
||||
if ((sizes != NULL) &&
|
||||
(curSizeIndex < nsizes) &&
|
||||
(curRate > 0))
|
||||
(curSizeIndex < nsizes))
|
||||
{
|
||||
XRRScreenSize curSize = sizes[curSizeIndex];
|
||||
displayMode = X11GD_CreateDisplayMode(env,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue