Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8247332: Checkbox reaches inconsistent state on tap to click
8251477: java/awt/Frame/MiscUndecorated/RepaintTest.java fails with metal pipeline
8247739: Lanai : SwingSet2Demo -More than one radio button can be selected the same time
8252501: Sometimes more than one menu items are shown as highlighted on hover
8242187: Lanai - JCheckBox and JRadioButton can get into inconsitent visual state -- but recover on window refresh
8252907: Motif L&F - SwingSet2 - Two Toolbar buttons are shown as selected
  • Loading branch information
jayathirthrao committed Dec 18, 2020
1 parent 5c53e62 commit 52639745f1fd0244d434010530ee2964235b0988
@@ -27,6 +27,7 @@
#define MTLLayer_h_Included
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
#include <CoreVideo/CVDisplayLink.h>
#import "common.h"

#import <JavaNativeFoundation/JavaNativeFoundation.h>
@@ -44,6 +45,7 @@
int nextDrawableCount;
int topInset;
int leftInset;
CVDisplayLinkRef displayLink;
}

@property (nonatomic, retain) JNFWeakJObjectWrapper *javaLayer;
@@ -54,6 +56,7 @@
@property (readwrite, assign) int nextDrawableCount;
@property (readwrite, assign) int topInset;
@property (readwrite, assign) int leftInset;
@property (readwrite, assign) CVDisplayLinkRef displayLink;

- (id) initWithJavaLayer:(JNFWeakJObjectWrapper *)layer;

@@ -66,6 +69,7 @@
DY2:(jfloat)dy2;
- (void) blitCallback;
- (void) display;
- (void) redraw;
@end

#endif /* CGLLayer_h_Included */
@@ -40,6 +40,7 @@ @implementation MTLLayer
@synthesize topInset;
@synthesize leftInset;
@synthesize nextDrawableCount;
@synthesize displayLink;

- (id) initWithJavaLayer:(JNFWeakJObjectWrapper *)layer
{
@@ -70,6 +71,8 @@ - (id) initWithJavaLayer:(JNFWeakJObjectWrapper *)layer
self.framebufferOnly = NO;
self.nextDrawableCount = 0;
self.opaque = FALSE;
CVDisplayLinkCreateWithActiveCGDisplays(&displayLink);
CVDisplayLinkSetOutputCallback(displayLink, &displayLinkCallback, (__bridge void*)self);
return self;
}

@@ -79,8 +82,9 @@ - (void) blitTexture {
return;
}

if (self.nextDrawableCount != 0)
if (self.nextDrawableCount != 0) {
return;
}
@autoreleasepool {
if ((self.buffer.width == 0) || (self.buffer.height == 0)) {
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: cannot create drawable of size 0");
@@ -117,6 +121,10 @@ - (void) blitTexture {

- (void) dealloc {
self.javaLayer = nil;
if (CVDisplayLinkIsRunning(self.displayLink))
CVDisplayLinkStop(self.displayLink);
CVDisplayLinkRelease(self.displayLink);
self.displayLink = nil;
[super dealloc];
}

@@ -141,6 +149,21 @@ - (void) display {
[self blitCallback];
[super display];
}

- (void) redraw {
AWT_ASSERT_APPKIT_THREAD;
[self setNeedsDisplay];
}

CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext)
{
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer_displayLinkCallback() called");
@autoreleasepool {
MTLLayer *layer = (__bridge MTLLayer *)displayLinkContext;
[layer performSelectorOnMainThread:@selector(redraw) withObject:nil waitUntilDone:NO];
}
return kCVReturnSuccess;
}
@end

/*
@@ -187,8 +210,12 @@ - (void) display {
layer.drawableSize =
CGSizeMake(layer.buffer.width,
layer.buffer.height);
if (!CVDisplayLinkIsRunning(layer.displayLink))
CVDisplayLinkStart(layer.displayLink);
} else {
layer.ctx = NULL;
if (CVDisplayLinkIsRunning(layer.displayLink))
CVDisplayLinkStop(layer.displayLink);
}
}

@@ -1159,17 +1159,6 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
[cbwrapper release];
}];
[commandbuf commit];
BMTLSDOps *dstOps = MTLRenderQueue_GetCurrentDestination();
if (dstOps != NULL) {
MTLSDOps *dstMTLOps = (MTLSDOps *)dstOps->privOps;
MTLLayer *layer = (MTLLayer*)dstMTLOps->layer;
if (layer != NULL) {
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
AWT_ASSERT_APPKIT_THREAD;
[layer setNeedsDisplay];
}];
}
}
}
RESET_PREVIOUS_OP();
}

0 comments on commit 5263974

Please sign in to comment.