View | Details | Raw Unified | Return to bug 32320
Collapse All | Expand All

(-)a/vcl/unx/gtk3/gtk3gtkinst.cxx (-6 / +6 lines)
Lines 585-590 void VclGtkClipboard::setContents( Link Here
585
{
585
{
586
    osl::ClearableMutexGuard aGuard( m_aMutex );
586
    osl::ClearableMutexGuard aGuard( m_aMutex );
587
    Reference< datatransfer::clipboard::XClipboardOwner > xOldOwner( m_aOwner );
587
    Reference< datatransfer::clipboard::XClipboardOwner > xOldOwner( m_aOwner );
588
    bool bOwnerChange = (xOldOwner.is() && xOldOwner != xClipboardOwner);
588
    Reference< datatransfer::XTransferable > xOldContents( m_aContents );
589
    Reference< datatransfer::XTransferable > xOldContents( m_aContents );
589
    m_aContents = xTrans;
590
    m_aContents = xTrans;
590
    m_aOwner = xClipboardOwner;
591
    m_aOwner = xClipboardOwner;
Lines 592-597 void VclGtkClipboard::setContents( Link Here
592
    std::list< Reference< datatransfer::clipboard::XClipboardListener > > xListeners( m_aListeners );
593
    std::list< Reference< datatransfer::clipboard::XClipboardListener > > xListeners( m_aListeners );
593
    datatransfer::clipboard::ClipboardEvent aEv;
594
    datatransfer::clipboard::ClipboardEvent aEv;
594
595
596
    GtkClipboard* clipboard = gtk_clipboard_get(m_nSelection);
597
    if (bOwnerChange)
598
        gtk_clipboard_clear(clipboard);
599
    assert(m_aGtkTargets.empty());
595
    if (m_aContents.is())
600
    if (m_aContents.is())
596
    {
601
    {
597
        css::uno::Sequence<css::datatransfer::DataFlavor> aFormats = xTrans->getTransferDataFlavors();
602
        css::uno::Sequence<css::datatransfer::DataFlavor> aFormats = xTrans->getTransferDataFlavors();
Lines 605-619 void VclGtkClipboard::setContents( Link Here
605
            aEntry.info = 0;
610
            aEntry.info = 0;
606
            aGtkTargets.push_back(aEntry);
611
            aGtkTargets.push_back(aEntry);
607
612
608
            GtkClipboard* clipboard = gtk_clipboard_get(m_nSelection);
609
            gtk_clipboard_set_with_data(clipboard, aGtkTargets.data(), aGtkTargets.size(),
613
            gtk_clipboard_set_with_data(clipboard, aGtkTargets.data(), aGtkTargets.size(),
610
                                        ClipboardGetFunc, ClipboardClearFunc, this);
614
                                        ClipboardGetFunc, ClipboardClearFunc, this);
611
            gtk_clipboard_set_can_store(clipboard, aGtkTargets.data(), aGtkTargets.size());
615
            gtk_clipboard_set_can_store(clipboard, aGtkTargets.data(), aGtkTargets.size());
612
        }
616
        }
613
617
614
        for (auto &a : m_aGtkTargets)
615
            g_free(a.target);
616
617
        m_aGtkTargets = aGtkTargets;
618
        m_aGtkTargets = aGtkTargets;
618
    }
619
    }
619
620
Lines 621-627 void VclGtkClipboard::setContents( Link Here
621
622
622
    aGuard.clear();
623
    aGuard.clear();
623
624
624
    if( xOldOwner.is() && xOldOwner != xClipboardOwner )
625
    if (bOwnerChange)
625
        xOldOwner->lostOwnership( this, xOldContents );
626
        xOldOwner->lostOwnership( this, xOldContents );
626
    for( std::list< Reference< datatransfer::clipboard::XClipboardListener > >::iterator it =
627
    for( std::list< Reference< datatransfer::clipboard::XClipboardListener > >::iterator it =
627
         xListeners.begin(); it != xListeners.end() ; ++it )
628
         xListeners.begin(); it != xListeners.end() ; ++it )
628
- 

Return to bug 32320