From aa04c8f2336da87a9c2153737545958e3bdb7006 Mon Sep 17 00:00:00 2001 From: rogerman Date: Tue, 19 Sep 2017 14:47:55 -0700 Subject: [PATCH] Cocoa Port: Better guarantee that display views will always be assigned a display ID. --- .../userinterface/DisplayWindowController.mm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm index c23864468..094972c27 100644 --- a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm +++ b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm @@ -681,6 +681,7 @@ static std::unordered_map _screenMap; // CGDirectDisplayID displayID = [idNumber unsignedIntValue]; [[[self view] cdsVideoOutput] setCurrentDisplayID:displayID]; + [[[self view] cdsVideoOutput] clientDisplayView]->UpdateView(); } - (void) respondToScreenChange:(NSNotification *)aNotification @@ -1353,8 +1354,21 @@ static std::unordered_map _screenMap; // [self setupUserDefaults]; } +- (void)windowDidBecomeKey:(NSNotification *)notification +{ + if ([[[self view] cdsVideoOutput] currentDisplayID] == 0) + { + [self updateDisplayID]; + } +} + - (void)windowDidBecomeMain:(NSNotification *)notification { + if ([[[self view] cdsVideoOutput] currentDisplayID] == 0) + { + [self updateDisplayID]; + } + [emuControl setMainWindow:self]; [emuControl updateDisplayPanelTitles]; [view setNextResponder:[self window]]; @@ -1490,7 +1504,6 @@ static std::unordered_map _screenMap; // - (void)windowDidChangeScreen:(NSNotification *)notification { [self updateDisplayID]; - [[[self view] cdsVideoOutput] clientDisplayView]->UpdateView(); } #if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)