diff --git a/src/gui/clipboard.cpp b/src/gui/clipboard.cpp index b751806..96af510 100644 --- a/src/gui/clipboard.cpp +++ b/src/gui/clipboard.cpp @@ -57,14 +57,14 @@ namespace Toolbox { Result getContentType(std::unordered_map &mime_to_format, - const std::string &type) const { + const std::string &type) { if (!OpenClipboard(nullptr)) { return make_clipboard_error("Failed to open the clipboard!"); } UINT format = CF_NULL; if (mime_to_format.find(type) == mime_to_format.end()) { - format = FormatForMime(type); + format = SystemClipboard::FormatForMime(type); if (format == CF_NULL) { mime_to_format[type] = RegisterClipboardFormat(type.c_str()); format = mime_to_format[type]; @@ -273,8 +273,9 @@ namespace Toolbox { return make_clipboard_error("Can't set clipboard to mulitple types at once on Windows!"); } TOOLBOX_ASSERT(formats.size() > 0); + auto type = formats[0]; - std::optional result = mimedata.get_data(formats[0]); + std::optional result = mimedata.get_data(type); if (!result) { return make_clipboard_error( std::format("Failed to find MIME data type \"{}\"", type)); @@ -284,7 +285,7 @@ namespace Toolbox { UINT format = CF_NULL; if (m_mime_to_format.find(type) == m_mime_to_format.end()) { - format = FormatForMime(type); + format = SystemClipboard::FormatForMime(type); if (format == CF_NULL) { m_mime_to_format[type] = RegisterClipboardFormat(type.c_str()); format = m_mime_to_format[type];