mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-1824 export NSWindow::setIgnoresMouseEvents to java internal API
(cherry picked from commit 4399dc382c)
This commit is contained in:
@@ -1129,6 +1129,17 @@ JNI_COCOA_ENTER(env);
|
||||
NSView *contentView = OBJC(contentViewPtr);
|
||||
NSRect frameRect = NSMakeRect(x, y, w, h);
|
||||
AWTWindow *owner = [OBJC(ownerPtr) delegate];
|
||||
|
||||
BOOL isIgnoreMouseEvents = NO;
|
||||
GET_CPLATFORM_WINDOW_CLASS_RETURN(nil);
|
||||
DECLARE_FIELD_RETURN(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;", nil);
|
||||
jobject awtWindow = (*env)->GetObjectField(env, obj, jf_target);
|
||||
if (awtWindow != NULL) {
|
||||
DECLARE_CLASS_RETURN(jc_Window, "java/awt/Window", nil);
|
||||
DECLARE_METHOD_RETURN(jm_isIgnoreMouseEvents, jc_Window, "isIgnoreMouseEvents", "()Z", nil);
|
||||
isIgnoreMouseEvents = (*env)->CallBooleanMethod(env, awtWindow, jm_isIgnoreMouseEvents) == JNI_TRUE ? YES : NO;
|
||||
(*env)->DeleteLocalRef(env, awtWindow);
|
||||
}
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
|
||||
window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow
|
||||
@@ -1138,7 +1149,12 @@ JNI_COCOA_ENTER(env);
|
||||
contentView:contentView];
|
||||
// the window is released is CPlatformWindow.nativeDispose()
|
||||
|
||||
if (window) [window.nsWindow retain];
|
||||
if (window) {
|
||||
[window.nsWindow retain];
|
||||
if (isIgnoreMouseEvents) {
|
||||
[window.nsWindow setIgnoresMouseEvents:YES];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
JNI_COCOA_EXIT(env);
|
||||
|
||||
@@ -4002,6 +4002,19 @@ public class Window extends Container implements Accessible {
|
||||
hasCustomDecoration = true;
|
||||
}
|
||||
|
||||
private volatile boolean ignoreMouseEvents;
|
||||
|
||||
boolean isIgnoreMouseEvents() {
|
||||
return ignoreMouseEvents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set via reflection (JB JdkEx API).
|
||||
*/
|
||||
void setIgnoreMouseEvents(boolean ignore) {
|
||||
ignoreMouseEvents = ignore;
|
||||
}
|
||||
|
||||
// ************************** MIXING CODE *******************************
|
||||
|
||||
// A window has an owner, but it does NOT have a container
|
||||
|
||||
Reference in New Issue
Block a user