Lines 146-153
Link Here
|
146 |
void _setClipboardColor(guint32); |
146 |
void _setClipboardColor(guint32); |
147 |
void _userWarn(SPDesktop *, char const *); |
147 |
void _userWarn(SPDesktop *, char const *); |
148 |
|
148 |
|
149 |
void _inkscape_wait_for_targets(std::list<Glib::ustring> &); |
|
|
150 |
|
151 |
// private properites |
149 |
// private properites |
152 |
SPDocument *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it |
150 |
SPDocument *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it |
153 |
Inkscape::XML::Node *_defs; ///< Reference to the clipboard document's defs node |
151 |
Inkscape::XML::Node *_defs; ///< Reference to the clipboard document's defs node |
Lines 1302-1310
Link Here
|
1302 |
*/ |
1300 |
*/ |
1303 |
Glib::ustring ClipboardManagerImpl::_getBestTarget() |
1301 |
Glib::ustring ClipboardManagerImpl::_getBestTarget() |
1304 |
{ |
1302 |
{ |
1305 |
// GTKmm's wait_for_targets() is broken, see the comment in _inkscape_wait_for_targets() |
1303 |
std::list<Glib::ustring> targets = _clipboard->wait_for_targets(); |
1306 |
std::list<Glib::ustring> targets; // = _clipboard->wait_for_targets(); |
|
|
1307 |
_inkscape_wait_for_targets(targets); |
1308 |
|
1304 |
|
1309 |
// clipboard target debugging snippet |
1305 |
// clipboard target debugging snippet |
1310 |
/* |
1306 |
/* |
Lines 1456-1494
Link Here
|
1456 |
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); |
1452 |
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); |
1457 |
} |
1453 |
} |
1458 |
|
1454 |
|
1459 |
|
|
|
1460 |
// GTKMM's clipboard::wait_for_targets is buggy and might return bogus, see |
1461 |
// |
1462 |
// https://bugs.launchpad.net/inkscape/+bug/296778 |
1463 |
// http://mail.gnome.org/archives/gtk-devel-list/2009-June/msg00062.html |
1464 |
// |
1465 |
// for details. Until this has been fixed upstream we will use our own implementation |
1466 |
// of this method, as copied from /gtkmm-2.16.0/gtk/gtkmm/clipboard.cc. |
1467 |
void ClipboardManagerImpl::_inkscape_wait_for_targets(std::list<Glib::ustring> &listTargets) |
1468 |
{ |
1469 |
//Get a newly-allocated array of atoms: |
1470 |
GdkAtom* targets = NULL; |
1471 |
gint n_targets = 0; |
1472 |
gboolean test = gtk_clipboard_wait_for_targets( gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), &targets, &n_targets ); |
1473 |
if (!test || (targets == NULL)) { |
1474 |
return; |
1475 |
} |
1476 |
|
1477 |
//Add the targets to the C++ container: |
1478 |
for (int i = 0; i < n_targets; i++) |
1479 |
{ |
1480 |
//Convert the atom to a string: |
1481 |
gchar* const atom_name = gdk_atom_name(targets[i]); |
1482 |
|
1483 |
Glib::ustring target; |
1484 |
if (atom_name) { |
1485 |
target = Glib::ScopedPtr<char>(atom_name).get(); //This frees the gchar*. |
1486 |
} |
1487 |
|
1488 |
listTargets.push_back(target); |
1489 |
} |
1490 |
} |
1491 |
|
1492 |
/* ####################################### |
1455 |
/* ####################################### |
1493 |
ClipboardManager class |
1456 |
ClipboardManager class |
1494 |
####################################### */ |
1457 |
####################################### */ |