summaryrefslogtreecommitdiffstats
path: root/src/inkscape-application.cpp
diff options
context:
space:
mode:
authorAlexander Valavanis <valavanisalex@gmail.com>2019-06-05 19:33:55 +0000
committerAlexander Valavanis <valavanisalex@gmail.com>2019-06-05 19:33:55 +0000
commit2e40143d6e75d50bf659abddc5c7c25fb1bc2436 (patch)
treee2fa747c95569dc3f77fcdfa770b3d404ff065cc /src/inkscape-application.cpp
parentHackfest2019: Rm tautological tests (diff)
parentUse a flowbox when there are more than two options for font feature settings. (diff)
downloadinkscape-2e40143d6e75d50bf659abddc5c7c25fb1bc2436.tar.gz
inkscape-2e40143d6e75d50bf659abddc5c7c25fb1bc2436.zip
Merge changes
Diffstat (limited to 'src/inkscape-application.cpp')
-rw-r--r--src/inkscape-application.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/inkscape-application.cpp b/src/inkscape-application.cpp
index 3b034b06b..a019d8515 100644
--- a/src/inkscape-application.cpp
+++ b/src/inkscape-application.cpp
@@ -42,6 +42,10 @@
#include "actions/actions-selection.h" // Actions
#include "actions/actions-transform.h" // Actions
+#ifdef GDK_WINDOWING_QUARTZ
+#include <gtkosxapplication.h>
+#endif
+
#ifdef WITH_DBUS
# include "extension/dbus/dbus-init.h"
#endif
@@ -66,7 +70,7 @@ InkscapeApplication::InkscapeApplication()
, _active_document(nullptr)
, _active_selection(nullptr)
, _active_view(nullptr)
- , _pdf_page(0)
+ , _pdf_page(1)
, _pdf_poppler(false)
{}
@@ -572,6 +576,11 @@ ConcreteInkscapeApplication<Gio::Application>::on_startup2()
Inkscape::Application::create(nullptr, false);
}
+#ifdef GDK_WINDOWING_QUARTZ
+static gboolean osx_openfile_callback(GtkosxApplication *, gchar const *,
+ ConcreteInkscapeApplication<Gtk::Application> *);
+#endif
+
template<>
void
ConcreteInkscapeApplication<Gtk::Application>::on_startup2()
@@ -614,6 +623,11 @@ ConcreteInkscapeApplication<Gtk::Application>::on_startup2()
} else {
// set_app_menu(menu);
}
+
+#ifdef GDK_WINDOWING_QUARTZ
+ GtkosxApplication *osxapp = gtkosx_application_get();
+ g_signal_connect(G_OBJECT(osxapp), "NSApplicationOpenFile", G_CALLBACK(osx_openfile_callback), this);
+#endif
}
/** We should not create a window if T is Gio::Applicaton.
@@ -709,6 +723,20 @@ ConcreteInkscapeApplication<Gtk::Application>::create_window(const Glib::RefPtr<
return (desktop); // Temp: Need to track desktop for shell mode.
}
+#ifdef GDK_WINDOWING_QUARTZ
+/**
+ * On macOS, handle dropping files on Inkscape.app icon and "Open With" file association.
+ */
+static gboolean osx_openfile_callback(GtkosxApplication *osxapp, gchar const *path,
+ ConcreteInkscapeApplication<Gtk::Application> *app)
+{
+ auto ptr = Gio::File::create_for_path(path);
+ g_return_val_if_fail(ptr, false);
+ app->create_window(ptr);
+ return true;
+}
+#endif
+
/** No need to destroy window if T is Gio::Application.
*/
template<class T>