Skip to content

Commit

Permalink
Merge pull request #20 from exploshot/master
Browse files Browse the repository at this point in the history
macOSX (Catalina) problems
  • Loading branch information
exploshot committed May 1, 2020
2 parents 5dec3d2 + f23f017 commit bad2461
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -22,15 +22,15 @@ matrix:
- Qt5_DIR="/opt/qt512/lib/cmake/Qt5"
- name: "macOS, Debug"
os: osx
osx_image: xcode10.2
osx_image: xcode11.3
env:
- CMAKE_GENERATOR_NAME="Unix Makefiles"
- CMAKE_BUILD_TYPE="Debug"
- CMAKE_TOOLCHAIN_FILE_NAME=clang-cxx14.cmake
- Qt5_DIR="/usr/local/opt/qt/lib/cmake/Qt5"
- name: "macOS, Release"
os: osx
osx_image: xcode10.2
osx_image: xcode11.3
env:
- CMAKE_GENERATOR_NAME="Unix Makefiles"
- CMAKE_BUILD_TYPE="Release"
Expand Down
9 changes: 9 additions & 0 deletions src/gui/macdockiconhandler.mm
Expand Up @@ -10,9 +10,12 @@
#include <QWidget>

#undef slots

#include <AppKit/AppKit.h>
#include <Cocoa/Cocoa.h>
#include <objc/objc.h>
#include <objc/message.h>
#include <objc/runtime.h>

#if QT_VERSION < 0x050000
extern void qt_mac_set_dock_menu(QMenu *);
Expand All @@ -31,6 +34,11 @@ bool dockClickHandler(id self,SEL _cmd,...) {
}

void setupDockClickHandler() {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
Class delClass = (Class)[[[NSApplication sharedApplication] delegate] class];
SEL shouldHandle = sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:");
class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B@:");
#else
Class cls = objc_getClass("NSApplication");
id appInst = objc_msgSend((id)cls, sel_registerName("sharedApplication"));

Expand All @@ -43,6 +51,7 @@ void setupDockClickHandler() {
else
class_addMethod(delClass, shouldHandle, (IMP)dockClickHandler,"B@:");
}
#endif
}


Expand Down

0 comments on commit bad2461

Please sign in to comment.