aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2019-09-01 16:07:39 +0800
committerfanquake <fanquake@gmail.com>2019-09-01 16:20:26 +0800
commit7d6f63cc2c2b9c4f07a43619eef0b7314474fffd (patch)
tree104eb7c6d3fe7a2f309780a284a6641a97f6dc38 /src/qt/guiutil.cpp
parent495db72ee7d8c8302d357cb10d2bc2df18b9a5e0 (diff)
parent0bb33b5348dbddd65b88a7f00449c965562355d3 (diff)
downloadbitcoin-7d6f63cc2c2b9c4f07a43619eef0b7314474fffd.tar.xz
Merge #16720: qt: Replace objc_msgSend() function calls with the native Objective-C syntax
0bb33b5348dbddd65b88a7f00449c965562355d3 qt: Replace objc_msgSend with native syntax (Hennadii Stepanov) Pull request description: Changes in Xcode 11 Objective-C Runtime cause an error (#16387) during building on MacOS 10.15 Catalina. This PR fixes this issue by replacing `objc_msgSend()` function calls with the native Objective-C syntax. Refs: - [changes in `objc_msgSend` function](https://developer.apple.com/documentation/objectivec/1456712-objc_msgsend?changes=latest_minor&language=objc) - [`OBJC_OLD_DISPATCH_PROTOTYPES` macro](https://developer.apple.com/documentation/objectivec/objc_old_dispatch_prototypes?language=objc) ACKs for top commit: l2a5b1: ACK 0bb33b5 - Diff looks good. Sending messages via native Objective-C code feels more robust and is more readable than casting all the `objc_msgSend` function calls to the appropriate function signature (which would also have fixed the issue). jonasschnelli: utACK 0bb33b5348dbddd65b88a7f00449c965562355d3 - Confirmed that the called macOS framework function is available on our build targets. fanquake: ACK 0bb33b5348dbddd65b88a7f00449c965562355d3 - Still works as expected. Tree-SHA512: c09cb684d06bd1da053a17c182b7bb1642e45bb347d26c76e1c5d835c320567caee366d85e34bb7f2be38e63ed041e0d06a56c2a9d89f7e5bece9b19cc5c6772
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r--src/qt/guiutil.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 59c7c0a44a..070df31aa6 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -57,9 +57,10 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#include <objc/objc-runtime.h>
#include <CoreServices/CoreServices.h>
#include <QProcess>
+
+void ForceActivation();
#endif
namespace GUIUtil {
@@ -359,10 +360,7 @@ bool isObscured(QWidget *w)
void bringToFront(QWidget* w)
{
#ifdef Q_OS_MAC
- // Force application activation on macOS. With Qt 5.4 this is required when
- // an action in the dock menu is triggered.
- id app = objc_msgSend((id) objc_getClass("NSApplication"), sel_registerName("sharedApplication"));
- objc_msgSend(app, sel_registerName("activateIgnoringOtherApps:"), YES);
+ ForceActivation();
#endif
if (w) {