JBR-4959 [macOS Ventura] Screen flickering after OS update when IDE is full screen

Replace multiple CHANGE_SCREEN notifications fired around the same time with just one

(cherry picked from commit cd6ca71ea8)
This commit is contained in:
Alexey Ushakov
2022-11-07 19:33:12 +01:00
committed by jbrbot
parent 1cb47518d2
commit 441f9277ef

View File

@@ -44,6 +44,9 @@
// The following is a AWT convention?
#define PREFERENCES_TAG 42
// Do not pass extra NOTIFY_CHANGE_SCREEN during this timeout
#define CHANGE_SCREEN_MUTE_TIME 0.1
static void addMenuItem(NSMenuItem* menuItem, NSInteger index) {
AWT_ASSERT_APPKIT_THREAD;
@@ -512,7 +515,14 @@ AWT_ASSERT_APPKIT_THREAD;
}
+ (void)_didChangeScreen {
[ApplicationDelegate _notifyJava:com_apple_eawt__AppEventHandler_NOTIFY_CHANGE_SCREEN];
static CFTimeInterval time = 0;
CFTimeInterval ctime = CACurrentMediaTime();
if (time + CHANGE_SCREEN_MUTE_TIME < ctime) {
time = ctime;
[ApplicationDelegate _notifyJava:com_apple_eawt__AppEventHandler_NOTIFY_CHANGE_SCREEN];
}
}
// Retrieves the menu to be attached to the Dock icon (AppKit callback)