Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore OpenGL context after showing file dialog. #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions project/src/mac/dialogs.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ int systools_dialogs_dialog_box( const char *title, const char *message, int err
}
return result;
#else
NSOpenGLContext *context = [NSOpenGLContext currentContext];

NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setTitle:[NSString stringWithUTF8String:title]];
[savePanel setMessage:[NSString stringWithUTF8String:msg]];
Expand Down Expand Up @@ -140,6 +142,7 @@ int systools_dialogs_dialog_box( const char *title, const char *message, int err
}

[keyWindow makeKeyWindow];
[context makeCurrentContext];

return 0;
#endif
Expand Down Expand Up @@ -191,6 +194,8 @@ void systools_dialogs_open_file( const char *title, const char *msg, struct ARG_
NavDialogDispose(ref);
}
#else
NSOpenGLContext *context = [NSOpenGLContext currentContext];

NSOpenPanel *openPanel = [[NSOpenPanel alloc] init];
[openPanel setTitle:[NSString stringWithUTF8String:title]];
[openPanel setMessage:[NSString stringWithUTF8String:msg]];
Expand Down Expand Up @@ -227,6 +232,7 @@ void systools_dialogs_open_file( const char *title, const char *msg, struct ARG_
}

[keyWindow makeKeyWindow];
[context makeCurrentContext];
#endif
}

Expand Down Expand Up @@ -269,6 +275,8 @@ void systools_dialogs_open_file( const char *title, const char *msg, struct ARG_
}
return result;
#else
NSOpenGLContext *context = [NSOpenGLContext currentContext];

NSOpenPanel *openPanel = [[NSOpenPanel alloc] init];
[openPanel setTitle:[NSString stringWithUTF8String:title]];
[openPanel setMessage:[NSString stringWithUTF8String:msg]];
Expand All @@ -288,6 +296,7 @@ void systools_dialogs_open_file( const char *title, const char *msg, struct ARG_
}

[keyWindow makeKeyWindow];
[context makeCurrentContext];

return 0;
#endif
Expand Down