xwayland: force default plain mime atoms on known types

ref #6247
This commit is contained in:
Vaxry 2024-06-16 19:52:07 +02:00
parent 2031af82fa
commit 069a21a34e

View file

@ -49,12 +49,18 @@ std::vector<std::string> CXDataSource::mimes() {
void CXDataSource::send(const std::string& mime, uint32_t fd) { void CXDataSource::send(const std::string& mime, uint32_t fd) {
xcb_atom_t mimeAtom = 0; xcb_atom_t mimeAtom = 0;
if (mime == "text/plain")
mimeAtom = HYPRATOMS["TEXT"];
else if (mime == "text/plain;charset=utf-8")
mimeAtom = HYPRATOMS["UTF8_STRING"];
else {
for (size_t i = 0; i < mimeTypes.size(); ++i) { for (size_t i = 0; i < mimeTypes.size(); ++i) {
if (mimeTypes.at(i) == mime) { if (mimeTypes.at(i) == mime) {
mimeAtom = mimeAtoms.at(i); mimeAtom = mimeAtoms.at(i);
break; break;
} }
} }
}
if (!mimeAtom) { if (!mimeAtom) {
Debug::log(ERR, "[XDataSource] mime atom not found"); Debug::log(ERR, "[XDataSource] mime atom not found");