From b8c255362460f749316f47a0e0088011de5bb31f Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Fri, 29 Aug 2025 13:00:40 +0200 Subject: [PATCH] Fix focusing behavior --- apps/desktop/desktop_native/core/src/biometric/windows.rs | 8 +------- apps/desktop/src/main/window.main.ts | 8 ++------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/apps/desktop/desktop_native/core/src/biometric/windows.rs b/apps/desktop/desktop_native/core/src/biometric/windows.rs index 9d45fbb9b64..fa418e1f04b 100644 --- a/apps/desktop/desktop_native/core/src/biometric/windows.rs +++ b/apps/desktop/desktop_native/core/src/biometric/windows.rs @@ -204,13 +204,7 @@ impl super::BiometricTrait for BiometricLockSystem { /// Get a yes/no authorization without any cryptographic backing. /// This API has better focusing behavior -fn windows_hello_authenticate(hwnd: Vec, message: String) -> Result { - let window = HWND(isize::from_le_bytes(hwnd.clone().try_into().unwrap()) as *mut c_void); - - // The Windows Hello prompt is displayed inside the application window. For best result we - // should set the window to the foreground and focus it. - set_focus(window); - +fn windows_hello_authenticate(_hwnd: Vec, message: String) -> Result { // Windows Hello prompt must be in foreground, focused, otherwise the face or fingerprint // unlock will not work. We get the current foreground window, which will either be the // Bitwarden desktop app or the browser extension. diff --git a/apps/desktop/src/main/window.main.ts b/apps/desktop/src/main/window.main.ts index 1945945e21e..c40a0b6b627 100644 --- a/apps/desktop/src/main/window.main.ts +++ b/apps/desktop/src/main/window.main.ts @@ -74,13 +74,9 @@ export class WindowMain { }); ipcMain.on("window-focus", () => { - this.logService.info("Focusing window"); if (this.win != null) { - this.logService.info("Showing window"); - this.win.minimize(); - this.show(); - this.win.setSize(this.defaultWidth, this.defaultHeight); - this.win.center(); + this.win.show(); + this.win.focus(); } });