improved window activation in os x

This commit is contained in:
John Preston 2015-08-12 21:02:20 +03:00
parent 1b16064db6
commit afac237f03
3 changed files with 9 additions and 3 deletions

View File

@ -564,7 +564,9 @@ void psClearInitLogs() {
} }
void psActivateProcess(uint64 pid) { void psActivateProcess(uint64 pid) {
objc_activateProgram(); if (!pid) {
objc_activateProgram(App::wnd() ? App::wnd()->winId() : 0);
}
} }
QString psCurrentCountry() { QString psCurrentCountry() {

View File

@ -73,7 +73,7 @@ void objc_execTelegram();
void objc_registerCustomScheme(); void objc_registerCustomScheme();
void objc_activateProgram(); void objc_activateProgram(WId winId);
bool objc_moveFile(const QString &from, const QString &to); bool objc_moveFile(const QString &from, const QString &to);
void objc_deleteDir(const QString &dir); void objc_deleteDir(const QString &dir);

View File

@ -982,8 +982,12 @@ void objc_execTelegram() {
_execUpdater(NO); _execUpdater(NO);
} }
void objc_activateProgram() { void objc_activateProgram(WId winId) {
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
if (winId) {
NSWindow *w = [reinterpret_cast<NSView*>(winId) window];
[w makeKeyAndOrderFront:NSApp];
}
} }
bool objc_moveFile(const QString &from, const QString &to) { bool objc_moveFile(const QString &from, const QString &to) {