Merge branch 'master' of github.com:debauchee/barrier

This commit is contained in:
walker0643 2018-02-16 11:55:41 -05:00
commit cebe7873a4
7 changed files with 145 additions and 9 deletions

79
build_mac_installer.sh Executable file
View File

@ -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"

View File

@ -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"

View File

@ -6,7 +6,7 @@
<key>CFBundleDisplayName</key>
<string>Barrier</string>
<key>CFBundleExecutable</key>
<string>barrier</string>
<string>barrier.sh</string>
<key>CFBundleIconFile</key>
<string>Barrier.icns</string>
<key>CFBundleIdentifier</key>

41
mac_reref_dylibs.sh Executable file
View File

@ -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

View File

@ -945,6 +945,10 @@ void MainWindow::changeEvent(QEvent* event)
windowStateChanged();
break;
}
default:
{
break;
}
}
}
// all that do not return are allowing the event to propagate

View File

@ -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

View File

@ -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
{