8258788: incorrect response to change in window insets [lanai]

Dynamically change MTLLayer insets depending on FULL_WINDOW_CONTENT property. MTLLayer.h header cleanup.
This commit is contained in:
Alexey Ushakov
2021-04-01 15:42:47 +03:00
committed by alexey.ushakov@jetbrains.com
parent d1110c4e23
commit 65b23a75f3
7 changed files with 18 additions and 15 deletions

View File

@@ -35,6 +35,7 @@
#import "GeomUtilities.h"
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
#import "MTLLayer.h"
#define MASK(KEY) \
(sun_lwawt_macosx_CPlatformWindow_ ## KEY)
@@ -1174,6 +1175,16 @@ JNI_COCOA_ENTER(env);
screenContentRect.size.width,
screenContentRect.size.height);
nsWindow.contentView.frame = contentFrame;
if ([nsWindow.contentView.layer isKindOfClass:[MTLLayer class]]) {
MTLLayer* layer = (MTLLayer*)nsWindow.contentView.layer;
if (IS(newBits, FULL_WINDOW_CONTENT)) {
layer.topInset = 0;
layer.leftInset = 0;
} else {
layer.topInset = (jint)(frame.size.height - screenContentRect.size.height);
layer.leftInset = (jint)(screenContentRect.origin.x - frame.origin.x);
}
}
resized = YES;
}
}

View File

@@ -37,6 +37,7 @@
#include "IntArgbPre.h"
#import <Accelerate/Accelerate.h>
#import "common.h"
#ifdef DEBUG
#define TRACE_ISOBLIT

View File

@@ -30,6 +30,7 @@
#include "MTLRenderQueue.h"
#include "MTLSurfaceDataBase.h"
#include "GraphicsPrimitiveMgr.h"
#import "common.h"
@implementation MTLRescaleOp {
jboolean _isNonPremult;

View File

@@ -32,6 +32,7 @@
#include "MTLRenderQueue.h"
#import "MTLSamplerManager.h"
#import "MTLStencilManager.h"
#import "common.h"
extern jboolean MTLSD_InitMTLWindow(JNIEnv *env, MTLSDOps *mtlsdo);

View File

@@ -28,23 +28,10 @@
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
#include <CoreVideo/CVDisplayLink.h>
#import "common.h"
@class MTLContext;
@interface MTLLayer : CAMetalLayer
{
@private
jobject javaLayer;
// intermediate buffer, used the RQ lock to synchronize
MTLContext* ctx;
float bufferWidth;
float bufferHeight;
id<MTLTexture> buffer;
int nextDrawableCount;
int topInset;
int leftInset;
CVDisplayLinkRef displayLink;
}
@property (nonatomic) jobject javaLayer;
@property (readwrite, assign) MTLContext* ctx;

View File

@@ -34,6 +34,7 @@
#include "MTLSurfaceData.h"
#include "MTLUtils.h"
#import "MTLLayer.h"
#import "common.h"
/**
* Note: Some of the methods in this file apply a "magic number"

View File

@@ -37,6 +37,7 @@
#include "MTLVertexCache.h"
#include "MTLGlyphCache.h"
#include "MTLBlitLoops.h"
#import "common.h"
/**
* The following constants define the inner and outer bounds of the