Merge pull request #694 from andreasb242/mac-menu

Mac menu
presentation
andreasb242 7 years ago committed by GitHub
commit ceda6c4028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      CMakeLists.txt
  2. 1
      mac-setup/.gitignore
  3. 23
      mac-setup/README.md
  4. 5
      mac-setup/build-app.sh
  5. 12
      mac-setup/build-mac-integration.sh
  6. 21
      src/gui/MainWindow.cpp

@ -104,6 +104,14 @@ if (WIN32)
message ("Automatically set ENABLE_MATHTEX OFF on Windows")
endif ()
# Mac integration
pkg_check_modules (MacIntegration "gtk-mac-integration")
if (MacIntegration_FOUND)
message("Enable Mac integration")
add_includes_ldflags ("${MacIntegration_LDFLAGS}" "${MacIntegration_INCLUDE_DIRS}")
add_definitions(-DMAC_INTEGRATION)
endif ()
# Unstable features
option (UNSTABLE_HIGHDPI_FIXES "HighDPI Fixes (unstable)" OFF)
@ -199,7 +207,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Install icons
install(FILES ui/pixmaps/xournalpp.svg
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)
# Symlink are not easy to use with CMake, therefor simple install a copy...
install(FILES ui/pixmaps/application-x-xopp.svg
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/mimetypes/)
@ -223,7 +231,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/mimelnk/application)
install(FILES desktop/x-xopt.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/mimelnk/application)
install(FILES desktop/xournalpp.thumbnailer
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/thumbnailers)
install(PROGRAMS utility/usr/local/bin/xopp-recording.sh

@ -8,3 +8,4 @@ openjpeg*
gtk-mac-bundler
.xournalpp*
*.zip
gtk-mac-integration

@ -3,10 +3,12 @@ Do not install macports or homebrew. If you have installed it, you need to
create a new user, and use this for the whole process. jhbuild does not work,
if there is such an environment installed.
### Make sure the Development environement is installed
### Make sure the Development environment is installed
Open a Terminal, and type in **git**, confirm popup from Appstore with "Install" to install development tools.
### Build GTK
### Build Libraries, needs to be once
#### 1. Build GTK
Execute in this folder.
````bash
./build-gtk3.sh
@ -19,6 +21,23 @@ Execute
$HOME/gtk/inst/bin/python setup.py install
````
Build again. It should now build
````bash
./build-gtk3.sh
````
#### 2. Build Poppler
Execute in this folder.
````bash
./build-poppler.sh
````
#### 3. Build Mac integration
Execute in this folder.
````bash
./build-mac-integration.sh
````
### Build Xournal++
````bash
export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH"

@ -55,7 +55,10 @@ for locale in "${supportedLocales[@]}" ; do
mkdir -p setup/share/locale/$locale/LC_MESSAGES
# Xournal Translation
cp -r ../build/po/$locale.gmo ./Xournal++.app/Contents/Resources/share/locale/$locale/LC_MESSAGES/xournalpp.mo
cp ../build/po/$locale.gmo ./Xournal++.app/Contents/Resources/share/locale/$locale/LC_MESSAGES/xournalpp.mo
# Mac Integration
cp $HOME/gtk/inst/share/locale/zh_CN/LC_MESSAGES/gtk-mac-integration.mo ./Xournal++.app/Contents/Resources/share/locale/$locale/LC_MESSAGES/gtk-mac-integration.mo
done
echo "Create zip"

@ -0,0 +1,12 @@
export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH"
rm -rf ./gtk-mac-integration
git clone https://gitlab.gnome.org/GNOME/gtk-mac-integration.git
cd ./gtk-mac-integration
./autogen.sh
./configure --prefix=$HOME/gtk/inst
make -j4
make install
cd ..

@ -22,6 +22,10 @@
#include <i18n.h>
#include <XojMsgBox.h>
#ifdef MAC_INTEGRATION
#include <gtkosxapplication.h>
#endif
#include <gdk/gdk.h>
MainWindow::MainWindow(GladeSearchpath* gladeSearchPath, Control* control)
@ -128,6 +132,23 @@ MainWindow::MainWindow(GladeSearchpath* gladeSearchPath, Control* control)
gtk_drag_dest_add_text_targets(this->window);
LayerCtrlListener::registerListener(control->getLayerController());
#ifdef MAC_INTEGRATION
GtkosxApplication* osxApp = gtkosx_application_get();
GtkWidget* menubar = get("mainMenubar");
gtk_widget_hide(menubar);
gtkosx_application_set_menu_bar(osxApp, GTK_MENU_SHELL(menubar));
g_signal_connect(osxApp, "NSApplicationWillTerminate", G_CALLBACK(
+[](GtkosxApplication* osxApp, MainWindow* self)
{
XOJ_CHECK_TYPE_OBJ(self, MainWindow);
self->control->quit();
}), this);
gtkosx_application_ready(osxApp);
#endif
}
MainWindow::~MainWindow()

Loading…
Cancel
Save