xwayland: do not set a new data source if it has no MIMEs

ref #6247
This commit is contained in:
Vaxry 2024-06-16 21:34:17 +02:00
parent d5ef10abf4
commit b15be9c77d

View file

@ -1034,17 +1034,17 @@ void CXWM::initSelection() {
} }
void CXWM::setClipboardToWayland(SXSelection& sel) { void CXWM::setClipboardToWayland(SXSelection& sel) {
sel.dataSource = makeShared<CXDataSource>(sel); auto source = makeShared<CXDataSource>(sel);
if (sel.dataSource->mimes().empty()) { if (source->mimes().empty()) {
Debug::log(ERR, "[xwm] can't set clipboard: no MIMEs"); Debug::log(ERR, "[xwm] can't set clipboard: no MIMEs");
sel.dataSource.reset(); return;
} }
if (sel.dataSource) { sel.dataSource = source;
Debug::log(LOG, "[xwm] X clipboard at {:x} takes clipboard", (uintptr_t)sel.dataSource.get()); Debug::log(LOG, "[xwm] X clipboard at {:x} takes clipboard", (uintptr_t)sel.dataSource.get());
g_pSeatManager->setCurrentSelection(sel.dataSource); g_pSeatManager->setCurrentSelection(sel.dataSource);
} }
}
void CXWM::getTransferData(SXSelection& sel) { void CXWM::getTransferData(SXSelection& sel) {
Debug::log(LOG, "[xwm] getTransferData"); Debug::log(LOG, "[xwm] getTransferData");