diff options
| author | Richard White <rwhite8282@gmail.com> | 2016-05-19 01:17:29 +0000 |
|---|---|---|
| committer | Richard White <rwhite8282@gmail.com> | 2016-05-19 01:17:29 +0000 |
| commit | 1fe9c2603c33fddcd9f2688b30e843f91e1a86fa (patch) | |
| tree | 13289cbe033a46a40eb829437e115b5393e2ca84 /src/ui/clipboard.cpp | |
| parent | Corrected frame extension stroke and fill values on 64 bit machine. (diff) | |
| parent | GTK3: Another widget named. (diff) | |
| download | inkscape-1fe9c2603c33fddcd9f2688b30e843f91e1a86fa.tar.gz inkscape-1fe9c2603c33fddcd9f2688b30e843f91e1a86fa.zip | |
Merge from Inkscape trunk.
(bzr r14668.1.3)
Diffstat (limited to 'src/ui/clipboard.cpp')
| -rw-r--r-- | src/ui/clipboard.cpp | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index f04d8a591..d581dbf7e 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -146,8 +146,6 @@ private: void _setClipboardColor(guint32); void _userWarn(SPDesktop *, char const *); - void _inkscape_wait_for_targets(std::list<Glib::ustring> &); - // private properites SPDocument *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it Inkscape::XML::Node *_defs; ///< Reference to the clipboard document's defs node @@ -759,7 +757,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) { SPUse *use=dynamic_cast<SPUse *>(item); - if(use){ + if (use && use->get_original()) { if(cloned_elements.insert(use->get_original()).second) _copyUsedDefs(use->get_original()); } @@ -1302,9 +1300,11 @@ Geom::Scale ClipboardManagerImpl::_getScale(SPDesktop *desktop, Geom::Point cons */ Glib::ustring ClipboardManagerImpl::_getBestTarget() { - // GTKmm's wait_for_targets() is broken, see the comment in _inkscape_wait_for_targets() - std::list<Glib::ustring> targets; // = _clipboard->wait_for_targets(); - _inkscape_wait_for_targets(targets); +#if WITH_GTKMM_3_0 + std::vector<Glib::ustring> targets = _clipboard->wait_for_targets(); +#else + std::list<Glib::ustring> targets = _clipboard->wait_for_targets(); +#endif // clipboard target debugging snippet /* @@ -1456,39 +1456,6 @@ void ClipboardManagerImpl::_userWarn(SPDesktop *desktop, char const *msg) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); } - -// GTKMM's clipboard::wait_for_targets is buggy and might return bogus, see -// -// https://bugs.launchpad.net/inkscape/+bug/296778 -// http://mail.gnome.org/archives/gtk-devel-list/2009-June/msg00062.html -// -// for details. Until this has been fixed upstream we will use our own implementation -// of this method, as copied from /gtkmm-2.16.0/gtk/gtkmm/clipboard.cc. -void ClipboardManagerImpl::_inkscape_wait_for_targets(std::list<Glib::ustring> &listTargets) -{ - //Get a newly-allocated array of atoms: - GdkAtom* targets = NULL; - gint n_targets = 0; - gboolean test = gtk_clipboard_wait_for_targets( gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), &targets, &n_targets ); - if (!test || (targets == NULL)) { - return; - } - - //Add the targets to the C++ container: - for (int i = 0; i < n_targets; i++) - { - //Convert the atom to a string: - gchar* const atom_name = gdk_atom_name(targets[i]); - - Glib::ustring target; - if (atom_name) { - target = Glib::ScopedPtr<char>(atom_name).get(); //This frees the gchar*. - } - - listTargets.push_back(target); - } -} - /* ####################################### ClipboardManager class ####################################### */ |
