added winapi-call to flush clipboard (#778)
This commit is contained in:
@@ -11,6 +11,10 @@
|
|||||||
#include "singletons/Updates.hpp"
|
#include "singletons/Updates.hpp"
|
||||||
#include "widgets/dialogs/LastRunCrashDialog.hpp"
|
#include "widgets/dialogs/LastRunCrashDialog.hpp"
|
||||||
|
|
||||||
|
#ifdef USEWINSDK
|
||||||
|
# include "util/WindowsHelper.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef C_USE_BREAKPAD
|
#ifdef C_USE_BREAKPAD
|
||||||
# include <QBreakpadHandler.h>
|
# include <QBreakpadHandler.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -133,6 +137,11 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
|
|||||||
|
|
||||||
chatterino::NetworkManager::deinit();
|
chatterino::NetworkManager::deinit();
|
||||||
|
|
||||||
|
#ifdef USEWINSDK
|
||||||
|
// flushing windows clipboard to keep copied messages
|
||||||
|
flushClipboard();
|
||||||
|
#endif
|
||||||
|
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -34,6 +34,18 @@ boost::optional<UINT> getWindowDpi(HWND hwnd)
|
|||||||
return boost::none;
|
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
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
boost::optional<UINT> getWindowDpi(HWND hwnd);
|
boost::optional<UINT> getWindowDpi(HWND hwnd);
|
||||||
|
void flushClipboard();
|
||||||
|
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user