mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-08 01:21:42 +01:00
JBR-1874 Cursor not changing from 'default' to 'text'. Additional fix after reopening.
(cherry picked from commit 5a29d4ade9)
This commit is contained in:
committed by
alexey.ushakov@jetbrains.com
parent
9dddf3e9cb
commit
69a9f3c24c
@@ -45,6 +45,12 @@ final class CCursorManager extends LWCursorManager {
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
private static void resetCurrentCursor() {
|
||||
if (theInstance != null) {
|
||||
theInstance.currentCursor = null;
|
||||
}
|
||||
}
|
||||
|
||||
private volatile Cursor currentCursor;
|
||||
|
||||
private CCursorManager() { }
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
|
||||
// NSWindow overrides delegate methods
|
||||
- (BOOL) canBecomeKeyWindow;
|
||||
- (void) becomeKeyWindow;
|
||||
- (BOOL) canBecomeMainWindow;
|
||||
- (BOOL) worksWhenModal;
|
||||
- (void)sendEvent:(NSEvent *)event;
|
||||
|
||||
@@ -109,7 +109,12 @@ static NSPoint lastTopLeftPoint;
|
||||
- (void)sendEvent:(NSEvent *)event { \
|
||||
[(AWTWindow*)[self delegate] sendEvent:event]; \
|
||||
[super sendEvent:event]; \
|
||||
}
|
||||
} \
|
||||
\
|
||||
- (void)becomeKeyWindow { \
|
||||
[super becomeKeyWindow]; \
|
||||
[(AWTWindow*)[self delegate] becomeKeyWindow]; \
|
||||
} \
|
||||
|
||||
@implementation AWTWindow_Normal
|
||||
AWT_NS_WINDOW_IMPLEMENTATION
|
||||
@@ -548,6 +553,17 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
return self.isEnabled && (IS(self.styleBits, SHOULD_BECOME_KEY) || [self isSimpleWindowOwnedByEmbeddedFrame]);
|
||||
}
|
||||
|
||||
- (void) becomeKeyWindow {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
// Reset current cursor in CCursorManager such that any following mouse update event
|
||||
// restores the correct cursor to the frame context specific one.
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
DECLARE_CLASS(jc_CCursorManager, "sun/lwawt/macosx/CCursorManager");
|
||||
DECLARE_STATIC_METHOD(sjm_resetCurrentCursor, jc_CCursorManager, "resetCurrentCursor", "()V");
|
||||
(*env)->CallStaticVoidMethod(env, jc_CCursorManager, sjm_resetCurrentCursor);
|
||||
}
|
||||
|
||||
- (BOOL) canBecomeMainWindow {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
if (!self.isEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user