mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added winapi-call to flush clipboard (#778)
This commit is contained in:
parent
845c595b70
commit
770e36c10c
|
@ -11,6 +11,10 @@
|
|||
#include "singletons/Updates.hpp"
|
||||
#include "widgets/dialogs/LastRunCrashDialog.hpp"
|
||||
|
||||
#ifdef USEWINSDK
|
||||
# include "util/WindowsHelper.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef C_USE_BREAKPAD
|
||||
# include <QBreakpadHandler.h>
|
||||
#endif
|
||||
|
@ -133,6 +137,11 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
|
|||
|
||||
chatterino::NetworkManager::deinit();
|
||||
|
||||
#ifdef USEWINSDK
|
||||
// flushing windows clipboard to keep copied messages
|
||||
flushClipboard();
|
||||
#endif
|
||||
|
||||
_exit(0);
|
||||
}
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -34,6 +34,18 @@ boost::optional<UINT> getWindowDpi(HWND hwnd)
|
|||
return boost::none;
|
||||
}
|
||||
|
||||
typedef HRESULT(CALLBACK *OleFlushClipboard_)();
|
||||
|
||||
void flushClipboard()
|
||||
{
|
||||
static HINSTANCE ole32 = LoadLibrary(L"Ole32.dll");
|
||||
if (ole32 != nullptr) {
|
||||
if (auto oleFlushClipboard = OleFlushClipboard_(GetProcAddress(ole32, "OleFlushClipboard"))) {
|
||||
oleFlushClipboard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
namespace chatterino {
|
||||
|
||||
boost::optional<UINT> getWindowDpi(HWND hwnd);
|
||||
void flushClipboard();
|
||||
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
|
|
Loading…
Reference in a new issue