From 8ccf7480c481b1c40d9affc2ee3dfa920cbcb5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Thu, 14 May 2020 14:51:47 +0200 Subject: [PATCH] make the dock appear when the cursor selector is choosen so we can navigate through other apps (due to the issue regarding transparent view and interactions with other apps (OSX only)) --- src/desktop/UBDesktopAnnotationController.cpp | 21 ++++++++++++------- src/frameworks/UBPlatformUtils.h | 1 + src/frameworks/UBPlatformUtils_mac.mm | 12 +++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 81133d44..741fafe6 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -374,14 +374,21 @@ void UBDesktopAnnotationController::close() void UBDesktopAnnotationController::stylusToolChanged(int tool) { Q_UNUSED(tool); -// UBStylusTool::Enum eTool = (UBStylusTool::Enum)tool; -// if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text) -// { -// if(mKeyboardPalette->m_isVisible) -// UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger); -// } - updateBackground(); + if (UBDrawingController::drawingController()->isInDesktopMode()) + { + UBStylusTool::Enum eTool = (UBStylusTool::Enum)tool; + if(eTool == UBStylusTool::Selector) + { + UBPlatformUtils::toggleFinder(true); + } + else + { + UBPlatformUtils::toggleFinder(false); + } + + updateBackground(); + } } diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index 99ee165d..8e6b91ed 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -212,6 +212,7 @@ public: #ifdef Q_OS_OSX static void SetMacLocaleByIdentifier(const QString& id); + static void toggleFinder(const bool on); #endif }; diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index ec8be575..37d5b1b3 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -524,6 +524,18 @@ QString UBPlatformUtils::urlFromClipboard() return qsRet; } +void UBPlatformUtils::toggleFinder(const bool on) +{ + if (on) + { + [NSApp setPresentationOptions:NSApplicationPresentationDefault]; + } + else + { + [NSApp setPresentationOptions:NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock]; + } +} + void UBPlatformUtils::SetMacLocaleByIdentifier(const QString& id) {