Add a listener for GPU changed events on macOS
Currently does nothing, but could potentially be used to fix: https://github.com/kovidgoyal/kitty/issues/794 Will need someone with the hardware though to test exactly what needs to be done to restore the custom cursor image.
This commit is contained in:
@@ -286,6 +286,18 @@ static int translateKey(unsigned int key, GLFWbool apply_keymap)
|
||||
return _glfw.ns.keycodes[key];
|
||||
}
|
||||
|
||||
static void
|
||||
display_reconfigured(CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo)
|
||||
{
|
||||
(void)(userInfo); (void)(display); (void)(flags);
|
||||
if (flags & kCGDisplayBeginConfigurationFlag) {
|
||||
return;
|
||||
}
|
||||
if (flags & kCGDisplaySetModeFlag) {
|
||||
// GPU possibly changed
|
||||
}
|
||||
}
|
||||
|
||||
// Translate a GLFW keycode to a Cocoa modifier flag
|
||||
//
|
||||
static NSUInteger translateKeyToModifierFlag(int key)
|
||||
@@ -488,9 +500,15 @@ static GLFWapplicationshouldhandlereopenfun handle_reopen_callback = NULL;
|
||||
{
|
||||
[NSApp stop:nil];
|
||||
|
||||
CGDisplayRegisterReconfigurationCallback(display_reconfigured, NULL);
|
||||
_glfwPlatformPostEmptyEvent();
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||
{
|
||||
CGDisplayRemoveReconfigurationCallback(display_reconfigured, NULL);
|
||||
}
|
||||
|
||||
- (void)applicationDidHide:(NSNotification *)notification
|
||||
{
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user