Fix cursor z-order issue by continuously refreshing HWND_TOPMOST status

This commit is contained in:
2025-05-05 19:30:21 -05:00
parent 18283a7829
commit 4291c8106b
+21
View File
@@ -151,6 +151,15 @@ mod windows {
// Make sure the window is visible
ShowWindow(hwnd, SW_SHOW);
// Always ensure the window is topmost before updating
// This ensures our cursor stays above all other windows including system menus
SetWindowPos(
hwnd,
HWND_TOPMOST,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE
);
// Update the layered window atomically
// Convert references to raw pointers for UpdateLayeredWindow
let result = UpdateLayeredWindow(
@@ -834,6 +843,18 @@ del "%~f0"
return;
}
// Ensure the cursor window is always topmost, even if no movement occurred
if let Some(hwnd) = CURSOR_WINDOW {
// Always ensure the window is topmost, even if the cursor hasn't moved
// This helps ensure our cursor stays above system menus and other topmost windows
SetWindowPos(
hwnd,
HWND_TOPMOST,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE
);
}
// Update the cursor position using our new function
update_cursor_position(&point);
}