Unverified Commit 997495a5 authored by Ivan Matkov's avatar Ivan Matkov Committed by GitHub

Do not change window properties during `MetalRedrawer` creation (#1034)

Creating transparent views/renderers shouldn't disable window shadows

Context: [CMP-7752](https://youtrack.jetbrains.com/issue/CMP-7752)
Interop blending should not disable window shadows on macOS
parent 4462fe46
...@@ -115,26 +115,6 @@ static jmethodID getOnOcclusionStateChangedMethodID(JNIEnv *env, jobject redrawe ...@@ -115,26 +115,6 @@ static jmethodID getOnOcclusionStateChangedMethodID(JNIEnv *env, jobject redrawe
return onOcclusionStateChanged; return onOcclusionStateChanged;
} }
static void setWindowPropertiesUnsafe(NSWindow* window, jboolean transparency) {
if (window == NULL) return;
if (transparency) {
window.hasShadow = NO;
}
}
static void setWindowProperties(NSWindow* window, jboolean transparency) {
if (NSThread.currentThread.isMainThread) {
setWindowPropertiesUnsafe(window, transparency);
} else {
// In case of OpenJDK, EDT thread != NSThread main thread
__weak NSWindow *weakWindow = window;
dispatch_async(dispatch_get_main_queue(), ^{
setWindowPropertiesUnsafe(weakWindow, transparency);
});
}
}
extern "C" extern "C"
{ {
...@@ -181,8 +161,6 @@ JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_createMe ...@@ -181,8 +161,6 @@ JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_createMe
device.inflightSemaphore = dispatch_semaphore_create(device.layer.maximumDrawableCount); device.inflightSemaphore = dispatch_semaphore_create(device.layer.maximumDrawableCount);
NSWindow* window = (__bridge NSWindow*) (void *) windowPtr; NSWindow* window = (__bridge NSWindow*) (void *) windowPtr;
setWindowProperties(window, transparency);
jmethodID onOcclusionStateChanged = getOnOcclusionStateChangedMethodID(env, redrawer); jmethodID onOcclusionStateChanged = getOnOcclusionStateChangedMethodID(env, redrawer);
device.occlusionObserver = device.occlusionObserver =
[[NSNotificationCenter defaultCenter] addObserverForName:NSWindowDidChangeOcclusionStateNotification [[NSNotificationCenter defaultCenter] addObserverForName:NSWindowDidChangeOcclusionStateNotification
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment