JBR-7726 X11 toolkit: Dialog buttons rendering black rectangle after hovering

This commit is contained in:
Maxim Kartashev
2024-10-23 13:38:54 +04:00
parent 2b6d4ad971
commit 566de7f8dc
3 changed files with 17 additions and 4 deletions

View File

@@ -4531,6 +4531,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
// to translate to client area.
g.translate(insets.left, insets.top);
for (int i = 0; i < backBuffers.length; i++) {
// If we try to draw outside the buffer's bounds, some backends may
// fill this area with some color rather than avoid drawing altogether.
// Protect against that by clipping the area to the back buffer's rectangle.
x1 = Math.max(0, x1);
y1 = Math.max(0, y1);
x2 = Math.min(backBuffers[i].getWidth(), x2);
y2 = Math.min(backBuffers[i].getHeight(), y2);
g.drawImage(backBuffers[i],
x1, y1, x2, y2,
x1, y1, x2, y2,

View File

@@ -875,7 +875,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
updateChildrenSizes();
WindowLocation eventLocation = getNewLocation(xe);
Dimension eventDimension = new Dimension(xe.get_width(), xe.get_height());
var insets = dimensions.getInsets();
var insetsWidth = scaleUp(insets.left + insets.right);
var insetsHeight = scaleUp(insets.top + insets.bottom);
Dimension eventDimension = new Dimension(xe.get_width() + insetsWidth, xe.get_height() + insetsHeight);
boolean xinerama = XToolkit.localEnv.runningXinerama();
SunToolkit.executeOnEventHandlerThread(target, () -> {
@@ -884,7 +887,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
? checkIfOnNewScreen(new Rectangle(eventLocation.getDeviceLocation(), eventDimension))
: new Dimension(scaleDown(eventDimension.width), scaleDown(eventDimension.height));
Point newUserLocation = eventLocation.getUserLocation();
WindowDimensions newDimensions = new WindowDimensions(newUserLocation, newSize, getRealInsets(), true);
WindowDimensions newDimensions = new WindowDimensions(newUserLocation, newSize, getRealInsets(), false);
if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("Insets are {0}, new dimensions {1}",
getRealInsets(), newDimensions);

View File

@@ -143,7 +143,10 @@ public class XEmbeddedFramePeer extends XFramePeer {
}
WindowLocation eventLocation = getNewLocation(xe);
Dimension eventDimension = new Dimension(xe.get_width(), xe.get_height());
var insets = dimensions.getInsets();
var insetsWidth = scaleUp(insets.left + insets.right);
var insetsHeight = scaleUp(insets.top + insets.bottom);
Dimension eventDimension = new Dimension(xe.get_width() + insetsWidth, xe.get_height() + insetsHeight);
boolean xinerama = XToolkit.localEnv.runningXinerama();
// fix for 5063031
// if we use super.handleConfigureNotifyEvent() we would get wrong
@@ -161,7 +164,7 @@ public class XEmbeddedFramePeer extends XFramePeer {
width = newSize.width;
height = newSize.height;
dimensions.setClientSize(width, height);
dimensions.setSize(width, height);
dimensions.setLocation(x, y);
}