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:
parent
790d630d17
commit
8251b906b6
1 changed files with 18 additions and 0 deletions
|
|
@ -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 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
|
|||
{
|
||||
[NSApp stop:nil];
|
||||
|
||||
CGDisplayRegisterReconfigurationCallback(display_reconfigured, NULL);
|
||||
_glfwPlatformPostEmptyEvent();
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||
{
|
||||
CGDisplayRemoveReconfigurationCallback(display_reconfigured, NULL);
|
||||
}
|
||||
|
||||
- (void)applicationDidHide:(NSNotification *)notification
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
Loading…
Reference in a new issue