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

(-)a/src/systemclipboard/waylandclipboard.cpp (-1 / +29 lines)
Lines 311-316 public: Link Here
311
311
312
Q_SIGNALS:
312
Q_SIGNALS:
313
    void cancelled();
313
    void cancelled();
314
    void dataSendingCompleted();
314
315
315
protected:
316
protected:
316
    void ext_data_control_source_v1_send(const QString &mime_type, int32_t fd) override;
317
    void ext_data_control_source_v1_send(const QString &mime_type, int32_t fd) override;
Lines 393-398 void DataControlSource::ext_data_control_source_v1_send(const QString &mime_type Link Here
393
    if (written != ba.size()) {
394
    if (written != ba.size()) {
394
        qWarning() << "Failed to send all clipobard data; sent" << written << "bytes out of" << ba.size();
395
        qWarning() << "Failed to send all clipobard data; sent" << written << "bytes out of" << ba.size();
395
    }
396
    }
397
398
    Q_EMIT dataSendingCompleted();
396
}
399
}
397
400
398
void DataControlSource::ext_data_control_source_v1_cancelled()
401
void DataControlSource::ext_data_control_source_v1_cancelled()
Lines 646-660 void WaylandClipboard::setMimeData(QMimeData *mime, QClipboard::Mode mode) Link Here
646
        return;
649
        return;
647
    }
650
    }
648
651
652
     auto waylandApp = qGuiApp->nativeInterface<QNativeInterface::QWaylandApplication>();
653
     auto display = waylandApp->display();
654
655
    QEventLoop waitLoop;
656
    QTimer requestTimer;
657
    requestTimer.setInterval(200);
658
659
    QTimer timeoutTimer;
660
    timeoutTimer.setSingleShot(true);
661
649
    auto source = std::make_unique<DataControlSource>(m_manager->create_data_source(), mime);
662
    auto source = std::make_unique<DataControlSource>(m_manager->create_data_source(), mime);
650
    source->moveToThread(m_thread.get());
663
    source->moveToThread(m_thread.get());
664
    connect(source.get(), &DataControlSource::dataSendingCompleted, &waitLoop, &QEventLoop::quit);
665
651
    if (mode == QClipboard::Clipboard) {
666
    if (mode == QClipboard::Clipboard) {
652
        m_device->setSelection(std::move(source));
667
        m_device->setSelection(std::move(source));
653
    } else if (mode == QClipboard::Selection) {
668
    } else if (mode == QClipboard::Selection) {
654
        m_device->setPrimarySelection(std::move(source));
669
        m_device->setPrimarySelection(std::move(source));
655
    }
670
    }
656
}
657
671
672
    connect(&requestTimer, &QTimer::timeout, [display]{
673
        wl_display_dispatch_pending(display);
674
        wl_display_flush(display);
675
    });
676
677
    connect(&timeoutTimer, &QTimer::timeout, [&waitLoop]{
678
        waitLoop.quit();
679
    });
680
681
    timeoutTimer.start(5000);
682
    requestTimer.start();
683
    waitLoop.exec();
684
    requestTimer.stop();
685
}
658
void WaylandClipboard::clear(QClipboard::Mode mode)
686
void WaylandClipboard::clear(QClipboard::Mode mode)
659
{
687
{
660
    if (!m_device) {
688
    if (!m_device) {

Return to bug 57684