From cce339ea4286abbcdbb9c503864a21c7173dad8a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 31 Oct 2018 21:15:31 +0200 Subject: [PATCH] Use Qt signal for macOS Dock icon click event This moves the Dock icon click reaction code to the common place and allows some cleanup in obj_c code. According to the Apple's docs `class_replaceMethod` behaves as `class_addMethod`, if the method identified by name does not yet exist; or as `method_setImplementation`, if it does exist. Github-Pull: #14597 Rebased-From: 2464925e7be832d4926b6204169bbbc1646c6368 --- src/qt/bitcoingui.cpp | 6 ++++++ src/qt/macdockiconhandler.mm | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 784fdcb6e..152ba061b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -773,6 +773,12 @@ void BitcoinGUI::macosDockIconActivated() show(); activateWindow(); } +#else +void BitcoinGUI::macosDockIconActivated() +{ + show(); + activateWindow(); +} #endif void BitcoinGUI::optionsClicked() diff --git a/src/qt/macdockiconhandler.mm b/src/qt/macdockiconhandler.mm index 5eb23c76e..26a2ad817 100644 --- a/src/qt/macdockiconhandler.mm +++ b/src/qt/macdockiconhandler.mm @@ -49,5 +49,4 @@ void MacDockIconHandler::cleanup() */ void ForceActivation() { - [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; -} + [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; \ No newline at end of file