diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 3d1e4fa3..25b7ab8c 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -875,7 +875,6 @@ void UBBoardController::showKeyboard(bool show) UBPlatformUtils::showOSK(show); else mPaletteManager->showVirtualKeyboard(show); - } @@ -2171,7 +2170,10 @@ void UBBoardController::stylusToolChanged(int tool) if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text) { if(mPaletteManager->mKeyboardPalette->m_isVisible) - UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger); + { + if (!UBPlatformUtils::errorOpeningVirtualKeyboard) + UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger); + } } } diff --git a/src/frameworks/UBPlatformUtils.cpp b/src/frameworks/UBPlatformUtils.cpp index b5335f8f..74a17b95 100644 --- a/src/frameworks/UBPlatformUtils.cpp +++ b/src/frameworks/UBPlatformUtils.cpp @@ -66,7 +66,9 @@ UBKeyboardLocale::~UBKeyboardLocale() int UBPlatformUtils::nKeyboardLayouts; UBKeyboardLocale** UBPlatformUtils::keyboardLayouts; - +#ifdef Q_OS_OSX +bool UBPlatformUtils::errorOpeningVirtualKeyboard = false; +#endif UBKeyboardLocale** UBPlatformUtils::getKeyboardLayouts(int& nCount) { nCount = nKeyboardLayouts; diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index 8e6b91ed..6d8ad70c 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -213,6 +213,8 @@ public: #ifdef Q_OS_OSX static void SetMacLocaleByIdentifier(const QString& id); static void toggleFinder(const bool on); + + static bool errorOpeningVirtualKeyboard; #endif }; diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 34fe2d72..0b208c06 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -684,6 +684,7 @@ void UBPlatformUtils::showOSK(bool show) tell application \"System Events\"\n\ tell application process \"TextInputMenuAgent\"\n\ tell menu 1 of menu bar item 1 of menu bar 2\n\ + delay 0.2\n\ click menu item 2\n\ end tell\n\ end tell\n\ @@ -696,6 +697,8 @@ void UBPlatformUtils::showOSK(bool show) if(errorInfo!=nil) { + errorOpeningVirtualKeyboard = true; + NSAlert *alert = [[NSAlert alloc] init]; if (alert != nil) @@ -711,5 +714,9 @@ void UBPlatformUtils::showOSK(bool show) UBApplication::mainWindow->actionVirtualKeyboard->setChecked(true); } } + else + { + errorOpeningVirtualKeyboard = false; + } } }