-
Notifications
You must be signed in to change notification settings - Fork 38.7k
qt: Replace objc_msgSend() function calls with the native Objective-C syntax #16720
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
I can confirm 77dabca still builds on macOS Mojave 10.14.6. It also fixes the build for me on macOS Catalina 10.15 beta 3. Conversely you can reproduce the error in Mojave by setting I suggest tagging this 0.19, but hold off merging in favor of a solution that uses the new syntax. Apple deprecated this back in 2015. |
Done, agree here. |
77dabca to
30fbfd8
Compare
Done with the native Objective-C syntax. |
|
Nice! Will test soon. Maybe set |
5f6d923 to
f959d2f
Compare
Done. |
fanquake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
Definitely prefer actually fixing our code, rather than passing the flag to enable the old behaviour.
src/qt/macdockiconhandler.mm
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we don't support Qt 5.4 anymore, can you update this comment?
Obviously this workaround is still required with Qt 5.5+. Is there a Qt version where it's no-longer necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would indeed be useful to know. I didn't try removing the workaround altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a Qt version where it's no-longer necessary?
Looking through the Qt code base:
I suppose the workaround is not needed on Qt 5.6+. But I have no capabilities to test this hypothesis now.
I didn't try removing the workaround altogether.
I did. It works as expected on Catalina (Beta 3) + Qt 5.13.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our minimum QT version is 5.5.1, so maybe we should make a Github issue to consider dropping this workaround at the next bump https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md
8b6f5aa qt: Replace QFontMetrics::width() with TextWidth() (Hennadii Stepanov) Pull request description: Compiling master (d8fc997) on macOS Catalina (with a patch from #16720) reveals one more instance of `QFontMetrics::width()` which is supposed to be replaced with `TextWidth()` in the merged #16701. Sorry for incomplete solution provided in #16701. It’s especially sad that the line I missed lies in only 7 lines from the code touched in #16701. ACKs for top commit: fanquake: ACK 8b6f5aa Tree-SHA512: 65cd8bea550150e5ee47c1e906d8c2393547cf4feba3701a933a4f24fad5ecdb552ac2de4e1200ed14efaa0df0480150dd58fccbddc3b902f6c2141603874902
Sjors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK f959d2f on Mojave and Catalina, using homebrew QT 5.13.0
src/qt/macdockiconhandler.mm
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would indeed be useful to know. I didn't try removing the workaround altogether.
l2a5b1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK!
src/qt/guiutil.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps move the function declaration to macdockiconhandler.h and include this header instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are benefits of doing that? A header including will increase the current translation unit, however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I noticed the function declaration it was not immediately obvious why the corresponding definition was not in the same cpp file. It was only obvious why it is as it is after I found the corresponding function definition in the mackdockiconhandler.mm file.
I thought that by declaring the function in the mackdockiconhandler.h header file and keeping the declaration and definition close to each other, it would save the next person from wondering the same.
But perhaps it just me. I am afraid I don't have a better argument.
f959d2f to
0bb33b5
Compare
jonasschnelli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 0bb33b5 - Confirmed that the called macOS framework function is available on our build targets.
Travis error is irrelevant.
fanquake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 0bb33b5 - Still works as expected.
|
ACK 0bb33b5 - Diff looks good. Sending messages via native Objective-C code feels more robust and is more readable than casting all the |
…ve Objective-C syntax 0bb33b5 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 0bb33b5 - Confirmed that the called macOS framework function is available on our build targets. fanquake: ACK 0bb33b5 - Still works as expected. Tree-SHA512: c09cb684d06bd1da053a17c182b7bb1642e45bb347d26c76e1c5d835c320567caee366d85e34bb7f2be38e63ed041e0d06a56c2a9d89f7e5bece9b19cc5c6772
a60b7cc qt: Replace objc_msgSend with native syntax (furszy) 5d6f9b5 qt: Use GUIUtil::bringToFront where possible (furszy) 9e85183 qt: Add GUIUtil::bringToFront (furszy) 188199a Remove obj_c for macOS Dock icon menu (furszy) 75a41e2 Use Qt signal for macOS Dock icon click event (furszy) ff319ad Remove obj_c for macOS Dock icon setting. (furszy) Pull request description: Updating `MacDockIconHandler` to latest upstream. Fixing #1512 . Back ported PRs: #### gui: Add GUIUtil::bringToFront [14123](bitcoin#14123): ``` The sequence show -> raise -> activateWindow is factored out to the new function GUIUtil::bringToFront where a macOS fix is added in order to fix bitcoin#13829. Also included: simplification of BitcoinGUI::showNormalIfMinimized ``` #### qt: Replace objc_msgSend() function calls with the native Objective-C syntax [16720](bitcoin#16720): ``` Changes in Xcode 11 Objective-C Runtime cause an error (bitcoin#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 OBJC_OLD_DISPATCH_PROTOTYPES macro ``` ACKs for top commit: random-zebra: utACK a60b7cc Fuzzbawls: ACK a60b7cc Tree-SHA512: 95543a12d58187f17d27c6757351becd43a92c3edb8fcbc0a2b03a54d31cbad604ae149f2e866d82c3ce5f9a636571b8e51137fc5f639031a20080d8290889d9
* Remove obj_c for macOS Dock icon setting Qt `setWindowIcon()` does this work. * 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. * Remove obj_c for macOS Dock icon menu Qt `setAsDockMenu()` does this work. * qt: Add GUIUtil::bringToFront * qt: Use GUIUtil::bringToFront where possible * qt: All tray menu actions call showNormalIfMinimized * qt: Replace objc_msgSend with native syntax Co-authored-by: Hennadii Stepanov <[email protected]> Co-authored-by: João Barbosa <[email protected]>
…he native Objective-C syntax 0bb33b5 qt: Replace objc_msgSend with native syntax (Hennadii Stepanov) Pull request description: Changes in Xcode 11 Objective-C Runtime cause an error (bitcoin#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 0bb33b5 - Confirmed that the called macOS framework function is available on our build targets. fanquake: ACK 0bb33b5 - Still works as expected. Tree-SHA512: c09cb684d06bd1da053a17c182b7bb1642e45bb347d26c76e1c5d835c320567caee366d85e34bb7f2be38e63ed041e0d06a56c2a9d89f7e5bece9b19cc5c6772
a60b7cceb4d142239207ac2be2244aa999bdc1fd qt: Replace objc_msgSend with native syntax (furszy) 5d6f9b5c4c2288e1dd150c4e2722db2db2f5db5a qt: Use GUIUtil::bringToFront where possible (furszy) 9e851839737618f8215ec69768702ca6328ab9d9 qt: Add GUIUtil::bringToFront (furszy) 188199a77653bd548d293c5222e1a05773947918 Remove obj_c for macOS Dock icon menu (furszy) 75a41e2d3d7223da8381c9ce19e9454ee96a60b9 Use Qt signal for macOS Dock icon click event (furszy) ff319ad0e3d3319fb9a98087ac73686c8b6f4e17 Remove obj_c for macOS Dock icon setting. (furszy) Pull request description: Updating `MacDockIconHandler` to latest upstream. Fixing #1512 . Back ported PRs: #### gui: Add GUIUtil::bringToFront [14123](bitcoin/bitcoin#14123): ``` The sequence show -> raise -> activateWindow is factored out to the new function GUIUtil::bringToFront where a macOS fix is added in order to fix #13829. Also included: simplification of BitcoinGUI::showNormalIfMinimized ``` #### qt: Replace objc_msgSend() function calls with the native Objective-C syntax [16720](bitcoin/bitcoin#16720): ``` 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 OBJC_OLD_DISPATCH_PROTOTYPES macro ``` ACKs for top commit: random-zebra: utACK a60b7cceb4d142239207ac2be2244aa999bdc1fd Fuzzbawls: ACK a60b7cceb4d142239207ac2be2244aa999bdc1fd Tree-SHA512: 95543a12d58187f17d27c6757351becd43a92c3edb8fcbc0a2b03a54d31cbad604ae149f2e866d82c3ce5f9a636571b8e51137fc5f639031a20080d8290889d9 # Conflicts: # configure.ac # src/qt/macdockiconhandler.mm
… syntax bitcoin/bitcoin#16720 TODO: add bringToFront method in guiutil.cpp and it's usage in komodooceangui.cpp .
* Remove obj_c for macOS Dock icon setting Qt `setWindowIcon()` does this work. * 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. * Remove obj_c for macOS Dock icon menu Qt `setAsDockMenu()` does this work. * qt: Add GUIUtil::bringToFront * qt: Use GUIUtil::bringToFront where possible * qt: All tray menu actions call showNormalIfMinimized * qt: Replace objc_msgSend with native syntax Co-authored-by: Hennadii Stepanov <[email protected]> Co-authored-by: João Barbosa <[email protected]>
8b6f5aa qt: Replace QFontMetrics::width() with TextWidth() (Hennadii Stepanov) Pull request description: Compiling master (d8fc997) on macOS Catalina (with a patch from bitcoin#16720) reveals one more instance of `QFontMetrics::width()` which is supposed to be replaced with `TextWidth()` in the merged bitcoin#16701. Sorry for incomplete solution provided in bitcoin#16701. It’s especially sad that the line I missed lies in only 7 lines from the code touched in bitcoin#16701. ACKs for top commit: fanquake: ACK 8b6f5aa Tree-SHA512: 65cd8bea550150e5ee47c1e906d8c2393547cf4feba3701a933a4f24fad5ecdb552ac2de4e1200ed14efaa0df0480150dd58fccbddc3b902f6c2141603874902
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:
objc_msgSendfunctionOBJC_OLD_DISPATCH_PROTOTYPESmacro