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
This commit is contained in:
Alexey Ushakov
2022-11-07 19:33:12 +01:00
committed by jbrbot
parent a206e2d7fa
commit f8a671912b

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;
@@ -490,7 +493,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)