fix(cliprdr-native): handle WM_ACTIVATEAPP in clipboard_subproc (#657)

This PR adds handling of `WM_ACTIVATEAPP` in `clipboard_subproc`.
Previously, the function handled only `WM_ACTIVATE`.
This commit is contained in:
Alex Yusiuk
2025-02-03 13:38:31 -05:00
committed by GitHub
parent 2a5e783c43
commit 9b2926ea12
@@ -9,7 +9,7 @@ use windows::Win32::Foundation::{HWND, LPARAM, LRESULT, WPARAM};
use windows::Win32::System::DataExchange::GetClipboardOwner;
use windows::Win32::UI::Shell::DefSubclassProc;
use windows::Win32::UI::WindowsAndMessaging::{
KillTimer, SetTimer, WA_INACTIVE, WM_ACTIVATE, WM_CLIPBOARDUPDATE, WM_DESTROY, WM_RENDERALLFORMATS,
KillTimer, SetTimer, WA_INACTIVE, WM_ACTIVATE, WM_ACTIVATEAPP, WM_CLIPBOARDUPDATE, WM_DESTROY, WM_RENDERALLFORMATS,
WM_RENDERFORMAT, WM_TIMER,
};
@@ -328,7 +328,7 @@ pub(crate) unsafe extern "system" fn clipboard_subproc(
match msg {
// We need to keep track of window state to distinguish between local and remote copy
WM_ACTIVATE => ctx.window_is_active = wparam.0 != WA_INACTIVE as usize, // `as` conversion is fine for constants
WM_ACTIVATE | WM_ACTIVATEAPP => ctx.window_is_active = wparam.0 != WA_INACTIVE as usize, // `as` conversion is fine for constants
// Sent by the OS when OS clipboard content is changed
WM_CLIPBOARDUPDATE => {
// SAFETY: `GetClipboardOwner` is always safe to call.