Skip to content
Permalink
Browse files
8239819: XToolkit: Misread of screen information memory
Reviewed-by: prr
  • Loading branch information
mrserb committed Apr 8, 2020
1 parent a6678d2 commit 10ca4873052ffc03b44a9c60872044b4f53e3319
Showing 3 changed files with 20 additions and 23 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,26 @@
*/
package sun.awt.X11;

import java.awt.*;
import java.awt.image.*;
import java.awt.AlphaComposite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferInt;
import java.awt.image.DataBufferUShort;
import java.awt.image.ImageObserver;
import java.awt.image.WritableRaster;

import sun.awt.IconInfo;
import sun.awt.image.ToolkitImage;
import sun.awt.image.ImageRepresentation;

import sun.awt.image.ToolkitImage;
import sun.util.logging.PlatformLogger;

public class XIconWindow extends XBaseWindow {
@@ -480,7 +493,7 @@ void setIconImage(Image img) {
if (window == 0) {
log.finest("Icon window wasn't set");
XCreateWindowParams params = getDelayedParams();
params.add(BORDER_PIXEL, Long.valueOf(XToolkit.getAwtDefaultFg()));
params.add(BORDER_PIXEL, Long.valueOf(0));
params.add(BACKGROUND_PIXMAP, iconPixmap);
params.add(COLORMAP, adata.get_awt_cmap());
params.add(DEPTH, awtImage.get_Depth());
@@ -211,7 +211,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
private static volatile int maxWindowWidthInPixels = -1;
private static volatile int maxWindowHeightInPixels = -1;

static long awt_defaultFg; // Pixel
private static XMouseInfoPeer xPeer;

/**
@@ -340,9 +339,6 @@ void init() {
}
tryXKB();

AwtScreenData defaultScreen = new AwtScreenData(XToolkit.getDefaultScreenData());
awt_defaultFg = defaultScreen.get_blackpixel();

arrowCursor = XlibWrapper.XCreateFontCursor(XToolkit.getDisplay(),
XCursorFontConstants.XC_arrow);
final String extraButtons = "sun.awt.enableExtraMouseButtons";
@@ -1493,7 +1489,6 @@ public int getScreenResolution() {
}

static native long getDefaultXColormap();
static native long getDefaultScreenData();

/**
* Returns a new input method adapter descriptor for native input methods.
@@ -2175,10 +2170,6 @@ private static void callTimeoutTasks() {
}
}

static long getAwtDefaultFg() {
return awt_defaultFg;
}

static boolean isLeftMouseButton(MouseEvent me) {
switch (me.getID()) {
case MouseEvent.MOUSE_PRESSED:
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -128,13 +128,6 @@ JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getDefaultXColormap
return (jlong) defaultConfig->awt_cmap;
}

JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getDefaultScreenData
(JNIEnv *env, jclass clazz)
{
return ptr_to_jlong(getDefaultConfig(DefaultScreen(awt_display)));
}


JNIEXPORT jint JNICALL
DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
{

0 comments on commit 10ca487

Please sign in to comment.