From 53a57ee8c7b0f6ebb9ec89321a005833a1b5f9ba Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Tue, 9 Apr 2019 21:32:10 -0400 Subject: [PATCH] Hide window when performing entry auto-type on macOS * Instead of choosing the last active window, always hide the current window (ie, KeePassXC) * Fixes #2883 --- src/autotype/AutoType.cpp | 2 +- src/autotype/AutoTypePlatformPlugin.h | 2 +- src/autotype/mac/AutoTypeMac.cpp | 4 ++-- src/autotype/mac/AutoTypeMac.h | 2 +- src/autotype/test/AutoTypeTest.cpp | 2 +- src/autotype/test/AutoTypeTest.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 012dee62..0f772d8d 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -214,7 +214,7 @@ void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, c if (hideWindow) { #if defined(Q_OS_MACOS) - m_plugin->raiseLastActiveWindow(); + m_plugin->hideOwnWindow(); #else hideWindow->showMinimized(); #endif diff --git a/src/autotype/AutoTypePlatformPlugin.h b/src/autotype/AutoTypePlatformPlugin.h index 68cf99be..059e7e13 100644 --- a/src/autotype/AutoTypePlatformPlugin.h +++ b/src/autotype/AutoTypePlatformPlugin.h @@ -43,7 +43,7 @@ public: virtual AutoTypeExecutor* createExecutor() = 0; #if defined(Q_OS_MACOS) - virtual bool raiseLastActiveWindow() = 0; + virtual bool hideOwnWindow() = 0; virtual bool raiseOwnWindow() = 0; #endif diff --git a/src/autotype/mac/AutoTypeMac.cpp b/src/autotype/mac/AutoTypeMac.cpp index 60cec114..e73e5377 100644 --- a/src/autotype/mac/AutoTypeMac.cpp +++ b/src/autotype/mac/AutoTypeMac.cpp @@ -165,9 +165,9 @@ bool AutoTypePlatformMac::raiseWindow(WId pid) // // Activate last active window // -bool AutoTypePlatformMac::raiseLastActiveWindow() +bool AutoTypePlatformMac::hideOwnWindow() { - return macUtils()->raiseLastActiveWindow(); + return macUtils()->hideOwnWindow(); } // diff --git a/src/autotype/mac/AutoTypeMac.h b/src/autotype/mac/AutoTypeMac.h index 875c2176..55963da5 100644 --- a/src/autotype/mac/AutoTypeMac.h +++ b/src/autotype/mac/AutoTypeMac.h @@ -44,7 +44,7 @@ public: bool raiseWindow(WId pid) override; AutoTypeExecutor* createExecutor() override; - bool raiseLastActiveWindow() override; + bool hideOwnWindow() override; bool raiseOwnWindow() override; void sendChar(const QChar& ch, bool isKeyDown); diff --git a/src/autotype/test/AutoTypeTest.cpp b/src/autotype/test/AutoTypeTest.cpp index f8754ef3..9a1b6501 100644 --- a/src/autotype/test/AutoTypeTest.cpp +++ b/src/autotype/test/AutoTypeTest.cpp @@ -111,7 +111,7 @@ bool AutoTypePlatformTest::raiseWindow(WId window) } #if defined(Q_OS_MACOS) -bool AutoTypePlatformTest::raiseLastActiveWindow() +bool AutoTypePlatformTest::hideOwnWindow() { return false; } diff --git a/src/autotype/test/AutoTypeTest.h b/src/autotype/test/AutoTypeTest.h index a17028b5..87d19491 100644 --- a/src/autotype/test/AutoTypeTest.h +++ b/src/autotype/test/AutoTypeTest.h @@ -44,7 +44,7 @@ public: AutoTypeExecutor* createExecutor() override; #if defined(Q_OS_MACOS) - bool raiseLastActiveWindow() override; + bool hideOwnWindow() override; bool raiseOwnWindow() override; #endif