[idd] clipboard: add direct synchronization

This commit is contained in:
Geoffrey McRae
2026-08-14 06:26:35 +10:00
parent a8d531b797
commit b786167f72
35 changed files with 5956 additions and 79 deletions

View File

@@ -19,6 +19,7 @@
*/
#include "CNotifyWindow.h"
#include "CClipboardManager.h"
#include "CConfigWindow.h"
#include "Resources.h"
#include <CDebug.h>
@@ -86,6 +87,11 @@ CNotifyWindow::~CNotifyWindow()
LRESULT CNotifyWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT clipboardResult;
if (m_clipboard && m_clipboard->HandleMessage(
uMsg, wParam, lParam, clipboardResult))
return clipboardResult;
switch (uMsg)
{
case WM_NOTIFY_ICON:
@@ -168,6 +174,8 @@ LRESULT CNotifyWindow::onClose()
LRESULT CNotifyWindow::onDestroy()
{
if (m_clipboard)
m_clipboard->Shutdown();
KillTimer(m_hwnd, ID_DISPLAY_CHECK_TIMER);
Shell_NotifyIcon(NIM_DELETE, &m_iconData);
return 0;
@@ -310,6 +318,20 @@ void CNotifyWindow::setRecoveryMode(bool active)
DEBUG_ERROR_HR(GetLastError(), "Failed to update recovery state");
}
bool CNotifyWindow::initClipboard(CClipboardChannel& channel)
{
if (m_clipboard)
return true;
std::unique_ptr<CClipboardManager> clipboard(
new (std::nothrow) CClipboardManager(m_hwnd, channel));
if (!clipboard)
return false;
if (!clipboard->Initialize())
return false;
m_clipboard = std::move(clipboard);
return true;
}
void CNotifyWindow::handleResolutionRejected(uint32_t width, uint32_t height,
uint32_t requiredSizeMiB)
{