diff --git a/build_mac_installer.sh b/build_mac_installer.sh new file mode 100755 index 00000000..021562dd --- /dev/null +++ b/build_mac_installer.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +# change this to rename the installer package +B_DMG="Barrier-v1.9.dmg" + +cd $(dirname $0) + +# sanity check so we don't distribute packages full of debug symbols +B_BUILD_TYPE=$(grep -E ^CMAKE_BUILD_TYPE build/CMakeCache.txt | cut -d= -f2) +if [ "$B_BUILD_TYPE" != "Release" ]; then + echo Will only build installers for Release builds + exit 1 +fi + +B_REREF_SCRIPT=$(pwd)/mac_reref_dylibs.sh +if [ ! -x $B_REREF_SCRIPT ]; then + echo Missing script: $B_REREF_SCRIPT + exit 1 +fi + +# remove any old copies so there's no confusion about whever this +# process completes successfully or not +rm -rf build/bundle/{bundle.dmg,$B_DMG} + +B_BINARY_PATH=$(pwd)/build/bin +cd build/bundle/Barrier.app/Contents 2>/dev/null +if [ $? -ne 0 ]; then + echo Please make sure that the build completed successfully + echo before trying to create the installer. + exit 1 +fi + +# MacOS folder holds the executables, non-system libraries, +# and the startup script +rm -rf MacOS +mkdir MacOS || exit 1 +cd MacOS || exit 1 + +# copy all executables +cp ${B_BINARY_PATH}/* . || exit 1 + +# copy the qt platform plugin +# TODO: this is hacky and will probably break if there is more than one qt +# version installed. need a better way to find this library +B_COCOA=$(find /usr/local/Cellar/qt -type f -name libqcocoa.dylib | head -1) +if [ $? -ne 0 ] || [ "x$B_COCOA" = "x" ]; then + echo "Could not find cocoa platform plugin" + exit 1 +fi +mkdir platforms +cp $B_COCOA platforms/ || exit 1 + +# make sure we can r/w all these binaries +chmod -R u+rw * || exit 1 + +# only one executable (barrier) needs non-system libraries although it's +# libraries can call each other. use a recursive script to handle the +# re-referencing +$B_REREF_SCRIPT barrier || exit 1 +# the cocoa platform plugin also needs to know where to find the qt libraries. +# because it exists in a subdirectory we append ../ to the relative path of the +# libraries in its metadata +$B_REREF_SCRIPT platforms/libqcocoa.dylib ../ || exit 1 + +# create a startup script that will change to the binary directory +# before starting barrier +printf "%s\n" "#!/bin/sh" "cd \$(dirname \$0)" "exec ./barrier" > barrier.sh +chmod +x barrier.sh + +# create the DMG to be distributed in build/bundle +cd ../../.. +hdiutil create -size 64m -fs HFS+ -volname "Barrier" bundle.dmg || exit 1 +hdiutil attach bundle.dmg -mountpoint mnt || exit 1 +cp -r Barrier.app mnt/ || exit 1 +hdiutil detach mnt || exit 1 +hdiutil convert bundle.dmg -format UDZO -o $B_DMG || exit 1 +rm bundle.dmg + +echo "Installer created successfully" diff --git a/clean_build.sh b/clean_build.sh index f5a99807..290d570e 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -13,9 +13,10 @@ if [ "$(uname)" = "Darwin" ]; then # OSX needs a lot of extra help, poor thing # run the osx_environment.sh script to fix paths [ -r ../osx_environment.sh ] && source ../osx_environment.sh - B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk $B_CMAKE_FLAGS" + B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" fi B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" +echo Starting Barrier $B_BUILD_TYPE build... $B_CMAKE $B_CMAKE_FLAGS .. || exit 1 make || exit 1 echo "Build completed successfully" diff --git a/dist/macos/bundle/Barrier.app/Contents/Info.plist.in b/dist/macos/bundle/Barrier.app/Contents/Info.plist.in index 277963ae..b973f5e9 100644 --- a/dist/macos/bundle/Barrier.app/Contents/Info.plist.in +++ b/dist/macos/bundle/Barrier.app/Contents/Info.plist.in @@ -6,7 +6,7 @@ CFBundleDisplayName Barrier CFBundleExecutable - barrier + barrier.sh CFBundleIconFile Barrier.icns CFBundleIdentifier diff --git a/mac_reref_dylibs.sh b/mac_reref_dylibs.sh new file mode 100755 index 00000000..15191bd2 --- /dev/null +++ b/mac_reref_dylibs.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# $1 = binary (program or dylib) +B_TARGET=$1 +if [ "x$B_TARGET" = "x" ]; then + echo Which binary needs to be re-referenced? + exit 1 +fi + +cd $(dirname $B_TARGET) || exit 1 + +# where to find non-system libraries relative to target's directory. +# the vast majority of the time this should be empty +B_REL_PATH=$2 + +# we're in target's directory now. trim off the path +B_TARGET=$(basename $B_TARGET) + +# get a list of non-system libraries and make local copies +B_LIBS=$(otool -XL $B_TARGET | awk '{ print $1 }' | grep -Ev '^(/usr/lib|/System)') +[ $? -ne 0 ] && exit 1 +for B_LIB in $B_LIBS; do + B_LIB_NAME=$(basename $B_LIB) + + # ignore self-references + [ "$B_TARGET" = "$B_LIB_NAME" ] && continue + + B_DST=${B_REL_PATH}${B_LIB_NAME} + if [ ! -e $B_DST ]; then + cp $B_LIB $B_DST || exit 1 + chmod u+rw $B_DST || exit 1 + # recursively call this script on libraries purposefully not passing + # $B_REL_PATH so that it is only used explicitly + $0 $B_DST + fi + + # adjust the target's metadata to point to the local copy + # rather than the system-wide copy which would only exist on + # a development machine + install_name_tool -change $B_LIB @loader_path/$B_DST $B_TARGET || exit 1 +done diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index ae1fad40..83dbd548 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -945,6 +945,10 @@ void MainWindow::changeEvent(QEvent* event) windowStateChanged(); break; } + default: + { + break; + } } } // all that do not return are allowing the event to propagate diff --git a/src/gui/src/ScreenSetupView.h b/src/gui/src/ScreenSetupView.h index a263a8d5..a6605117 100644 --- a/src/gui/src/ScreenSetupView.h +++ b/src/gui/src/ScreenSetupView.h @@ -43,14 +43,14 @@ class ScreenSetupView : public QTableView ScreenSetupModel* model() const; protected: - void mouseDoubleClickEvent(QMouseEvent*); + void mouseDoubleClickEvent(QMouseEvent*) override; void setTableSize(); - void resizeEvent(QResizeEvent*); - void dragEnterEvent(QDragEnterEvent* event); - void dragMoveEvent(QDragMoveEvent* event); - void startDrag(Qt::DropActions supportedActions); - QStyleOptionViewItem viewOptions() const; - void scrollTo(const QModelIndex&, ScrollHint) {} + void resizeEvent(QResizeEvent*) override; + void dragEnterEvent(QDragEnterEvent* event) override; + void dragMoveEvent(QDragMoveEvent* event) override; + void startDrag(Qt::DropActions supportedActions) override; + QStyleOptionViewItem viewOptions() const override; + void scrollTo(const QModelIndex&, ScrollHint) override {} }; #endif diff --git a/src/lib/platform/OSXDragView.m b/src/lib/platform/OSXDragView.m index 6ebc5973..9f774993 100644 --- a/src/lib/platform/OSXDragView.m +++ b/src/lib/platform/OSXDragView.m @@ -25,6 +25,17 @@ @dynamic animatesToDestination; @dynamic numberOfValidItemsForDrop; +/* springLoadingHighlight is a property that will not be auto-synthesized by + clang. explicitly synthesizing it here as well as defining an empty handler + for resetSpringLoading() satisfies the compiler */ +@synthesize springLoadingHighlight = _springLoadingHighlight; + +/* unused */ +- (void) +resetSpringLoading +{ +} + - (id) initWithFrame:(NSRect)frame {