Fix when an external display is connected
This commit is contained in:
parent
6092551d20
commit
8259cc3dca
Binary file not shown.
@ -4,6 +4,11 @@
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>RyujinxHelper.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>RyujinxKeyboard.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
|
@ -14,14 +14,32 @@ extern "C" {
|
||||
|
||||
static char *keyboardInput = NULL;
|
||||
|
||||
UIWindowScene *getMainDeviceWindowScene() {
|
||||
for (UIWindowScene *scene in UIApplication.sharedApplication.connectedScenes) {
|
||||
if ([scene isKindOfClass:[UIWindowScene class]]) {
|
||||
if (scene.screen == UIScreen.mainScreen) {
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (UIWindowScene *scene in UIApplication.sharedApplication.connectedScenes) {
|
||||
if ([scene isKindOfClass:[UIWindowScene class]]) {
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
void showKeyboardAlert(const char *title, const char *message, const char *placeholder) {
|
||||
NSString *alertTitle = [NSString stringWithUTF8String:title];
|
||||
NSString *alertMessage = [NSString stringWithUTF8String:message];
|
||||
NSString *alertPlaceholder = [NSString stringWithUTF8String:placeholder];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIWindowScene *activeScene = (UIWindowScene *)UIApplication.sharedApplication.connectedScenes.allObjects.firstObject;
|
||||
if (!activeScene || ![activeScene isKindOfClass:[UIWindowScene class]]) {
|
||||
UIWindowScene *activeScene = getMainDeviceWindowScene();
|
||||
if (!activeScene) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,7 +81,9 @@ void showKeyboardAlert(const char *title, const char *message, const char *place
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction *action) {
|
||||
free(keyboardInput);
|
||||
if (keyboardInput) {
|
||||
free(keyboardInput);
|
||||
}
|
||||
keyboardInput = strdup("");
|
||||
|
||||
popupWindow.hidden = YES;
|
||||
@ -82,8 +102,8 @@ void showAlert(const char *title, const char *message, bool showCancel) {
|
||||
NSString *alertMessage = [NSString stringWithUTF8String:message];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIWindowScene *activeScene = (UIWindowScene *)UIApplication.sharedApplication.connectedScenes.allObjects.firstObject;
|
||||
if (!activeScene || ![activeScene isKindOfClass:[UIWindowScene class]]) {
|
||||
UIWindowScene *activeScene = getMainDeviceWindowScene();
|
||||
if (!activeScene) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user