summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2019-05-29 19:28:02 +0000
committerThomas Holder <thomas@thomas-holder.de>2019-05-29 19:28:02 +0000
commitd66a11f144601d1bb2fb0007e3e4463a393b6bd3 (patch)
treeffe9f81118c094033ab4530991fc6d388bb81967 /src/widgets
parentRename effect attribute to "implements-custom-gui" (diff)
downloadinkscape-d66a11f144601d1bb2fb0007e3e4463a393b6bd3.tar.gz
inkscape-d66a11f144601d1bb2fb0007e3e4463a393b6bd3.zip
macOS: gtk-mac-integration
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/desktop-widget.cpp19
-rw-r--r--src/widgets/desktop-widget.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 32ca1bac2..f4e278a5a 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -79,6 +79,9 @@
#include "toolbox.h"
#include "widget-sizes.h"
+#ifdef GDK_WINDOWING_QUARTZ
+#include <gtkosxapplication.h>
+#endif
using Inkscape::DocumentUndo;
using Inkscape::UI::Widget::UnitTracker;
@@ -928,6 +931,17 @@ sp_desktop_widget_realize (GtkWidget *widget)
window->get_style_context()->remove_class("symbolic");
}
}
+
+#ifdef GDK_WINDOWING_QUARTZ
+ // native macOS menu
+ auto osxapp = gtkosx_application_get();
+ auto menushell = static_cast<Gtk::MenuShell *>(dtw->menubar());
+ if (osxapp && menushell && window) {
+ menushell->set_parent(*window);
+ gtkosx_application_set_menu_bar(osxapp, menushell->gobj());
+ gtkosx_application_set_use_quartz_accelerators(osxapp, false);
+ }
+#endif
}
/* This is just to provide access to common functionality from sp_desktop_widget_realize() above
@@ -1691,7 +1705,12 @@ SPDesktopWidget* SPDesktopWidget::createInstance(SPDocument *document)
dtw->_menubar = build_menubar(dtw->desktop);
dtw->_menubar->set_name("MenuBar");
dtw->_menubar->show_all();
+
+#ifdef GDK_WINDOWING_QUARTZ
+ // native macOS menu: do this later because we don't have the window handle yet
+#else
dtw->_vbox->pack_start(*dtw->_menubar, false, false);
+#endif
dtw->layoutWidgets();
diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h
index f0b42222d..d21ba7bb8 100644
--- a/src/widgets/desktop-widget.h
+++ b/src/widgets/desktop-widget.h
@@ -269,6 +269,8 @@ public:
void updateTitle(gchar const *uri);
bool onFocusInEvent(GdkEventFocus*);
+ Gtk::MenuBar *menubar() { return _menubar; }
+
Inkscape::UI::Widget::Dock* getDock();
static GType getType();