diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index c782e6687..9ee389640 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -564,7 +564,9 @@ void psClearInitLogs() { } void psActivateProcess(uint64 pid) { - objc_activateProgram(); + if (!pid) { + objc_activateProgram(App::wnd() ? App::wnd()->winId() : 0); + } } QString psCurrentCountry() { diff --git a/Telegram/SourceFiles/pspecific_mac_p.h b/Telegram/SourceFiles/pspecific_mac_p.h index 2470ae0a7..1ed7626c0 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.h +++ b/Telegram/SourceFiles/pspecific_mac_p.h @@ -73,7 +73,7 @@ void objc_execTelegram(); void objc_registerCustomScheme(); -void objc_activateProgram(); +void objc_activateProgram(WId winId); bool objc_moveFile(const QString &from, const QString &to); void objc_deleteDir(const QString &dir); diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm index 8df6af224..845ca5e2a 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.mm +++ b/Telegram/SourceFiles/pspecific_mac_p.mm @@ -982,8 +982,12 @@ void objc_execTelegram() { _execUpdater(NO); } -void objc_activateProgram() { +void objc_activateProgram(WId winId) { [NSApp activateIgnoringOtherApps:YES]; + if (winId) { + NSWindow *w = [reinterpret_cast(winId) window]; + [w makeKeyAndOrderFront:NSApp]; + } } bool objc_moveFile(const QString &from, const QString &to) {